package metric
Import Path
go.opentelemetry.io/otel/metric (on go.dev)
Dependency Relation
imports 3 packages, and imported by 6 packages
Involved Source Files
asyncfloat64.go
asyncint64.go
config.go
Package metric provides the OpenTelemetry API used to measure metrics about
source code operation.
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.
# 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], 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], 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.
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], and [Float64ObservableCounter]) are
designed to measure values that never decrease in value, but instead only
incrementally increase in value. UpDownCounters ([Int64UpDownCounter],
[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] 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.
# Instrument Name
OpenTelemetry defines an [instrument name syntax] that restricts what
instrument names are allowed.
Instrument names should ...
- Not be empty.
- Have an alphabetic character as their first letter.
- Have any letter after the first be an alphanumeric character, ‘_’, ‘.’,
‘-’, or ‘/’.
- Have a maximum length of 255 letters.
To ensure compatibility with observability platforms, all instruments created
need to conform to this syntax. Not all implementations of the API will validate
these names, it is the callers responsibility to ensure compliance.
# 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
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 wants 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.
instrument.go
meter.go
syncfloat64.go
syncint64.go
Code Examples
package main
import (
"context"
"fmt"
"runtime"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
)
var meter = otel.Meter("my-service-meter")
func main() {
// This is just a sample of memory stats to record from the Memstats
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(
func(_ context.Context, o metric.Observer) error {
memStats := &runtime.MemStats{}
// This call does work
runtime.ReadMemStats(memStats)
o.ObserveInt64(heapAlloc, int64(memStats.HeapAlloc))
o.ObserveInt64(gcCount, int64(memStats.NumGC))
return nil
},
heapAlloc,
gcCount,
)
if err != nil {
fmt.Println("Failed to register callback")
panic(err)
}
}
package main
import (
"context"
"fmt"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
)
var meter = otel.Meter("my-service-meter")
func main() {
_, err := meter.Int64ObservableGauge(
"DiskUsage",
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)
// if err != nil {
// if retryable(err) {
// // Retry the usage measurement.
// } else {
// return err
// }
// }
//
// For demonstration purpose, a static value is used here.
usage := 75000
obsrv.Observe(int64(usage), metric.WithAttributes(attribute.Int("disk.id", 3)))
return nil
}),
)
if err != nil {
fmt.Println("failed to register instrument")
panic(err)
}
}
package main
import (
"net/http"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
semconv "go.opentelemetry.io/otel/semconv/v1.37.0"
)
var meter = otel.Meter("my-service-meter")
func main() {
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(_ 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.HTTPResponseStatusCode(statusCode)))
})
}
package main
import (
"net/http"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
)
var meter = otel.Meter("my-service-meter")
func main() {
apiCounter, err := meter.Int64Counter(
"api.counter",
metric.WithDescription("Number of API calls."),
metric.WithUnit("{call}"),
)
if err != nil {
panic(err)
}
http.HandleFunc("/", func(_ http.ResponseWriter, r *http.Request) {
apiCounter.Add(r.Context(), 1)
// do some work in an API call
})
}
{
speedGauge, err := meter.Int64Gauge(
"cpu.fan.speed",
metric.WithDescription("Speed of CPU fan"),
metric.WithUnit("RPM"),
)
if err != nil {
panic(err)
}
getCPUFanSpeed := func() int64 {
return int64(1500 + rand.IntN(1000))
}
fanSpeedSubscription := make(chan int64, 1)
go func() {
defer close(fanSpeedSubscription)
for range 5 {
time.Sleep(time.Duration(rand.IntN(3)) * time.Second)
fanSpeed := getCPUFanSpeed()
fanSpeedSubscription <- fanSpeed
}
}()
ctx := context.Background()
for fanSpeed := range fanSpeedSubscription {
speedGauge.Record(ctx, fanSpeed)
}
}
package main
import (
"net/http"
"time"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
)
var meter = otel.Meter("my-service-meter")
func main() {
histogram, err := meter.Float64Histogram(
"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)
}
http.HandleFunc("/", func(_ 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())
})
}
package main
import (
"context"
"time"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
)
var meter = otel.Meter("my-service-meter")
func main() {
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)
}
}
package main
import (
"context"
"runtime"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
)
var meter = otel.Meter("my-service-meter")
func main() {
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)
}
}
package main
import (
"context"
"database/sql"
"go.opentelemetry.io/otel/metric"
)
func main() {
// 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, _ string) (metric.Registration, error) {
m, 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(m, int64(stats.MaxOpenConnections))
o.ObserveInt64(waitTime, int64(stats.WaitDuration))
return nil
},
m,
waitTime,
)
if err != nil {
return nil, err
}
return reg, nil
}
}
package main
import (
"context"
"fmt"
"time"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
)
var meter = otel.Meter("my-service-meter")
func main() {
// Create a histogram using the global MeterProvider.
workDuration, err := meter.Int64Histogram(
"workDuration",
metric.WithUnit("ms"))
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())
}
package main
import (
"context"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
)
var meter = otel.Meter("my-service-meter")
func main() {
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)
}
}
Package-Level Type Names (total 67)
AddConfig contains options for an addition measurement.
Attributes returns the configured attribute set.
func NewAddConfig(opts []AddOption) AddConfig
AddOption applies options to an addition measurement. See
[MeasurementOption] for other options that can be used as an AddOption.
MeasurementOption (interface)
func NewAddConfig(opts []AddOption) AddConfig
func Float64Counter.Add(ctx context.Context, incr float64, options ...AddOption)
func Float64UpDownCounter.Add(ctx context.Context, incr float64, options ...AddOption)
func Int64Counter.Add(ctx context.Context, incr int64, options ...AddOption)
func Int64UpDownCounter.Add(ctx context.Context, incr int64, options ...AddOption)
func go.opentelemetry.io/otel/metric/noop.Float64Counter.Add(context.Context, float64, ...AddOption)
func go.opentelemetry.io/otel/metric/noop.Float64UpDownCounter.Add(context.Context, float64, ...AddOption)
func go.opentelemetry.io/otel/metric/noop.Int64Counter.Add(context.Context, int64, ...AddOption)
func go.opentelemetry.io/otel/metric/noop.Int64UpDownCounter.Add(context.Context, int64, ...AddOption)
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.
func Meter.RegisterCallback(f Callback, instruments ...Observable) (Registration, error)
func go.opentelemetry.io/otel/metric/noop.Meter.RegisterCallback(Callback, ...Observable) (Registration, error)
Float64Callback is a function registered with a Meter that makes
observations for a Float64Observable 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.
func Float64ObservableCounterConfig.Callbacks() []Float64Callback
func Float64ObservableGaugeConfig.Callbacks() []Float64Callback
func Float64ObservableUpDownCounterConfig.Callbacks() []Float64Callback
func WithFloat64Callback(callback Float64Callback) Float64ObservableOption
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.
Add records a change to the counter.
Use the WithAttributeSet (or, if performance is not a concern,
the WithAttributes) option to include measurement attributes.
go.opentelemetry.io/otel/metric/noop.Float64Counter
Float64Counter : go.opentelemetry.io/otel/metric/embedded.Float64Counter
func Meter.Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64Counter(string, ...Float64CounterOption) (Float64Counter, error)
Float64CounterConfig contains options for synchronous counter instruments that
record float64 values.
Description returns the configured description.
Unit returns the configured unit.
Float64CounterConfig : github.com/alexflint/go-arg.Described
func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig
Float64CounterOption applies options to a [Float64CounterConfig]. See
[InstrumentOption] for other options that can be used as a
Float64CounterOption.
InstrumentOption (interface)
func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig
func Meter.Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64Counter(string, ...Float64CounterOption) (Float64Counter, error)
Float64Gauge is an instrument that records instantaneous 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.
Record records the instantaneous value.
Use the WithAttributeSet (or, if performance is not a concern,
the WithAttributes) option to include measurement attributes.
go.opentelemetry.io/otel/metric/noop.Float64Gauge
Float64Gauge : go.opentelemetry.io/otel/metric/embedded.Float64Gauge
func Meter.Float64Gauge(name string, options ...Float64GaugeOption) (Float64Gauge, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64Gauge(string, ...Float64GaugeOption) (Float64Gauge, error)
Float64GaugeConfig contains options for synchronous gauge instruments that
record float64 values.
Description returns the configured description.
Unit returns the configured unit.
Float64GaugeConfig : github.com/alexflint/go-arg.Described
func NewFloat64GaugeConfig(opts ...Float64GaugeOption) Float64GaugeConfig
Float64GaugeOption applies options to a [Float64GaugeConfig]. See
[InstrumentOption] for other options that can be used as a
Float64GaugeOption.
InstrumentOption (interface)
func NewFloat64GaugeConfig(opts ...Float64GaugeOption) Float64GaugeConfig
func Meter.Float64Gauge(name string, options ...Float64GaugeOption) (Float64Gauge, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64Gauge(string, ...Float64GaugeOption) (Float64Gauge, error)
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.
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.
go.opentelemetry.io/otel/metric/noop.Float64Histogram
Float64Histogram : go.opentelemetry.io/otel/metric/embedded.Float64Histogram
func Meter.Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64Histogram(string, ...Float64HistogramOption) (Float64Histogram, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKExporterOperationDuration.Inst() Float64Histogram
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKMetricReaderCollectionDuration.Inst() Float64Histogram
Float64HistogramConfig contains options for synchronous histogram
instruments that record float64 values.
Description returns the configured description.
ExplicitBucketBoundaries returns the configured explicit bucket boundaries.
Unit returns the configured unit.
Float64HistogramConfig : github.com/alexflint/go-arg.Described
func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig
Float64HistogramOption applies options to a [Float64HistogramConfig]. See
[InstrumentOption] for other options that can be used as a
Float64HistogramOption.
HistogramOption (interface)
InstrumentOption (interface)
func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig
func Meter.Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64Histogram(string, ...Float64HistogramOption) (Float64Histogram, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterOperationDuration(m Meter, opt ...Float64HistogramOption) (otelconv.SDKExporterOperationDuration, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKMetricReaderCollectionDuration(m Meter, opt ...Float64HistogramOption) (otelconv.SDKMetricReaderCollectionDuration, error)
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.
Float64ObservableCounter (interface)
Float64ObservableGauge (interface)
Float64ObservableUpDownCounter (interface)
go.opentelemetry.io/otel/metric/noop.Float64ObservableCounter
go.opentelemetry.io/otel/metric/noop.Float64ObservableGauge
go.opentelemetry.io/otel/metric/noop.Float64ObservableUpDownCounter
Float64Observable : Observable
func Observer.ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption)
func go.opentelemetry.io/otel/metric/noop.Observer.ObserveFloat64(Float64Observable, float64, ...ObserveOption)
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.
go.opentelemetry.io/otel/metric/noop.Float64ObservableCounter
Float64ObservableCounter : Float64Observable
Float64ObservableCounter : Observable
Float64ObservableCounter : go.opentelemetry.io/otel/metric/embedded.Float64ObservableCounter
func Meter.Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64ObservableCounter(string, ...Float64ObservableCounterOption) (Float64ObservableCounter, error)
Float64ObservableCounterConfig contains options for asynchronous counter
instruments that record float64 values.
Callbacks returns the configured callbacks.
Description returns the configured description.
Unit returns the configured unit.
Float64ObservableCounterConfig : github.com/alexflint/go-arg.Described
func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig
Float64ObservableCounterOption applies options to a
[Float64ObservableCounterConfig]. See [Float64ObservableOption] and
[InstrumentOption] for other options that can be used as a
Float64ObservableCounterOption.
Float64ObservableOption (interface)
InstrumentOption (interface)
func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig
func Meter.Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64ObservableCounter(string, ...Float64ObservableCounterOption) (Float64ObservableCounter, error)
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.
go.opentelemetry.io/otel/metric/noop.Float64ObservableGauge
Float64ObservableGauge : Float64Observable
Float64ObservableGauge : Observable
Float64ObservableGauge : go.opentelemetry.io/otel/metric/embedded.Float64ObservableGauge
func Meter.Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64ObservableGauge(string, ...Float64ObservableGaugeOption) (Float64ObservableGauge, error)
Float64ObservableGaugeConfig contains options for asynchronous counter
instruments that record float64 values.
Callbacks returns the configured callbacks.
Description returns the configured description.
Unit returns the configured unit.
Float64ObservableGaugeConfig : github.com/alexflint/go-arg.Described
func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig
Float64ObservableGaugeOption applies options to a
[Float64ObservableGaugeConfig]. See [Float64ObservableOption] and
[InstrumentOption] for other options that can be used as a
Float64ObservableGaugeOption.
Float64ObservableOption (interface)
InstrumentOption (interface)
func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig
func Meter.Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64ObservableGauge(string, ...Float64ObservableGaugeOption) (Float64ObservableGauge, error)
Float64ObservableOption applies options to float64 Observer instruments.
InstrumentOption (interface)
Float64ObservableOption : Float64ObservableCounterOption
Float64ObservableOption : Float64ObservableGaugeOption
Float64ObservableOption : Float64ObservableUpDownCounterOption
func WithFloat64Callback(callback Float64Callback) Float64ObservableOption
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.
go.opentelemetry.io/otel/metric/noop.Float64ObservableUpDownCounter
Float64ObservableUpDownCounter : Float64Observable
Float64ObservableUpDownCounter : Observable
Float64ObservableUpDownCounter : go.opentelemetry.io/otel/metric/embedded.Float64ObservableUpDownCounter
func Meter.Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64ObservableUpDownCounter(string, ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error)
Float64ObservableUpDownCounterConfig contains options for asynchronous
counter instruments that record float64 values.
Callbacks returns the configured callbacks.
Description returns the configured description.
Unit returns the configured unit.
Float64ObservableUpDownCounterConfig : github.com/alexflint/go-arg.Described
func NewFloat64ObservableUpDownCounterConfig(opts ...Float64ObservableUpDownCounterOption) Float64ObservableUpDownCounterConfig
Float64ObservableUpDownCounterOption applies options to a
[Float64ObservableUpDownCounterConfig]. See [Float64ObservableOption] and
[InstrumentOption] for other options that can be used as a
Float64ObservableUpDownCounterOption.
Float64ObservableOption (interface)
InstrumentOption (interface)
func NewFloat64ObservableUpDownCounterConfig(opts ...Float64ObservableUpDownCounterOption) Float64ObservableUpDownCounterConfig
func Meter.Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64ObservableUpDownCounter(string, ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error)
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.
Observe records the float64 value.
Use the WithAttributeSet (or, if performance is not a concern,
the WithAttributes) option to include measurement attributes.
go.opentelemetry.io/otel/metric/noop.Float64Observer
Float64Observer : go.opentelemetry.io/otel/metric/embedded.Float64Observer
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.
Add records a change to the counter.
Use the WithAttributeSet (or, if performance is not a concern,
the WithAttributes) option to include measurement attributes.
go.opentelemetry.io/otel/metric/noop.Float64UpDownCounter
Float64UpDownCounter : go.opentelemetry.io/otel/metric/embedded.Float64UpDownCounter
func Meter.Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64UpDownCounter(string, ...Float64UpDownCounterOption) (Float64UpDownCounter, error)
Float64UpDownCounterConfig contains options for synchronous counter
instruments that record float64 values.
Description returns the configured description.
Unit returns the configured unit.
Float64UpDownCounterConfig : github.com/alexflint/go-arg.Described
func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig
Float64UpDownCounterOption applies options to a
[Float64UpDownCounterConfig]. See [InstrumentOption] for other options that
can be used as a Float64UpDownCounterOption.
InstrumentOption (interface)
func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig
func Meter.Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Float64UpDownCounter(string, ...Float64UpDownCounterOption) (Float64UpDownCounter, error)
HistogramOption applies options to histogram instruments.
InstrumentOption (interface)
HistogramOption : Float64HistogramOption
HistogramOption : Int64HistogramOption
func WithExplicitBucketBoundaries(bounds ...float64) HistogramOption
InstrumentOption applies options to all instruments.
InstrumentOption : Float64CounterOption
InstrumentOption : Float64GaugeOption
InstrumentOption : Float64HistogramOption
InstrumentOption : Float64ObservableCounterOption
InstrumentOption : Float64ObservableGaugeOption
InstrumentOption : Float64ObservableOption
InstrumentOption : Float64ObservableUpDownCounterOption
InstrumentOption : Float64UpDownCounterOption
InstrumentOption : HistogramOption
InstrumentOption : Int64CounterOption
InstrumentOption : Int64GaugeOption
InstrumentOption : Int64HistogramOption
InstrumentOption : Int64ObservableCounterOption
InstrumentOption : Int64ObservableGaugeOption
InstrumentOption : Int64ObservableOption
InstrumentOption : Int64ObservableUpDownCounterOption
InstrumentOption : Int64UpDownCounterOption
func WithDescription(desc string) InstrumentOption
func WithUnit(u string) InstrumentOption
Int64Callback is a function registered with a Meter that makes observations
for an Int64Observable 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.
func Int64ObservableCounterConfig.Callbacks() []Int64Callback
func Int64ObservableGaugeConfig.Callbacks() []Int64Callback
func Int64ObservableUpDownCounterConfig.Callbacks() []Int64Callback
func WithInt64Callback(callback Int64Callback) Int64ObservableOption
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.
Add records a change to the counter.
Use the WithAttributeSet (or, if performance is not a concern,
the WithAttributes) option to include measurement attributes.
go.opentelemetry.io/otel/metric/noop.Int64Counter
Int64Counter : go.opentelemetry.io/otel/metric/embedded.Int64Counter
func Meter.Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64Counter(string, ...Int64CounterOption) (Int64Counter, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKExporterLogExported.Inst() Int64Counter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKExporterMetricDataPointExported.Inst() Int64Counter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKExporterSpanExported.Inst() Int64Counter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKLogCreated.Inst() Int64Counter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorLogProcessed.Inst() Int64Counter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorSpanProcessed.Inst() Int64Counter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKSpanStarted.Inst() Int64Counter
Int64CounterConfig contains options for synchronous counter instruments that
record int64 values.
Description returns the configured description.
Unit returns the configured unit.
Int64CounterConfig : github.com/alexflint/go-arg.Described
func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig
Int64CounterOption applies options to a [Int64CounterConfig]. See
[InstrumentOption] for other options that can be used as an
Int64CounterOption.
InstrumentOption (interface)
func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig
func Meter.Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64Counter(string, ...Int64CounterOption) (Int64Counter, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterLogExported(m Meter, opt ...Int64CounterOption) (otelconv.SDKExporterLogExported, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterMetricDataPointExported(m Meter, opt ...Int64CounterOption) (otelconv.SDKExporterMetricDataPointExported, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterSpanExported(m Meter, opt ...Int64CounterOption) (otelconv.SDKExporterSpanExported, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKLogCreated(m Meter, opt ...Int64CounterOption) (otelconv.SDKLogCreated, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKProcessorLogProcessed(m Meter, opt ...Int64CounterOption) (otelconv.SDKProcessorLogProcessed, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKProcessorSpanProcessed(m Meter, opt ...Int64CounterOption) (otelconv.SDKProcessorSpanProcessed, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKSpanStarted(m Meter, opt ...Int64CounterOption) (otelconv.SDKSpanStarted, error)
Int64Gauge is an instrument that records instantaneous 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.
Record records the instantaneous value.
Use the WithAttributeSet (or, if performance is not a concern,
the WithAttributes) option to include measurement attributes.
go.opentelemetry.io/otel/metric/noop.Int64Gauge
Int64Gauge : go.opentelemetry.io/otel/metric/embedded.Int64Gauge
func Meter.Int64Gauge(name string, options ...Int64GaugeOption) (Int64Gauge, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64Gauge(string, ...Int64GaugeOption) (Int64Gauge, error)
Int64GaugeConfig contains options for synchronous gauge instruments that
record int64 values.
Description returns the configured description.
Unit returns the configured unit.
Int64GaugeConfig : github.com/alexflint/go-arg.Described
func NewInt64GaugeConfig(opts ...Int64GaugeOption) Int64GaugeConfig
Int64GaugeOption applies options to a [Int64GaugeConfig]. See
[InstrumentOption] for other options that can be used as a
Int64GaugeOption.
InstrumentOption (interface)
func NewInt64GaugeConfig(opts ...Int64GaugeOption) Int64GaugeConfig
func Meter.Int64Gauge(name string, options ...Int64GaugeOption) (Int64Gauge, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64Gauge(string, ...Int64GaugeOption) (Int64Gauge, error)
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.
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.
go.opentelemetry.io/otel/metric/noop.Int64Histogram
Int64Histogram : go.opentelemetry.io/otel/metric/embedded.Int64Histogram
func Meter.Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64Histogram(string, ...Int64HistogramOption) (Int64Histogram, error)
Int64HistogramConfig contains options for synchronous histogram instruments
that record int64 values.
Description returns the configured description.
ExplicitBucketBoundaries returns the configured explicit bucket boundaries.
Unit returns the configured unit.
Int64HistogramConfig : github.com/alexflint/go-arg.Described
func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig
Int64HistogramOption applies options to a [Int64HistogramConfig]. See
[InstrumentOption] for other options that can be used as an
Int64HistogramOption.
HistogramOption (interface)
InstrumentOption (interface)
func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig
func Meter.Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64Histogram(string, ...Int64HistogramOption) (Int64Histogram, error)
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.
Int64ObservableCounter (interface)
Int64ObservableGauge (interface)
Int64ObservableUpDownCounter (interface)
go.opentelemetry.io/otel/metric/noop.Int64ObservableCounter
go.opentelemetry.io/otel/metric/noop.Int64ObservableGauge
go.opentelemetry.io/otel/metric/noop.Int64ObservableUpDownCounter
go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorLogQueueCapacity
go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorLogQueueSize
go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorSpanQueueCapacity
go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorSpanQueueSize
Int64Observable : Observable
func Observer.ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption)
func go.opentelemetry.io/otel/metric/noop.Observer.ObserveInt64(Int64Observable, int64, ...ObserveOption)
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.
go.opentelemetry.io/otel/metric/noop.Int64ObservableCounter
Int64ObservableCounter : Int64Observable
Int64ObservableCounter : Observable
Int64ObservableCounter : go.opentelemetry.io/otel/metric/embedded.Int64ObservableCounter
func Meter.Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64ObservableCounter(string, ...Int64ObservableCounterOption) (Int64ObservableCounter, error)
Int64ObservableCounterConfig contains options for asynchronous counter
instruments that record int64 values.
Callbacks returns the configured callbacks.
Description returns the configured description.
Unit returns the configured unit.
Int64ObservableCounterConfig : github.com/alexflint/go-arg.Described
func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig
Int64ObservableCounterOption applies options to a
[Int64ObservableCounterConfig]. See [Int64ObservableOption] and
[InstrumentOption] for other options that can be used as an
Int64ObservableCounterOption.
InstrumentOption (interface)
Int64ObservableOption (interface)
func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig
func Meter.Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64ObservableCounter(string, ...Int64ObservableCounterOption) (Int64ObservableCounter, error)
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.
go.opentelemetry.io/otel/metric/noop.Int64ObservableGauge
Int64ObservableGauge : Int64Observable
Int64ObservableGauge : Observable
Int64ObservableGauge : go.opentelemetry.io/otel/metric/embedded.Int64ObservableGauge
func Meter.Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64ObservableGauge(string, ...Int64ObservableGaugeOption) (Int64ObservableGauge, error)
Int64ObservableGaugeConfig contains options for asynchronous counter
instruments that record int64 values.
Callbacks returns the configured callbacks.
Description returns the configured description.
Unit returns the configured unit.
Int64ObservableGaugeConfig : github.com/alexflint/go-arg.Described
func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig
Int64ObservableGaugeOption applies options to a
[Int64ObservableGaugeConfig]. See [Int64ObservableOption] and
[InstrumentOption] for other options that can be used as an
Int64ObservableGaugeOption.
InstrumentOption (interface)
Int64ObservableOption (interface)
func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig
func Meter.Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64ObservableGauge(string, ...Int64ObservableGaugeOption) (Int64ObservableGauge, error)
Int64ObservableOption applies options to int64 Observer instruments.
InstrumentOption (interface)
Int64ObservableOption : Int64ObservableCounterOption
Int64ObservableOption : Int64ObservableGaugeOption
Int64ObservableOption : Int64ObservableUpDownCounterOption
func WithInt64Callback(callback Int64Callback) Int64ObservableOption
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.
go.opentelemetry.io/otel/metric/noop.Int64ObservableUpDownCounter
go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorLogQueueCapacity
go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorLogQueueSize
go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorSpanQueueCapacity
go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorSpanQueueSize
Int64ObservableUpDownCounter : Int64Observable
Int64ObservableUpDownCounter : Observable
Int64ObservableUpDownCounter : go.opentelemetry.io/otel/metric/embedded.Int64ObservableUpDownCounter
func Meter.Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64ObservableUpDownCounter(string, ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorLogQueueCapacity.Inst() Int64ObservableUpDownCounter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorLogQueueSize.Inst() Int64ObservableUpDownCounter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorSpanQueueCapacity.Inst() Int64ObservableUpDownCounter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorSpanQueueSize.Inst() Int64ObservableUpDownCounter
Int64ObservableUpDownCounterConfig contains options for asynchronous counter
instruments that record int64 values.
Callbacks returns the configured callbacks.
Description returns the configured description.
Unit returns the configured unit.
Int64ObservableUpDownCounterConfig : github.com/alexflint/go-arg.Described
func NewInt64ObservableUpDownCounterConfig(opts ...Int64ObservableUpDownCounterOption) Int64ObservableUpDownCounterConfig
Int64ObservableUpDownCounterOption applies options to a
[Int64ObservableUpDownCounterConfig]. See [Int64ObservableOption] and
[InstrumentOption] for other options that can be used as an
Int64ObservableUpDownCounterOption.
InstrumentOption (interface)
Int64ObservableOption (interface)
func NewInt64ObservableUpDownCounterConfig(opts ...Int64ObservableUpDownCounterOption) Int64ObservableUpDownCounterConfig
func Meter.Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64ObservableUpDownCounter(string, ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKProcessorLogQueueCapacity(m Meter, opt ...Int64ObservableUpDownCounterOption) (otelconv.SDKProcessorLogQueueCapacity, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKProcessorLogQueueSize(m Meter, opt ...Int64ObservableUpDownCounterOption) (otelconv.SDKProcessorLogQueueSize, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKProcessorSpanQueueCapacity(m Meter, opt ...Int64ObservableUpDownCounterOption) (otelconv.SDKProcessorSpanQueueCapacity, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKProcessorSpanQueueSize(m Meter, opt ...Int64ObservableUpDownCounterOption) (otelconv.SDKProcessorSpanQueueSize, error)
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.
Observe records the int64 value.
Use the WithAttributeSet (or, if performance is not a concern,
the WithAttributes) option to include measurement attributes.
go.opentelemetry.io/otel/metric/noop.Int64Observer
Int64Observer : go.opentelemetry.io/otel/metric/embedded.Int64Observer
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.
Add records a change to the counter.
Use the WithAttributeSet (or, if performance is not a concern,
the WithAttributes) option to include measurement attributes.
go.opentelemetry.io/otel/metric/noop.Int64UpDownCounter
Int64UpDownCounter : go.opentelemetry.io/otel/metric/embedded.Int64UpDownCounter
func Meter.Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64UpDownCounter(string, ...Int64UpDownCounterOption) (Int64UpDownCounter, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKExporterLogInflight.Inst() Int64UpDownCounter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKExporterMetricDataPointInflight.Inst() Int64UpDownCounter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKExporterSpanInflight.Inst() Int64UpDownCounter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKSpanLive.Inst() Int64UpDownCounter
Int64UpDownCounterConfig contains options for synchronous counter
instruments that record int64 values.
Description returns the configured description.
Unit returns the configured unit.
Int64UpDownCounterConfig : github.com/alexflint/go-arg.Described
func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig
Int64UpDownCounterOption applies options to a [Int64UpDownCounterConfig].
See [InstrumentOption] for other options that can be used as an
Int64UpDownCounterOption.
InstrumentOption (interface)
func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig
func Meter.Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error)
func go.opentelemetry.io/otel/metric/noop.Meter.Int64UpDownCounter(string, ...Int64UpDownCounterOption) (Int64UpDownCounter, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterLogInflight(m Meter, opt ...Int64UpDownCounterOption) (otelconv.SDKExporterLogInflight, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterMetricDataPointInflight(m Meter, opt ...Int64UpDownCounterOption) (otelconv.SDKExporterMetricDataPointInflight, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterSpanInflight(m Meter, opt ...Int64UpDownCounterOption) (otelconv.SDKExporterSpanInflight, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKSpanLive(m Meter, opt ...Int64UpDownCounterOption) (otelconv.SDKSpanLive, error)
MeasurementOption applies options to all instrument measurement.
MeasurementOption : AddOption
MeasurementOption : ObserveOption
MeasurementOption : RecordOption
func WithAttributes(attributes ...attribute.KeyValue) MeasurementOption
func WithAttributeSet(attributes attribute.Set) MeasurementOption
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.
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.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
Float64Gauge returns a new Float64Gauge instrument identified by name and
configured with options. The instrument is used to synchronously record
instantaneous float64 measurements during a computational operation.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
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.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
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.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
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.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
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.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
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.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
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.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
Int64Gauge returns a new Int64Gauge instrument identified by name and
configured with options. The instrument is used to synchronously record
instantaneous int64 measurements during a computational operation.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
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.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
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.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
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.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
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.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
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.
The name needs to conform to the OpenTelemetry instrument name syntax.
See the Instrument Name section of the package documentation for more
information.
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.
go.opentelemetry.io/otel/metric/noop.Meter
Meter : go.opentelemetry.io/otel/metric/embedded.Meter
func MeterProvider.Meter(name string, opts ...MeterOption) Meter
func go.opentelemetry.io/otel/metric/noop.MeterProvider.Meter(string, ...MeterOption) Meter
func go.opentelemetry.io/otel.Meter(name string, opts ...MeterOption) Meter
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterLogExported(m Meter, opt ...Int64CounterOption) (otelconv.SDKExporterLogExported, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterLogInflight(m Meter, opt ...Int64UpDownCounterOption) (otelconv.SDKExporterLogInflight, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterMetricDataPointExported(m Meter, opt ...Int64CounterOption) (otelconv.SDKExporterMetricDataPointExported, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterMetricDataPointInflight(m Meter, opt ...Int64UpDownCounterOption) (otelconv.SDKExporterMetricDataPointInflight, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterOperationDuration(m Meter, opt ...Float64HistogramOption) (otelconv.SDKExporterOperationDuration, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterSpanExported(m Meter, opt ...Int64CounterOption) (otelconv.SDKExporterSpanExported, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKExporterSpanInflight(m Meter, opt ...Int64UpDownCounterOption) (otelconv.SDKExporterSpanInflight, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKLogCreated(m Meter, opt ...Int64CounterOption) (otelconv.SDKLogCreated, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKMetricReaderCollectionDuration(m Meter, opt ...Float64HistogramOption) (otelconv.SDKMetricReaderCollectionDuration, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKProcessorLogProcessed(m Meter, opt ...Int64CounterOption) (otelconv.SDKProcessorLogProcessed, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKProcessorLogQueueCapacity(m Meter, opt ...Int64ObservableUpDownCounterOption) (otelconv.SDKProcessorLogQueueCapacity, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKProcessorLogQueueSize(m Meter, opt ...Int64ObservableUpDownCounterOption) (otelconv.SDKProcessorLogQueueSize, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKProcessorSpanProcessed(m Meter, opt ...Int64CounterOption) (otelconv.SDKProcessorSpanProcessed, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKProcessorSpanQueueCapacity(m Meter, opt ...Int64ObservableUpDownCounterOption) (otelconv.SDKProcessorSpanQueueCapacity, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKProcessorSpanQueueSize(m Meter, opt ...Int64ObservableUpDownCounterOption) (otelconv.SDKProcessorSpanQueueSize, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKSpanLive(m Meter, opt ...Int64UpDownCounterOption) (otelconv.SDKSpanLive, error)
func go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.NewSDKSpanStarted(m Meter, opt ...Int64CounterOption) (otelconv.SDKSpanStarted, error)
MeterConfig contains options for Meters.
InstrumentationAttributes returns the attributes associated with the library
providing instrumentation.
InstrumentationVersion returns the version of the library providing
instrumentation.
SchemaURL is the schema_url of the library providing instrumentation.
func NewMeterConfig(opts ...MeterOption) MeterConfig
MeterOption is an interface for applying Meter options.
func WithInstrumentationAttributes(attr ...attribute.KeyValue) MeterOption
func WithInstrumentationVersion(version string) MeterOption
func WithSchemaURL(schemaURL string) MeterOption
func NewMeterConfig(opts ...MeterOption) MeterConfig
func MeterProvider.Meter(name string, opts ...MeterOption) Meter
func go.opentelemetry.io/otel/metric/noop.MeterProvider.Meter(string, ...MeterOption) Meter
func go.opentelemetry.io/otel.Meter(name string, opts ...MeterOption) Meter
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.
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.
go.opentelemetry.io/otel/metric/noop.MeterProvider
MeterProvider : go.opentelemetry.io/otel/metric/embedded.MeterProvider
func go.opentelemetry.io/otel.GetMeterProvider() MeterProvider
func go.opentelemetry.io/otel/internal/global.MeterProvider() MeterProvider
func go.opentelemetry.io/otel.SetMeterProvider(mp MeterProvider)
func go.opentelemetry.io/otel/internal/global.SetMeterProvider(mp MeterProvider)
Observable is used as a grouping mechanism for all instruments that are
updated within a Callback.
Float64Observable (interface)
Float64ObservableCounter (interface)
Float64ObservableGauge (interface)
Float64ObservableUpDownCounter (interface)
Int64Observable (interface)
Int64ObservableCounter (interface)
Int64ObservableGauge (interface)
Int64ObservableUpDownCounter (interface)
go.opentelemetry.io/otel/metric/noop.Float64ObservableCounter
go.opentelemetry.io/otel/metric/noop.Float64ObservableGauge
go.opentelemetry.io/otel/metric/noop.Float64ObservableUpDownCounter
go.opentelemetry.io/otel/metric/noop.Int64ObservableCounter
go.opentelemetry.io/otel/metric/noop.Int64ObservableGauge
go.opentelemetry.io/otel/metric/noop.Int64ObservableUpDownCounter
go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorLogQueueCapacity
go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorLogQueueSize
go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorSpanQueueCapacity
go.opentelemetry.io/otel/semconv/v1.37.0/otelconv.SDKProcessorSpanQueueSize
func Meter.RegisterCallback(f Callback, instruments ...Observable) (Registration, error)
func go.opentelemetry.io/otel/metric/noop.Meter.RegisterCallback(Callback, ...Observable) (Registration, error)
ObserveConfig contains options for an observed measurement.
Attributes returns the configured attribute set.
func NewObserveConfig(opts []ObserveOption) ObserveConfig
ObserveOption applies options to an addition measurement. See
[MeasurementOption] for other options that can be used as a ObserveOption.
MeasurementOption (interface)
func NewObserveConfig(opts []ObserveOption) ObserveConfig
func Float64Observer.Observe(value float64, options ...ObserveOption)
func Int64Observer.Observe(value int64, options ...ObserveOption)
func Observer.ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption)
func Observer.ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption)
func go.opentelemetry.io/otel/metric/noop.Float64Observer.Observe(float64, ...ObserveOption)
func go.opentelemetry.io/otel/metric/noop.Int64Observer.Observe(int64, ...ObserveOption)
func go.opentelemetry.io/otel/metric/noop.Observer.ObserveFloat64(Float64Observable, float64, ...ObserveOption)
func go.opentelemetry.io/otel/metric/noop.Observer.ObserveInt64(Int64Observable, int64, ...ObserveOption)
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.
ObserveFloat64 records the float64 value for obsrv.
ObserveInt64 records the int64 value for obsrv.
go.opentelemetry.io/otel/metric/noop.Observer
Observer : go.opentelemetry.io/otel/metric/embedded.Observer
RecordConfig contains options for a recorded measurement.
Attributes returns the configured attribute set.
func NewRecordConfig(opts []RecordOption) RecordConfig
RecordOption applies options to an addition measurement. See
[MeasurementOption] for other options that can be used as a RecordOption.
MeasurementOption (interface)
func NewRecordConfig(opts []RecordOption) RecordConfig
func Float64Gauge.Record(ctx context.Context, value float64, options ...RecordOption)
func Float64Histogram.Record(ctx context.Context, incr float64, options ...RecordOption)
func Int64Gauge.Record(ctx context.Context, value int64, options ...RecordOption)
func Int64Histogram.Record(ctx context.Context, incr int64, options ...RecordOption)
func go.opentelemetry.io/otel/metric/noop.Float64Gauge.Record(context.Context, float64, ...RecordOption)
func go.opentelemetry.io/otel/metric/noop.Float64Histogram.Record(context.Context, float64, ...RecordOption)
func go.opentelemetry.io/otel/metric/noop.Int64Gauge.Record(context.Context, int64, ...RecordOption)
func go.opentelemetry.io/otel/metric/noop.Int64Histogram.Record(context.Context, int64, ...RecordOption)
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.
Unregister removes the callback registration from a Meter.
This method needs to be idempotent and concurrent safe.
go.opentelemetry.io/otel/metric/noop.Registration
Registration : go.opentelemetry.io/otel/metric/embedded.Registration
func Meter.RegisterCallback(f Callback, instruments ...Observable) (Registration, error)
func go.opentelemetry.io/otel/metric/noop.Meter.RegisterCallback(Callback, ...Observable) (Registration, error)
Package-Level Functions (total 28)
NewAddConfig returns a new [AddConfig] with all opts applied.
NewFloat64CounterConfig returns a new [Float64CounterConfig] with all opts
applied.
NewFloat64GaugeConfig returns a new [Float64GaugeConfig] with all opts
applied.
NewFloat64HistogramConfig returns a new [Float64HistogramConfig] with all
opts applied.
NewFloat64ObservableCounterConfig returns a new
[Float64ObservableCounterConfig] with all opts applied.
NewFloat64ObservableGaugeConfig returns a new [Float64ObservableGaugeConfig]
with all opts applied.
NewFloat64ObservableUpDownCounterConfig returns a new
[Float64ObservableUpDownCounterConfig] with all opts applied.
NewFloat64UpDownCounterConfig returns a new [Float64UpDownCounterConfig]
with all opts applied.
NewInt64CounterConfig returns a new [Int64CounterConfig] with all opts
applied.
NewInt64GaugeConfig returns a new [Int64GaugeConfig] with all opts
applied.
NewInt64HistogramConfig returns a new [Int64HistogramConfig] with all opts
applied.
NewInt64ObservableCounterConfig returns a new [Int64ObservableCounterConfig]
with all opts applied.
NewInt64ObservableGaugeConfig returns a new [Int64ObservableGaugeConfig]
with all opts applied.
NewInt64ObservableUpDownCounterConfig returns a new
[Int64ObservableUpDownCounterConfig] with all opts applied.
NewInt64UpDownCounterConfig returns a new [Int64UpDownCounterConfig] with
all opts applied.
NewMeterConfig creates a new MeterConfig and applies
all the given options.
NewObserveConfig returns a new [ObserveConfig] with all opts applied.
NewRecordConfig returns a new [RecordConfig] with all opts applied.
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)
WithAttributeSet(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.
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.
WithDescription sets the instrument description.
WithExplicitBucketBoundaries sets the instrument explicit bucket boundaries.
This option is considered "advisory", and may be ignored by API implementations.
WithFloat64Callback adds callback to be called for an instrument.
WithInstrumentationAttributes sets the instrumentation attributes.
The passed attributes will be de-duplicated.
WithInstrumentationVersion sets the instrumentation version.
WithInt64Callback adds callback to be called for an instrument.
WithSchemaURL sets the schema URL.
WithUnit sets the instrument unit.
The unit u should be defined using the appropriate [UCUM](https://ucum.org) case-sensitive code.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |