tele

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCompositeLogger added in v1.2.0

func NewCompositeLogger(logSinks []logr.LogSink) logr.Logger

NewCompositeLogger is the main entry-point to this implementation.

func NewSpanLogSink added in v1.2.0

func NewSpanLogSink(span trace.Span) logr.LogSink

NewSpanLogSink is the main entry-point to this implementation.

func StartSpanWithLogger added in v0.5.3

func StartSpanWithLogger(
	ctx context.Context,
	spanName string,
	opts ...Option,
) (context.Context, logr.Logger, func())

StartSpanWithLogger starts a new span with the global tracer returned from Tracer(), then returns a new logger implementation that composes both the logger from the given ctx and a logger that logs to the newly created span.

Callers should make sure to call the function in the 3rd return value to ensure that the span is ended properly. In many cases, that can be done with a defer:

ctx, lggr, done := StartSpanWithLogger(ctx, "my-span")
defer done()

func Tracer

func Tracer() trace.Tracer

Tracer returns an OpenTelemetry Tracer implementation to be used to create spans. If you need access to the raw globally-registered tracer, use this function.

Most people should not use this function directly, however. Instead, consider using StartSpanWithLogger, which uses this tracer to start a new span, configures logging, and more.

Example usage:

ctx, span := tele.Tracer().Start(ctx, "myFunction")
defer span.End()
// use the span and context here

Types

type Config added in v0.5.3

type Config struct {
	KVPs map[string]string
}

Config holds optional, arbitrary configuration information to be added to logs and telemetry data. Instances of Config get passed to StartSpanWithLogger via the KVP function.

type CorrID added in v0.5.2

type CorrID string

CorrID is a correlation ID that the cluster API provider sends with all API requests to Azure. Do not create one of these manually. Instead, use the CtxWithCorrelationID function to create one of these within a context.Context.

func CorrIDFromCtx added in v0.5.2

func CorrIDFromCtx(ctx context.Context) (CorrID, bool)

CorrIDFromCtx attempts to fetch a correlation ID from the given context.Context. If none exists, returns an empty CorrID and false. Otherwise returns the CorrID value and true.

type CorrIDKey added in v0.5.3

type CorrIDKey string

CorrIDKey is the type of the key used to store correlation IDs in context.Contexts.

const CorrIDKeyVal CorrIDKey = "x-ms-correlation-request-id"

CorrIDKeyVal is the key used to store the correlation ID in context.Contexts, HTTP headers, and other similar locations.

type Option added in v0.5.3

type Option func(*Config)

Option is the modifier function used to configure StartSpanWithLogger. Generally speaking, you should not create your own option function. Instead, use built-in functions (like KVP) that create them.

func KVP added in v0.5.3

func KVP(key, value string) Option

KVP returns a new Option function that adds a the given key-value pair.

Jump to

Keyboard shortcuts

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