diff options
Diffstat (limited to 'vendor/go.opentelemetry.io/otel/metric/meter.go')
-rw-r--r-- | vendor/go.opentelemetry.io/otel/metric/meter.go | 79 |
1 files changed, 28 insertions, 51 deletions
diff --git a/vendor/go.opentelemetry.io/otel/metric/meter.go b/vendor/go.opentelemetry.io/otel/metric/meter.go index 1d60cf57a..2f69d2ae5 100644 --- a/vendor/go.opentelemetry.io/otel/metric/meter.go +++ b/vendor/go.opentelemetry.io/otel/metric/meter.go @@ -17,91 +17,80 @@ package metric // import "go.opentelemetry.io/otel/metric" import ( "context" - "go.opentelemetry.io/otel/metric/embedded" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/instrument" ) // MeterProvider provides access to named Meter instances, for instrumenting -// an application or package. +// an application or library. // -// 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. +// Warning: methods may be added to this interface in minor releases. 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 - // 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 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. // -// 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. +// Warning: methods may be added to this interface in minor releases. 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. - Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, 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 ...Int64UpDownCounterOption) (Int64UpDownCounter, 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 ...Int64HistogramOption) (Int64Histogram, 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 ...Int64ObservableCounterOption) (Int64ObservableCounter, 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 ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, 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 ...Int64ObservableGaugeOption) (Int64ObservableGauge, 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 ...Float64CounterOption) (Float64Counter, 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 ...Float64UpDownCounterOption) (Float64UpDownCounter, 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 ...Float64HistogramOption) (Float64Histogram, 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 ...Float64ObservableCounterOption) (Float64ObservableCounter, 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 ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, 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 ...Float64ObservableGaugeOption) (Float64ObservableGauge, error) + Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) // RegisterCallback registers f to be called during the collection of a // measurement cycle. @@ -114,12 +103,12 @@ type Meter interface { // // If no instruments are passed, f should not be registered nor called // during collection. - RegisterCallback(f Callback, instruments ...Observable) (Registration, error) + RegisterCallback(f Callback, instruments ...instrument.Asynchronous) (Registration, error) } // 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 measurement observations for these instruments. +// 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. @@ -132,28 +121,16 @@ 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 for obsrv. - ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption) - // ObserveInt64 records the int64 value for obsrv. - ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption) + // 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) } // 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. |