telemetry

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMetricsConfig = MetricsConfig{
	Global: true,
}
View Source
var DefaultTraceConfig = TraceConfig{
	ExporterBatchTimeout: 1 * time.Second,
	GRPC: TraceGRPCConfig{
		Enabled:        false,
		AllowInsecure:  allowInsecureTraceExporters,
		UseCompression: useCompressionForTraceExporters,
	},
	HTTP: TraceHTTPConfig{
		Enabled:        false,
		AllowInsecure:  allowInsecureTraceExporters,
		UseCompression: useCompressionForTraceExporters,
	},
}

Functions

func CreateMetricSink

func CreateMetricSink(registerer prometheus.Registerer, cfg MetricsConfig) (*mp.PrometheusSink, error)

func CreateMetrics

func CreateMetrics(sink *mp.PrometheusSink, global bool) (*metrics.Metrics, error)

func CreatePropagator

func CreatePropagator() propagation.TextMapPropagator

func CreateResource

func CreateResource(ctx context.Context, id string, role blockless.NodeRole) (*resource.Resource, error)

func CreateTracerProvider

func CreateTracerProvider(resource *resource.Resource, batchTimeout time.Duration, exporters ...trace.SpanExporter) *trace.TracerProvider

Create a new tracer provider. NOTE: batchTimeout should not be set to zero for production use.

func GetMetricsHTTPHandler

func GetMetricsHTTPHandler() http.Handler

GetMetricsHTTPHandler returns an HTTP handler for the default prometheus registerer and gatherer.

func InitializeMetrics

func InitializeMetrics(opts ...MetricsOption) (*metrics.Metrics, error)

func NewGRPCExporter

func NewGRPCExporter(ctx context.Context, cfg TraceGRPCConfig) (*otlptrace.Exporter, error)

func NewHTTPExporter

func NewHTTPExporter(ctx context.Context, cfg TraceHTTPConfig) (*otlptrace.Exporter, error)

func NewInMemExporter

func NewInMemExporter() *tracetest.InMemoryExporter

Types

type MetricsConfig

type MetricsConfig struct {
	Global    bool
	Counters  []prometheus.CounterDefinition
	Summaries []prometheus.SummaryDefinition
	Gauges    []prometheus.GaugeDefinition
}

type MetricsOption

type MetricsOption func(*MetricsConfig)

func WithCounters

func WithCounters(counters []prometheus.CounterDefinition) MetricsOption

func WithGauges

func WithGauges(gauges []prometheus.GaugeDefinition) MetricsOption

func WithSummaries

func WithSummaries(summaries []prometheus.SummaryDefinition) MetricsOption

type ShutdownFunc

type ShutdownFunc func(context.Context) error

func InitializeTracing

func InitializeTracing(ctx context.Context, log zerolog.Logger, opts ...TraceOption) (ShutdownFunc, error)

type TraceConfig

type TraceConfig struct {
	// Node ID, registered as service instance ID attribute.
	ID string
	// Node role, registered as service role attribute.
	Role blockless.NodeRole
	// Maximum time after which exporters will send batched span.
	ExporterBatchTimeout time.Duration
	// Configuration for GRPC trace exporter.
	GRPC TraceGRPCConfig
	// Configuration for HTTP trace exporter.
	HTTP TraceHTTPConfig
	// Configuration for the InMem trace exporter (used for testing mainly).
	InMem TraceInMemConfig
}

TODO: Update trace exporters configs GRPC, HTTP: - TLS credentials - disable insecure when mature

type TraceGRPCConfig

type TraceGRPCConfig struct {
	Enabled        bool
	Endpoint       string
	AllowInsecure  bool
	UseCompression bool
}

type TraceHTTPConfig

type TraceHTTPConfig struct {
	Enabled        bool
	Endpoint       string
	AllowInsecure  bool
	UseCompression bool
}

type TraceInMemConfig

type TraceInMemConfig struct {
	Enabled bool
}

type TraceOption

type TraceOption func(*TraceConfig)

func WithBatchTraceTimeout

func WithBatchTraceTimeout(t time.Duration) TraceOption

func WithGRPCTracing

func WithGRPCTracing(endpoint string) TraceOption

func WithHTTPTracing

func WithHTTPTracing(endpoint string) TraceOption

func WithID

func WithID(id string) TraceOption

func WithNodeRole

func WithNodeRole(r blockless.NodeRole) TraceOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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