telemetry

package
v0.0.0-...-3f3c78e Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOTLPExporter

func NewOTLPExporter(config OTLP) (*otlptrace.Exporter, error)

Creates a new OTLP exporter.

func NewResource

func NewResource(pkg, identifier string) (*resource.Resource, error)

Creates a new resource to identify the service instance.

func NewTracerProvider

func NewTracerProvider(exp tracesdk.SpanExporter, res *resource.Resource) *tracesdk.TracerProvider

Creates a trace provider - an entity that manages the puts together OTel things, i.e. it essentially allows to set a "global logger" for the whole application. Under the hood it creates span processors, i.e. hooks that receive all the events and write them to the exporters (e.g. Jaeger) while associating each of them with our service.

func SetupTelemetry

func SetupTelemetry(config Config) (*tracesdk.TracerProvider, error)

A simple helper that configures OpenTelemetry for the SFU.

Types

type ChildBuilder

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

func (*ChildBuilder) Create

func (cb *ChildBuilder) Create(name string, attributes ...attribute.KeyValue) *Telemetry

type Config

type Config struct {
	// Use OTLP exporter. Has precedence over the Jaeger configuration.
	OTLP OTLP `yaml:"otlp"`
	// The URL to the Jaeger instance.
	JaegerURL string `yaml:"jaegerUrl"`
	// The package name to use for the telemetry.
	Package string `yaml:"package"`
	// ID of the service instance.
	ID string `yaml:"id"`
}

type OTLP

type OTLP struct {
	// The endpoint of the OTLP. Note that the endpoint must not contain any URL path.
	Host string `yaml:"host"`
	// Secure indicates whether to use TLS when connecting to the OTLP endpoint.
	// HTTPS is used if enabled, HTTP otherwise.
	Secure bool `yaml:"secure"`
}

type Telemetry

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

func NewTelemetry

func NewTelemetry(ctx context.Context, name string, attributes ...attribute.KeyValue) *Telemetry

func (*Telemetry) AddError

func (t *Telemetry) AddError(err error)

func (*Telemetry) AddEvent

func (t *Telemetry) AddEvent(text string, attributes ...attribute.KeyValue)

func (*Telemetry) ChildBuilder

func (t *Telemetry) ChildBuilder(attributes ...attribute.KeyValue) *ChildBuilder

func (*Telemetry) CreateChild

func (t *Telemetry) CreateChild(name string, attributes ...attribute.KeyValue) *Telemetry

func (*Telemetry) End

func (t *Telemetry) End()

func (*Telemetry) Fail

func (t *Telemetry) Fail(err error)

Jump to

Keyboard shortcuts

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