Documentation ¶
Index ¶
- func NewCompositeLogger(logSinks []logr.LogSink) logr.Logger
- func NewSpanLogSink(span trace.Span) logr.LogSink
- func StartSpanWithLogger(ctx context.Context, spanName string, opts ...Option) (context.Context, logr.Logger, func())
- func Tracer() trace.Tracer
- type Config
- type CorrID
- type CorrIDKey
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCompositeLogger ¶ added in v1.2.0
NewCompositeLogger is the main entry-point to this implementation.
func NewSpanLogSink ¶ added in v1.2.0
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 ¶
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
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.
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.