cloudotel

package
v0.73.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package cloudotel provides primitives for OpenTelemetry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrorLogger

func NewErrorLogger(logger *zap.Logger, level zapcore.Level, message string) otel.ErrorHandler

NewErrorLogger returns a new otel.ErrorHandler that logs errors using the provided logger, level and message.

func NewResource

func NewResource(ctx context.Context) (*resource.Resource, error)

NewResource creates and detects attributes for a new OpenTelemetry resource.

func RegisterErrorHandler added in v0.37.0

func RegisterErrorHandler(ctx context.Context)

RegisterErrorHandler registers a global OpenTelemetry error handler.

func StartMetricExporter added in v0.37.0

func StartMetricExporter(
	ctx context.Context,
	exporterConfig MetricExporterConfig,
	resource *resource.Resource,
) (func(context.Context) error, error)

StartMetricExporter starts the OpenTelemetry Cloud Monitoring exporter.

func StartTraceExporter added in v0.37.0

func StartTraceExporter(
	ctx context.Context,
	exporterConfig TraceExporterConfig,
	resource *resource.Resource,
) (func(context.Context) error, error)

StartTraceExporter starts the OpenTelemetry Cloud Trace exporter.

Types

type MetricExporterConfig added in v0.37.0

type MetricExporterConfig struct {
	Enabled                bool          `onGCE:"false"`
	Interval               time.Duration `default:"60s"`
	RuntimeInstrumentation bool          `onGCE:"true"`
	HostInstrumentation    bool          `onGCE:"true"`
	OpenCensusProducer     bool          `default:"false"`
}

MetricExporterConfig configures the metrics exporter.

type TraceExporterConfig added in v0.37.0

type TraceExporterConfig struct {
	Enabled           bool          `onGCE:"true"`
	Timeout           time.Duration `default:"10s"`
	SampleProbability float64       `default:"0.01"`
}

TraceExporterConfig configures the trace exporter.

Jump to

Keyboard shortcuts

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