metrics

package
v1.0.0-beta.168 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

go-metrics to OpenTelemetry adapter

Sarama (any most probably other projects) rely on the http://github.com/rcrowley/go-metrics package, numerous connectors exist for the package, however there seem to be no opentelemetry one.

Given the package only supports periodic scraping, it's better to wrap the metric types of go-metrics so that we can send the raw events to OpenTelemetry. The existing event interface of go-metrics is quite limited compared to OpenTelemetry esp considering the usage in Sarama lib, so right now:

  • Context is context.Background() for OpenTelemetry calls
  • Errors for metric registration is only logged

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRegistry

func NewRegistry(opts NewRegistryOptions) (metrics.Registry, error)

Types

type ErrorHandler

type ErrorHandler func(error)

func LoggingErrorHandler

func LoggingErrorHandler(dest *slog.Logger) ErrorHandler

type NewRegistryOptions

type NewRegistryOptions struct {
	MetricMeter     otelmetric.Meter
	NameTransformFn TransformMetricsNameToOtel
	ErrorHandler    ErrorHandler
}

type TransformMetricsNameToOtel

type TransformMetricsNameToOtel func(string) string

func MetricAddNamePrefix

func MetricAddNamePrefix(prefix string) TransformMetricsNameToOtel

Jump to

Keyboard shortcuts

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