mopentelemetry

package
v1.27.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithTracer

func ContextWithTracer(ctx context.Context, tracer trace.Tracer) context.Context

ContextWithTracer returns a context within a trace.Tracer in "tracer" value.

func HandleSpanError

func HandleSpanError(span *trace.Span, message string, err error)

func NewTracerFromContext

func NewTracerFromContext(ctx context.Context) trace.Tracer

NewTracerFromContext returns a new tracer from the context.

func SetSpanAttributesFromStruct

func SetSpanAttributesFromStruct(span *trace.Span, key string, valueStruct any) error

SetSpanAttributesFromStruct converts a struct to a JSON string and sets it as an attribute on the span.

Types

type Telemetry

type Telemetry struct {
	LibraryName               string
	ServiceName               string
	ServiceVersion            string
	DeploymentEnv             string
	CollectorExporterEndpoint string
	TracerProvider            *sdktrace.TracerProvider
	MetricProvider            *sdkmetric.MeterProvider
	Logger                    mlog.Logger
	// contains filtered or unexported fields
}

func (*Telemetry) InitializeTelemetry

func (tl *Telemetry) InitializeTelemetry() *Telemetry

InitializeTelemetry initializes the telemetry providers and sets them globally.

func (*Telemetry) NewLoggerExporter

func (tl *Telemetry) NewLoggerExporter(ctx context.Context) (*otlploggrpc.Exporter, error)

NewLoggerExporter creates a new logger exporter that writes to stdout.

func (*Telemetry) NewLoggerProvider

func (tl *Telemetry) NewLoggerProvider(rsc *sdkresource.Resource, exp *otlploggrpc.Exporter) *sdklog.LoggerProvider

NewLoggerProvider creates a new logger provider with stdout exporter and default resource.

func (*Telemetry) NewResource

func (tl *Telemetry) NewResource() (*sdkresource.Resource, error)

NewResource creates a new resource with default attributes.

func (*Telemetry) ShutdownTelemetry

func (tl *Telemetry) ShutdownTelemetry()

Jump to

Keyboard shortcuts

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