package sdk
import "go.opentelemetry.io/auto/sdk"
Package sdk provides an auto-instrumentable OpenTelemetry SDK.
An go.opentelemetry.io/auto.Instrumentation can be configured to target the process running this SDK. In that case, all telemetry the SDK produces will be processed and handled by that go.opentelemetry.io/auto.Instrumentation.
By default, if there is no go.opentelemetry.io/auto.Instrumentation set to auto-instrument the SDK, the SDK will not generate any telemetry.
Index ¶
Examples ¶
Functions ¶
func GetTracerProvider ¶
func GetTracerProvider() trace.TracerProvider
GetTracerProvider returns an auto-instrumentable trace.TracerProvider.
If an go.opentelemetry.io/auto.Instrumentation is configured to instrument
the process using the returned TracerProvider, all of the telemetry it
produces will be processed and handled by that Instrumentation. By default,
if no Instrumentation instruments the TracerProvider it will not generate
any trace telemetry.
Code:
Example¶
{
// Get a Tracer from an auto-instrumented TracerProvider so all spans
// created will be passed to the auto-instrumentation telemetry pipeline.
tracer := GetTracerProvider().Tracer("my.pkg/name")
// The tracer is used normally to create spans to encapsulate work.
_, span := tracer.Start(context.Background(), "do.work")
defer span.End()
// Do work ...
}
Source Files ¶
doc.go trace.go
Directories ¶
Path | Synopsis |
---|---|
telemetry | Package telemetry provides a lightweight representations of OpenTelemetry telemetry that is compatible with the OTLP JSON protobuf encoding. |
- Version
- v0.1.0-alpha
- Published
- Oct 23, 2024
- Platform
- windows/amd64
- Imports
- 12 packages
- Last checked
- now –
Tools for package owners.