telemetry

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package telemetry provides server's telemetry powered by Open Telemetry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ITelemetry

type ITelemetry interface {
	// GetGlobalTracer returns the global tracer.
	GetGlobalTracer() trace.Tracer

	// GetTracer retrieves a tracer. If the retrieved tracer doesn't exist, the
	// global tracer is returned.
	GetTracer(name string) trace.Tracer

	// NewTracer creates a tracer from the current provider.
	NewTracer(name string) trace.Tracer
}

ITelemetry defines what a Telemetry does.

type Telemetry

type Telemetry struct {
	// Provider accesses/consumes instrumentation.
	//
	// SEE: https://opentelemetry.io/docs/instrumentation/go/exporting_data/
	Provider trace.TracerProvider

	// TextMapPropagator propagates cross-cutting concerns as key-value text.
	//
	// SEE: // SEE: https://opentelemetry.io/docs/instrumentation/go/manual/#propagators-and-context
	TextMapPropagator []propagation.TextMapPropagator
	// contains filtered or unexported fields
}

Telemetry definition.

func New

func New(
	name string,
	provider trace.TracerProvider,
	textMapPropagators ...propagation.TextMapPropagator,
) (*Telemetry, error)

New is Telemetry factory.

func StdoutProvider

func StdoutProvider(name string) (*Telemetry, error)

StdoutProvider returns a telemetry which exports to `stdout`, and samples every trace.

func (*Telemetry) GetGlobalTracer

func (t *Telemetry) GetGlobalTracer() trace.Tracer

GetGlobalTracer returns the global tracer.

func (*Telemetry) GetTracer

func (t *Telemetry) GetTracer(name string) trace.Tracer

GetTracer retrieves a tracer. If the retrieved tracer doesn't exist, the global tracer is returned.

func (*Telemetry) NewTracer

func (t *Telemetry) NewTracer(name string) trace.Tracer

NewTracer creates a tracer from the current provider.

Jump to

Keyboard shortcuts

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