Documentation ¶
Overview ¶
Package telemetry can be used for implementing observability using OpenTelemetry API. It aims to unify the three pillars of observability in one single package that is easy-to-use and hard-to-misuse. It offers a unified developer experience for implementing observability.
Index ¶
- func ContextWithLogger(ctx context.Context, logger Logger) context.Context
- func ContextWithMeter(ctx context.Context, meter metric.Meter) context.Context
- func ContextWithTracer(ctx context.Context, tracer trace.Tracer) context.Context
- func ContextWithUUID(ctx context.Context, uuid string) context.Context
- func MeterFromContext(ctx context.Context) metric.Meter
- func Set(p Probe)
- func TracerFromContext(ctx context.Context) trace.Tracer
- func UUIDFromContext(ctx context.Context) (string, bool)
- type Level
- type Logger
- type Option
- type Probe
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithLogger ¶
ContextWithLogger returns a new context that holds a reference to a logger.
func ContextWithMeter ¶
ContextWithMeter returns a new context that holds a reference to a meter.
func ContextWithTracer ¶
ContextWithTracer returns a new context that holds a reference to a tracer.
func ContextWithUUID ¶
ContextWithUUID creates a new context with a uuid.
func MeterFromContext ¶
MeterFromContext returns a meter set on a context. If no meter found on the context, the singleton meter will be returned!
func TracerFromContext ¶
TracerFromContext returns a tracer set on a context. If no tracer found on the context, the singleton tracer will be returned!
Types ¶
type Logger ¶
type Logger interface { Level() Level SetLevel(level string) With(kv ...interface{}) Logger Debug(message string, kv ...interface{}) Debugf(format string, args ...interface{}) Info(message string, kv ...interface{}) Infof(format string, args ...interface{}) Warn(message string, kv ...interface{}) Warnf(format string, args ...interface{}) Error(message string, kv ...interface{}) Errorf(format string, args ...interface{}) Close() error }
Logger is a levelled structured logger. It is concurrently safe to be used by multiple goroutines.
func LoggerFromContext ¶
LoggerFromContext returns a logger set on a context. If no logger found on the context, the singleton logger will be returned!
type Option ¶
type Option func(*options)
Option is used for configuring a probe.
func WithLogger ¶
WithLogger is the option for enabling the logger.
func WithMetadata ¶
WithMetadata is the option for specifying and reporting metadata. All arguments are optional.
func WithOpenTelemetry ¶
func WithOpenTelemetry(meterEnabled, tracerEnabled bool, collectorAddress string, collectorCredentials credentials.TransportCredentials) Option
WithOpenTelemetry is the option for enabling OpenTelemetry Collector. collectorCredentials is optional. If not specified, the connection will be insecure. The default collector address is localhost:55680.
func WithPrometheus ¶
func WithPrometheus() Option
WithPrometheus is the option for enabling Prometheus.
Directories ¶
Path | Synopsis |
---|---|
example
|
|
Package grpc is used for building observable gRPC servers and clients that automatically report logs, metrics, and traces.
|
Package grpc is used for building observable gRPC servers and clients that automatically report logs, metrics, and traces. |
Package http is used for building observable HTTP servers and clients that automatically report logs, metrics, and traces.
|
Package http is used for building observable HTTP servers and clients that automatically report logs, metrics, and traces. |