otel

package
v0.1.156 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package otel provides an OpenTelemetry backend for wool.

Import this package to enable OTEL tracing in wool:

import _ "github.com/codefly-dev/core/wool/otel"

Or call Enable() explicitly for configuration:

otel.Enable(otel.WithEndpoint("localhost:4317"), otel.WithServiceName("my-svc"))

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRPCDialOptions

func GRPCDialOptions() []grpc.DialOption

GRPCDialOptions returns gRPC dial options that enable automatic OTEL tracing for all outgoing RPCs.

func GRPCServerOptions

func GRPCServerOptions() []grpc.ServerOption

GRPCServerOptions returns gRPC server options that enable automatic OTEL tracing for all incoming RPCs.

Types

type Option

type Option func(*config)

Option configures the OTEL provider.

func WithEndpoint

func WithEndpoint(endpoint string) Option

WithEndpoint sets the OTLP collector endpoint (e.g. "localhost:4317").

func WithInsecure

func WithInsecure() Option

WithInsecure disables TLS for the OTLP connection.

func WithServiceName

func WithServiceName(name string) Option

WithServiceName sets the service name for traces.

func WithStdout

func WithStdout() Option

WithStdout uses a stdout exporter instead of OTLP (useful for development).

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements wool.TelemetryProvider backed by OpenTelemetry.

func Enable

func Enable(opts ...Option) (*Provider, error)

Enable creates an OTEL TelemetryProvider and registers it with wool. If no options are provided, it reads from standard OTEL environment variables (OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME).

func (*Provider) NewTracer

func (p *Provider) NewTracer(name string) wool.Tracer

NewTracer creates a new OTEL-backed Tracer.

func (*Provider) Shutdown

func (p *Provider) Shutdown(ctx context.Context) error

Shutdown flushes and shuts down the OTEL provider.

Jump to

Keyboard shortcuts

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