Documentation
¶
Index ¶
- Variables
- func Fail(ctx context.Context, err error, opts ...trace.EventOption) error
- func Failf(ctx context.Context, format string, args ...any) error
- func Float64Counter(ctx context.Context, name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error)
- func Float64Gauge(ctx context.Context, name string, options ...metric.Float64GaugeOption) (metric.Float64Gauge, error)
- func Float64Histogram(ctx context.Context, name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error)
- func Float64ObservableCounter(ctx context.Context, name string, ...) (metric.Float64ObservableCounter, error)
- func Float64ObservableGauge(ctx context.Context, name string, ...) (metric.Float64ObservableGauge, error)
- func Float64ObservableUpDownCounter(ctx context.Context, name string, ...) (metric.Float64ObservableUpDownCounter, error)
- func Float64UpDownCounter(ctx context.Context, name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error)
- func Int64Counter(ctx context.Context, name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error)
- func Int64Gauge(ctx context.Context, name string, options ...metric.Int64GaugeOption) (metric.Int64Gauge, error)
- func Int64Histogram(ctx context.Context, name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error)
- func Int64ObservableCounter(ctx context.Context, name string, ...) (metric.Int64ObservableCounter, error)
- func Int64ObservableGauge(ctx context.Context, name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error)
- func Int64ObservableUpDownCounter(ctx context.Context, name string, ...) (metric.Int64ObservableUpDownCounter, error)
- func Int64UpDownCounter(ctx context.Context, name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error)
- func Nest(ctx context.Context, name string, nestedFn func(ctx context.Context), ...)
- func Nested(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func RecordError(ctx context.Context, err error, opts ...trace.EventOption)
- func RegisterCallback(ctx context.Context, f metric.Callback, instruments ...metric.Observable) (metric.Registration, error)
- func WithInstrumentationAttributeSet(attrs attribute.Set) otelRecorderOptionAttrs
- func WithInstrumentationAttributes(attrs ...attribute.KeyValue) otelRecorderOptionAttrs
- func WithInstrumentationSchemaURL(schemaURL string) otelRecorderOptionSchemaURL
- func WithInstrumentationVersion(version string) otelRecorderOptionInstrumentationVersion
- type OTelRecorder
Constants ¶
This section is empty.
Variables ¶
var ErrNoRecorderInContext = fmt.Errorf("no recorder found in context")
Functions ¶
func Failf ¶
Failf wraps around Fail, formatting the error message according to a format specifier and arguments.
func Float64Counter ¶
func Float64Counter( ctx context.Context, name string, options ...metric.Float64CounterOption, ) (metric.Float64Counter, 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.
The name needs to conform to the OpenTelemetry instrument name syntax. See the Instrument Name section of the package documentation for more information.
func Float64Gauge ¶
func Float64Gauge( ctx context.Context, name string, options ...metric.Float64GaugeOption, ) (metric.Float64Gauge, error)
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.
Implementations of this method need to be safe for a user to call concurrently.
func Float64Histogram ¶
func Float64Histogram( ctx context.Context, name string, options ...metric.Float64HistogramOption, ) (metric.Float64Histogram, 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.
The name needs to conform to the OpenTelemetry instrument name syntax. See the Instrument Name section of the package documentation for more information.
Implementations of this method need to be safe for a user to call concurrently.
func Float64ObservableCounter ¶
func Float64ObservableCounter( ctx context.Context, name string, options ...metric.Float64ObservableCounterOption, ) (metric.Float64ObservableCounter, 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.
The name needs to conform to the OpenTelemetry instrument name syntax. See the Instrument Name section of the package documentation for more information.
Implementations of this method need to be safe for a user to call concurrently.
func Float64ObservableGauge ¶
func Float64ObservableGauge( ctx context.Context, name string, options ...metric.Float64ObservableGaugeOption, ) (metric.Float64ObservableGauge, 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.
The name needs to conform to the OpenTelemetry instrument name syntax. See the Instrument Name section of the package documentation for more information.
Implementations of this method need to be safe for a user to call concurrently.
func Float64ObservableUpDownCounter ¶
func Float64ObservableUpDownCounter( ctx context.Context, name string, options ...metric.Float64ObservableUpDownCounterOption, ) (metric.Float64ObservableUpDownCounter, 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.
The name needs to conform to the OpenTelemetry instrument name syntax. See the Instrument Name section of the package documentation for more information.
Implementations of this method need to be safe for a user to call concurrently.
func Float64UpDownCounter ¶
func Float64UpDownCounter( ctx context.Context, name string, options ...metric.Float64UpDownCounterOption, ) (metric.Float64UpDownCounter, 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.
The name needs to conform to the OpenTelemetry instrument name syntax. See the Instrument Name section of the package documentation for more information.
Implementations of this method need to be safe for a user to call concurrently.
func Int64Counter ¶
func Int64Counter( ctx context.Context, name string, options ...metric.Int64CounterOption, ) (metric.Int64Counter, error)
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.
Implementations of this method need to be safe for a user to call concurrently.
func Int64Gauge ¶
func Int64Gauge( ctx context.Context, name string, options ...metric.Int64GaugeOption, ) (metric.Int64Gauge, error)
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.
Implementations of this method need to be safe for a user to call concurrently.
func Int64Histogram ¶
func Int64Histogram( ctx context.Context, name string, options ...metric.Int64HistogramOption, ) (metric.Int64Histogram, 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.
The name needs to conform to the OpenTelemetry instrument name syntax. See the Instrument Name section of the package documentation for more information.
Implementations of this method need to be safe for a user to call concurrently.
func Int64ObservableCounter ¶
func Int64ObservableCounter( ctx context.Context, name string, options ...metric.Int64ObservableCounterOption, ) (metric.Int64ObservableCounter, 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.
The name needs to conform to the OpenTelemetry instrument name syntax. See the Instrument Name section of the package documentation for more information.
Implementations of this method need to be safe for a user to call concurrently.
func Int64ObservableGauge ¶
func Int64ObservableGauge( ctx context.Context, name string, options ...metric.Int64ObservableGaugeOption, ) (metric.Int64ObservableGauge, 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.
The name needs to conform to the OpenTelemetry instrument name syntax. See the Instrument Name section of the package documentation for more information.
Implementations of this method need to be safe for a user to call concurrently.
func Int64ObservableUpDownCounter ¶
func Int64ObservableUpDownCounter( ctx context.Context, name string, options ...metric.Int64ObservableUpDownCounterOption, ) (metric.Int64ObservableUpDownCounter, 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.
The name needs to conform to the OpenTelemetry instrument name syntax. See the Instrument Name section of the package documentation for more information.
Implementations of this method need to be safe for a user to call concurrently.
func Int64UpDownCounter ¶
func Int64UpDownCounter( ctx context.Context, name string, options ...metric.Int64UpDownCounterOption, ) (metric.Int64UpDownCounter, 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.
The name needs to conform to the OpenTelemetry instrument name syntax. See the Instrument Name section of the package documentation for more information.
Implementations of this method need to be safe for a user to call concurrently.
func Nest ¶
func Nest(ctx context.Context, name string, nestedFn func(ctx context.Context), opts ...trace.SpanStartOption)
Nest wraps around Nested, calling the provided nestedFn with the context containing the newly-created span. It automatically ends the span after nestedFn returns.
func Nested ¶
func Nested(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
Nested creates a span and a context.Context containing the newly-created span.
If the context.Context provided in `ctx` contains a Span then the newly-created Span will be a child of that span, otherwise it will be a root span. This behavior can be overridden by providing `WithNewRoot()` as a SpanOption, causing the newly-created Span to be a root span even if `ctx` contains a Span.
When creating a Span it is recommended to provide all known span attributes using the `WithAttributes()` SpanOption as samplers will only have access to the attributes provided when a Span is created.
Any Span that is created MUST also be ended. This is the responsibility of the user. Implementations of this API may leak memory or other resources if Spans are not ended.
func RecordError ¶
func RecordError(ctx context.Context, err error, opts ...trace.EventOption)
RecordError will record err as an exception span event for this span. If the Status of the Span should be set to Error, Fail or Failf should be used instead. If this span is not being recorded or err is nil then this method does nothing.
func RegisterCallback ¶
func RegisterCallback( ctx context.Context, f metric.Callback, instruments ...metric.Observable, ) (metric.Registration, 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.
Implementations of this method need to be safe for a user to call concurrently.
The function f needs to be concurrent safe.
func WithInstrumentationSchemaURL ¶
func WithInstrumentationSchemaURL(schemaURL string) otelRecorderOptionSchemaURL
func WithInstrumentationVersion ¶
func WithInstrumentationVersion(version string) otelRecorderOptionInstrumentationVersion
Types ¶
type OTelRecorder ¶
type OTelRecorder struct {
// contains filtered or unexported fields
}
func NewOTelRecorder ¶
func RecorderFromContext ¶
func RecorderFromContext(ctx context.Context) (OTelRecorder, bool)
func (OTelRecorder) WrapContext ¶ added in v0.4.0
func (r OTelRecorder) WrapContext(ctx context.Context) context.Context
WrapContext Registers an OTelRecorder in the context, which can be retrieved using RecorderFromContext. This is necessary to allow other functions in this package to operate.