From 2aadf656e241406af7fe9913ebcf444ed71bb149 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 8 May 2023 07:56:53 -0700 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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 }