sdk – go.opentelemetry.io/auto/sdk Index | Examples | Files | Directories

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 TracerProvider

func TracerProvider() trace.TracerProvider

TracerProvider 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.

Example

Code:

{
	// Get a Tracer from an auto-instrumented TracerProvider so all spans
	// created will be passed to the auto-instrumentation telemetry pipeline.
	tracer := TracerProvider().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 limit.go span.go tracer.go tracer_provider.go

Directories

PathSynopsis
internal
Version
v1.1.0 (latest)
Published
Dec 5, 2024
Platform
darwin/amd64
Imports
19 packages
Last checked
now

Tools for package owners.