Documentation ¶
Overview ¶
Package otel provides OpenTelemetry instrumentation utilities for Go applications and libraries.
OpenTelemetry is an Observability framework and toolkit designed to create and manage telemetry data such as traces, metrics, and logs. Crucially, OpenTelemetry is vendor and tool-agnostic, meaning that it can be used with a broad variety of Observability backends, including open source tools like Jaeger and Prometheus, as well as commercial offerings.
For an application or component to emit useful telemetry data it needs to be “instrumented”. In order to instrument your code in a way that is idiomatic for OpenTelemetry you need to follow some conventions.
- OpenTelemetry is split into two parts: an API to instrument code with, and SDKs that implement the API.
- If you’re instrumenting an app, you need to use the OpenTelemetry SDK for your language. You’ll then use the SDK to initialize OpenTelemetry and the API to instrument your code. This will emit telemetry from your app, and any library you installed that also comes with instrumentation.
- If you’re instrumenting a library, only install the OpenTelemetry API package for your language. Your library will not emit telemetry on its own. It will only emit telemetry when it is part of an app that uses the OpenTelemetry SDK.
Index ¶
- type Attributes
- func (attrs Attributes) Context() context.Context
- func (attrs Attributes) Expand() []attribute.KeyValue
- func (attrs Attributes) Get(key string) interface{}
- func (attrs Attributes) Join(list ...Attributes)
- func (attrs Attributes) Load(list []attribute.KeyValue)
- func (attrs Attributes) Set(key string, value interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
type Attributes map[string]interface{}
Attributes provide an easy-to-use mechanism to handle span and message metadata.
func (Attributes) Context ¶
func (attrs Attributes) Context() context.Context
Context returns a context instance with the attributes properly set as baggage (or correlation) values.
func (Attributes) Expand ¶
func (attrs Attributes) Expand() []attribute.KeyValue
Expand allows converting from attributes to a key/value list.
func (Attributes) Get ¶
func (attrs Attributes) Get(key string) interface{}
Get a previously set attribute value or nil.
func (Attributes) Join ¶
func (attrs Attributes) Join(list ...Attributes)
Join will add any number of attribute sets into current instance.
func (Attributes) Load ¶
func (attrs Attributes) Load(list []attribute.KeyValue)
Load from key/value list to an attributes instance.
func (Attributes) Set ¶
func (attrs Attributes) Set(key string, value interface{})
Set a specific attribute, overrides any previously set value.
Directories ¶
Path | Synopsis |
---|---|
Package api provides the utilities necessary to instrument an application or library.
|
Package api provides the utilities necessary to instrument an application or library. |
Package gorm provides an OpenTelemetry instrumentation for the GORM library.
|
Package gorm provides an OpenTelemetry instrumentation for the GORM library. |
Package otelgrpc provide instrumentation primitives for gRPC clients and servers.
|
Package otelgrpc provide instrumentation primitives for gRPC clients and servers. |
Package otelhttp provide utilities to instrument HTTP clients and servers based on Go's net/http package.
|
Package otelhttp provide utilities to instrument HTTP clients and servers based on Go's net/http package. |
Package mongodb provides OTEL instrumentation for the MongoDB Go Driver.
|
Package mongodb provides OTEL instrumentation for the MongoDB Go Driver. |
Package prometheus provides utilities to collect and consume metrics (instrumentation data).
|
Package prometheus provides utilities to collect and consume metrics (instrumentation data). |
Package sdk provides the utilities necessary to setup a monitoring implementation at runtime.
|
Package sdk provides the utilities necessary to setup a monitoring implementation at runtime. |
Package sentry provides an OpenTelemetry exporter for Sentry.
|
Package sentry provides an OpenTelemetry exporter for Sentry. |
Package temporal provides OTEL instrumentation for Temporal workflows.
|
Package temporal provides OTEL instrumentation for Temporal workflows. |