otlp

package
v0.0.53 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 22 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package otlp provides OpenTelemetry Protocol (OTLP) provider implementations

Package otlp provides OpenTelemetry Protocol (OTLP) provider implementations

Index

Constants

View Source
const (
	// ProtocolHTTPProtobuf selects the OTLP/HTTP transport with protobuf payloads.
	// This is the default when Protocol is left unset.
	ProtocolHTTPProtobuf = "http/protobuf"
	// ProtocolGRPC selects the OTLP/gRPC transport.
	ProtocolGRPC = "grpc"
)

Protocol values accepted by Config.Protocol. An empty/unset Protocol is equivalent to ProtocolHTTPProtobuf.

Variables

This section is empty.

Functions

func NewLoggerProviderWithShutdown added in v0.0.42

func NewLoggerProviderWithShutdown(
	ctx context.Context,
	config Config,
	res *resource.Resource,
) (log.LoggerProvider, func(context.Context) error, error)

NewLoggerProviderWithShutdown creates an OTLP logger provider with a shutdown function. When no endpoint is configured, it returns a no-op provider with a nil shutdown function.

The Logs API/SDK used here (go.opentelemetry.io/otel/log, go.opentelemetry.io/otel/sdk/log, and the otlploghttp exporter) implements the OpenTelemetry specification's Logs API, which is marked Stable (https://opentelemetry.io/docs/specs/otel/logs/api/). Their Go module version (v0.21.0 as of writing) hasn't crossed 1.0 yet, but that mirrors the Prometheus metrics exporter this package already depends on (go.opentelemetry.io/otel/exporters/prometheus, also 0.x): pre-1.0 module versioning here tracks release cadence, not spec/API stability.

func NewMetricReader

func NewMetricReader(ctx context.Context, config Config) (sdkmetric.Reader, error)

NewMetricReader creates an OTLP metric reader for use in a unified meter provider

func NewTracerProviderWithShutdown

func NewTracerProviderWithShutdown(
	ctx context.Context,
	config Config,
	res *resource.Resource,
	extraProcessors ...sdktrace.SpanProcessor,
) (trace.TracerProvider, func(context.Context) error, error)

NewTracerProviderWithShutdown creates an OTLP tracer provider with a shutdown function. Additional span processors (e.g. a Sentry bridge) can be registered via extraProcessors. When endpoint is empty but extra processors are provided, a real SDK provider is created without an OTLP exporter so the processors still receive spans.

Types

type Config

type Config struct {
	Endpoint     string
	Headers      map[string]string
	Insecure     bool
	SamplingRate float64
	CACertPath   string
	// Protocol selects the OTLP transport: ProtocolGRPC ("grpc") or
	// ProtocolHTTPProtobuf ("http/protobuf"). An empty value means
	// ProtocolHTTPProtobuf, preserving this package's original HTTP-only
	// behavior for callers that don't set it.
	Protocol string
}

Config holds OTLP-specific configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL