AddConfig contains options for an addition measurement.
type AddConfig struct {
// contains filtered or unexported fields
}
func NewAddConfig(opts []AddOption) AddConfig
NewAddConfig returns a new AddConfig with all opts applied.
func (c AddConfig) Attributes() attribute.Set
Attributes returns the configured attribute set.
AddOption applies options to an addition measurement. See MeasurementOption for other options that can be used as an AddOption.
type AddOption interface {
// contains filtered or unexported methods
}
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.
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, Observer) error
Float64Callback is a function registered with a Meter that makes 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.
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
Float64Counter is an instrument that records increasing float64 values.
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 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. // // 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 record int64 values.
type Float64CounterConfig struct {
// contains filtered or unexported fields
}
func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig
NewFloat64CounterConfig returns a new Float64CounterConfig with all opts applied.
func (c Float64CounterConfig) Description() string
Description returns the configured description.
func (c Float64CounterConfig) Unit() string
Unit returns the configured unit.
Float64CounterOption applies options to a Float64CounterConfig. See InstrumentOption for other options that can be used as a Float64CounterOption.
type Float64CounterOption interface {
// contains filtered or unexported methods
}
Float64Histogram is an instrument that records a distribution of float64 values.
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 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. // // 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 that record int64 values.
type Float64HistogramConfig struct {
// contains filtered or unexported fields
}
func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig
NewFloat64HistogramConfig returns a new Float64HistogramConfig with all opts applied.
func (c Float64HistogramConfig) Description() string
Description returns the configured description.
func (c Float64HistogramConfig) ExplicitBucketBoundaries() []float64
ExplicitBucketBoundaries returns the configured explicit bucket boundaries.
func (c Float64HistogramConfig) Unit() string
Unit returns the configured unit.
Float64HistogramOption applies options to a Float64HistogramConfig. See InstrumentOption for other options that can be used as a Float64HistogramOption.
type Float64HistogramOption interface {
// contains filtered or unexported methods
}
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 Float64Observable interface { Observable // contains filtered or unexported methods }
Float64ObservableCounter is an instrument used to asynchronously record 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. See package documentation on API implementation for information on how to set 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 }
Float64ObservableCounterConfig contains options for asynchronous counter instruments that record int64 values.
type Float64ObservableCounterConfig struct {
// contains filtered or unexported fields
}
func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig
NewFloat64ObservableCounterConfig returns a new Float64ObservableCounterConfig with all opts applied.
func (c Float64ObservableCounterConfig) Callbacks() []Float64Callback
Callbacks returns the configured callbacks.
func (c Float64ObservableCounterConfig) Description() string
Description returns the configured description.
func (c Float64ObservableCounterConfig) Unit() string
Unit returns the configured unit.
Float64ObservableCounterOption applies options to a Float64ObservableCounterConfig. See Float64ObservableOption and InstrumentOption for other options that can be used as a Float64ObservableCounterOption.
type Float64ObservableCounterOption interface {
// contains filtered or unexported methods
}
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.
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 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 }
Float64ObservableGaugeConfig contains options for asynchronous counter instruments that record int64 values.
type Float64ObservableGaugeConfig struct {
// contains filtered or unexported fields
}
func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig
NewFloat64ObservableGaugeConfig returns a new Float64ObservableGaugeConfig with all opts applied.
func (c Float64ObservableGaugeConfig) Callbacks() []Float64Callback
Callbacks returns the configured callbacks.
func (c Float64ObservableGaugeConfig) Description() string
Description returns the configured description.
func (c Float64ObservableGaugeConfig) Unit() string
Unit returns the configured unit.
Float64ObservableGaugeOption applies options to a Float64ObservableGaugeConfig. See Float64ObservableOption and InstrumentOption for other options that can be used as a Float64ObservableGaugeOption.
type Float64ObservableGaugeOption interface {
// contains filtered or unexported methods
}
Float64ObservableOption applies options to float64 Observer instruments.
type Float64ObservableOption interface { Float64ObservableCounterOption Float64ObservableUpDownCounterOption Float64ObservableGaugeOption }
func WithFloat64Callback(callback Float64Callback) Float64ObservableOption
WithFloat64Callback adds callback to be called for an instrument.
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 the to be the cumulative sum of the count.
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 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 }
Float64ObservableUpDownCounterConfig contains options for asynchronous counter instruments that record int64 values.
type Float64ObservableUpDownCounterConfig struct {
// contains filtered or unexported fields
}
func NewFloat64ObservableUpDownCounterConfig(opts ...Float64ObservableUpDownCounterOption) Float64ObservableUpDownCounterConfig
NewFloat64ObservableUpDownCounterConfig returns a new Float64ObservableUpDownCounterConfig with all opts applied.
func (c Float64ObservableUpDownCounterConfig) Callbacks() []Float64Callback
Callbacks returns the configured callbacks.
func (c Float64ObservableUpDownCounterConfig) Description() string
Description returns the configured description.
func (c Float64ObservableUpDownCounterConfig) Unit() string
Unit returns the configured unit.
Float64ObservableUpDownCounterOption applies options to a Float64ObservableUpDownCounterConfig. See Float64ObservableOption and InstrumentOption for other options that can be used as a Float64ObservableUpDownCounterOption.
type Float64ObservableUpDownCounterOption interface {
// contains filtered or unexported methods
}
Float64Observer is a recorder of float64 measurements.
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 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. // // Use the WithAttributeSet (or, if performance is not a concern, // the WithAttributes) option to include measurement attributes. Observe(value float64, options ...ObserveOption) }
Float64UpDownCounter is an instrument that records increasing or decreasing float64 values.
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 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. // // 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 instruments that record int64 values.
type Float64UpDownCounterConfig struct {
// contains filtered or unexported fields
}
func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig
NewFloat64UpDownCounterConfig returns a new Float64UpDownCounterConfig with all opts applied.
func (c Float64UpDownCounterConfig) Description() string
Description returns the configured description.
func (c Float64UpDownCounterConfig) Unit() string
Unit returns the configured unit.
Float64UpDownCounterOption applies options to a Float64UpDownCounterConfig. See InstrumentOption for other options that can be used as a Float64UpDownCounterOption.
type Float64UpDownCounterOption interface {
// contains filtered or unexported methods
}
HistogramOption applies options to histogram instruments.
type HistogramOption interface { Int64HistogramOption Float64HistogramOption }
func WithExplicitBucketBoundaries(bounds ...float64) HistogramOption
WithExplicitBucketBoundaries sets the instrument explicit bucket boundaries.
This option is considered "advisory", and may be ignored by API implementations.
InstrumentOption applies options to all instruments.
type InstrumentOption interface { Int64CounterOption Int64UpDownCounterOption Int64HistogramOption Int64ObservableCounterOption Int64ObservableUpDownCounterOption Int64ObservableGaugeOption Float64CounterOption Float64UpDownCounterOption Float64HistogramOption Float64ObservableCounterOption Float64ObservableUpDownCounterOption Float64ObservableGaugeOption }
func WithDescription(desc string) InstrumentOption
WithDescription sets the instrument description.
func WithUnit(u string) InstrumentOption
WithUnit sets the instrument unit.
The unit u should be defined using the appropriate [UCUM](https://ucum.org) case-sensitive code.
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 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
Int64Counter is an instrument that records increasing int64 values.
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 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. // // 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 record int64 values.
type Int64CounterConfig struct {
// contains filtered or unexported fields
}
func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig
NewInt64CounterConfig returns a new Int64CounterConfig with all opts applied.
func (c Int64CounterConfig) Description() string
Description returns the configured description.
func (c Int64CounterConfig) Unit() string
Unit returns the configured unit.
Int64CounterOption applies options to a Int64CounterConfig. See InstrumentOption for other options that can be used as an Int64CounterOption.
type Int64CounterOption interface {
// contains filtered or unexported methods
}
Int64Histogram is an instrument that records a distribution of int64 values.
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 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. // // 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 that record int64 values.
type Int64HistogramConfig struct {
// contains filtered or unexported fields
}
func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig
NewInt64HistogramConfig returns a new Int64HistogramConfig with all opts applied.
func (c Int64HistogramConfig) Description() string
Description returns the configured description.
func (c Int64HistogramConfig) ExplicitBucketBoundaries() []float64
ExplicitBucketBoundaries returns the configured explicit bucket boundaries.
func (c Int64HistogramConfig) Unit() string
Unit returns the configured unit.
Int64HistogramOption applies options to a Int64HistogramConfig. See InstrumentOption for other options that can be used as an Int64HistogramOption.
type Int64HistogramOption interface {
// contains filtered or unexported methods
}
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 Int64Observable interface { Observable // contains filtered or unexported methods }
Int64ObservableCounter is an instrument used to asynchronously record 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. See 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 }
Int64ObservableCounterConfig contains options for asynchronous counter instruments that record int64 values.
type Int64ObservableCounterConfig struct {
// contains filtered or unexported fields
}
func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig
NewInt64ObservableCounterConfig returns a new Int64ObservableCounterConfig with all opts applied.
func (c Int64ObservableCounterConfig) Callbacks() []Int64Callback
Callbacks returns the configured callbacks.
func (c Int64ObservableCounterConfig) Description() string
Description returns the configured description.
func (c Int64ObservableCounterConfig) Unit() string
Unit returns the configured unit.
Int64ObservableCounterOption applies options to a Int64ObservableCounterConfig. See Int64ObservableOption and InstrumentOption for other options that can be used as an Int64ObservableCounterOption.
type Int64ObservableCounterOption interface {
// contains filtered or unexported methods
}
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.
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 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 }
Int64ObservableGaugeConfig contains options for asynchronous counter instruments that record int64 values.
type Int64ObservableGaugeConfig struct {
// contains filtered or unexported fields
}
func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig
NewInt64ObservableGaugeConfig returns a new Int64ObservableGaugeConfig with all opts applied.
func (c Int64ObservableGaugeConfig) Callbacks() []Int64Callback
Callbacks returns the configured callbacks.
func (c Int64ObservableGaugeConfig) Description() string
Description returns the configured description.
func (c Int64ObservableGaugeConfig) Unit() string
Unit returns the configured unit.
Int64ObservableGaugeOption applies options to a Int64ObservableGaugeConfig. See Int64ObservableOption and InstrumentOption for other options that can be used as an Int64ObservableGaugeOption.
type Int64ObservableGaugeOption interface {
// contains filtered or unexported methods
}
Int64ObservableOption applies options to int64 Observer instruments.
type Int64ObservableOption interface { Int64ObservableCounterOption Int64ObservableUpDownCounterOption Int64ObservableGaugeOption }
func WithInt64Callback(callback Int64Callback) Int64ObservableOption
WithInt64Callback adds callback to be called for an instrument.
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 be the cumulative sum of the count.
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 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 }
Int64ObservableUpDownCounterConfig contains options for asynchronous counter instruments that record int64 values.
type Int64ObservableUpDownCounterConfig struct {
// contains filtered or unexported fields
}
func NewInt64ObservableUpDownCounterConfig(opts ...Int64ObservableUpDownCounterOption) Int64ObservableUpDownCounterConfig
NewInt64ObservableUpDownCounterConfig returns a new Int64ObservableUpDownCounterConfig with all opts applied.
func (c Int64ObservableUpDownCounterConfig) Callbacks() []Int64Callback
Callbacks returns the configured callbacks.
func (c Int64ObservableUpDownCounterConfig) Description() string
Description returns the configured description.
func (c Int64ObservableUpDownCounterConfig) Unit() string
Unit returns the configured unit.
Int64ObservableUpDownCounterOption applies options to a Int64ObservableUpDownCounterConfig. See Int64ObservableOption and InstrumentOption for other options that can be used as an Int64ObservableUpDownCounterOption.
type Int64ObservableUpDownCounterOption interface {
// contains filtered or unexported methods
}
Int64Observer is a recorder of int64 measurements.
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 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. // // Use the WithAttributeSet (or, if performance is not a concern, // the WithAttributes) option to include measurement attributes. Observe(value int64, options ...ObserveOption) }
Int64UpDownCounter is an instrument that records increasing or decreasing int64 values.
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 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. // // 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 instruments that record int64 values.
type Int64UpDownCounterConfig struct {
// contains filtered or unexported fields
}
func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig
NewInt64UpDownCounterConfig returns a new Int64UpDownCounterConfig with all opts applied.
func (c Int64UpDownCounterConfig) Description() string
Description returns the configured description.
func (c Int64UpDownCounterConfig) Unit() string
Unit returns the configured unit.
Int64UpDownCounterOption applies options to a Int64UpDownCounterConfig. See InstrumentOption for other options that can be used as an Int64UpDownCounterOption.
type Int64UpDownCounterOption interface {
// contains filtered or unexported methods
}
MeasurementOption applies options to all instrument measurement.
type MeasurementOption interface { AddOption RecordOption ObserveOption }
func WithAttributeSet(attributes attribute.Set) MeasurementOption
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 WithAttributes(attributes ...attribute.KeyValue) MeasurementOption
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.
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.
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 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 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 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 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 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 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 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 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 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 // Float64ObservableUpDownCounter instrument identified by name and // configured with options. The instrument is used to asynchronously record // 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 // 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. // // The function f needs to be concurrent safe. RegisterCallback(f Callback, instruments ...Observable) (Registration, error) }
▹ Example (Attributes)
▹ Example (Counter)
▹ Example (Histogram)
▹ Example (ObservableCounter)
▹ Example (ObservableGauge)
▹ Example (ObservableUpDownCounter)
▹ Example (Synchronous)
▹ Example (UpDownCounter)
MeterConfig contains options for Meters.
type MeterConfig struct {
// contains filtered or unexported fields
}
func NewMeterConfig(opts ...MeterOption) MeterConfig
NewMeterConfig creates a new MeterConfig and applies all the given options.
func (cfg MeterConfig) InstrumentationAttributes() attribute.Set
InstrumentationAttributes returns the attributes associated with the library providing instrumentation.
func (cfg MeterConfig) InstrumentationVersion() string
InstrumentationVersion returns the version of the library providing instrumentation.
func (cfg MeterConfig) SchemaURL() string
SchemaURL is the schema_url of the library providing instrumentation.
MeterOption is an interface for applying Meter options.
type MeterOption interface {
// contains filtered or unexported methods
}
func WithInstrumentationAttributes(attr ...attribute.KeyValue) MeterOption
WithInstrumentationAttributes sets the instrumentation attributes.
The passed attributes will be de-duplicated.
func WithInstrumentationVersion(version string) MeterOption
WithInstrumentationVersion sets the instrumentation version.
func WithSchemaURL(schemaURL string) MeterOption
WithSchemaURL sets the schema URL.
MeterProvider provides access to named Meter instances, for instrumenting an application or package.
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 { // 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. // // 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 }
Observable is used as a grouping mechanism for all instruments that are updated within a Callback.
type Observable interface {
// contains filtered or unexported methods
}
ObserveConfig contains options for an observed measurement.
type ObserveConfig struct {
// contains filtered or unexported fields
}
func NewObserveConfig(opts []ObserveOption) ObserveConfig
NewObserveConfig returns a new ObserveConfig with all opts applied.
func (c ObserveConfig) Attributes() attribute.Set
Attributes returns the configured attribute set.
ObserveOption applies options to an addition measurement. See MeasurementOption for other options that can be used as a ObserveOption.
type ObserveOption interface {
// contains filtered or unexported methods
}
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 { // 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. ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption) // ObserveInt64 records the int64 value for obsrv. ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption) }
RecordConfig contains options for a recorded measurement.
type RecordConfig struct {
// contains filtered or unexported fields
}
func NewRecordConfig(opts []RecordOption) RecordConfig
NewRecordConfig returns a new RecordConfig with all opts applied.
func (c RecordConfig) Attributes() attribute.Set
Attributes returns the configured attribute set.
RecordOption applies options to an addition measurement. See MeasurementOption for other options that can be used as a RecordOption.
type RecordOption interface {
// contains filtered or unexported methods
}
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 { // 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. // // This method needs to be idempotent and concurrent safe. Unregister() error }