Categorygithub.com/tetratelabs/telemetry
modulepackage
0.8.2
Repository: https://github.com/tetratelabs/telemetry.git
Documentation: pkg.go.dev

# README

Telemetry

CI codecov

This package provides a set of Telemetry interfaces allowing you to completely decouple your libraries and packages from Logging and Metrics instrumentation implementations.

For more information on the interfaces, see: https://pkg.go.dev/github.com/tetratelabs/telemetry

Implementations

Below you can find a list of known interface implementations. As a consumer of this package, you might want to select existing implementations to use in your application binaries. If looking to write your own, take a look at existing ones for inspiration.

If you have an OSS implementation you want to share, feel free to submit a PR to this file so it may be included in this list.

repositorysupported interfacesnotes
tetratelabs/telemetry-gokit-logLoggerGo kit log bridge
tetratelabs/logLoggerScoped structured/unstructured logger bridge
tetratelabs/telemetry-opencensusMetricsOpenCensus metrics bridge
tetratelabs/telemetry-opentelemetryMetricsOpenTelemetry metrics bridge

# Packages

Package function provides an implementation of the telemetry.Logger interface that uses a given function to emit logs.
Package scope provides a scoped logger facade for telemetry.Logger implementations.

# Functions

FromLevel returns the logging level corresponding to the given string representation.
KeyValuesFromContext retrieves key-value pairs that might be stored in the provided Context.
KeyValuesToContext takes provided Context, retrieves the already stored key-value pairs from it, appends the in this function provided key-value pairs and stores the result in the returned Context.
NoopLogger returns a no-op logger.
RemoveKeyValuesFromContext returns a Context that copies the provided Context but removes the key-value pairs that were stored.
SetGlobalMetricSink allows one to set a global MetricSink, after which all registered OnGlobalMetricSinkFn callback functions are executed.
ToGlobalMetricSink allows one to set callback functions to bootstrap Metrics as soon as the Global MetricSink has been registered.
WithEnabled allows a metric to be conditionally enabled if the provided function returns true.
WithLabels provides a configuration MetricOption for a new Metric, providing the required dimensions for data collection of that Metric.
WithUnit provides a configuration MetricOption for a new Metric, providing Unit of measure information for a new Metric.

# Constants

Predefined units for use with the monitoring package.
Available log levels.
Available log levels.
Available log levels.
Available log levels.
Predefined units for use with the monitoring package.
Predefined units for use with the monitoring package.
Predefined units for use with the monitoring package.

# Structs

MetricOptions hold commonly used but optional Metric configuration.

# Interfaces

DerivedMetric can be used to supply values that dynamically derive from internal state, but are not updated based on any specific event.
DerivedMetricSink bridges libraries bootstrapping metrics from metrics instrumentation implementations.
Label holds a metric dimension which can be operated on using the interface methods.
LabelValue holds an action to take on a metric dimension's value.
Logger provides a simple yet powerful logging abstraction.
Metric collects numerical observations.
MetricSink bridges libraries bootstrapping metrics from metrics instrumentation implementations.

# Type aliases

Level is an enumeration of the available log levels.
MetricOption implements a functional option type for our Metrics.
OnGlobalMetricSinkFn holds a function signature which can be used to register Metric bootstrapping that needs to be called after the GlobalMetricSink has been registered.
Unit encodes the standard name for describing the quantity measured by a Metric (if applicable).