prometheus

package module
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 2

README

Prometheus Bridge

Status: Experimental

The Prometheus Bridge allows using the Prometheus Golang client library (github.com/prometheus/client_golang) with the OpenTelemetry SDK.

Usage

// Make a Promethes bridge "Metric Producer" that adds metrics from the
// Prometheus DefaultGatherer. Add the WithGatherer(registry) option to add
// metrics from other registries.
bridge := prometheus.NewMetricProducer()
// Make a Periodic Reader to periodically gather metrics from the bridge, and
// push to an OpenTelemetry exporter.
reader := metric.NewPeriodicReader(otelExporter, metric.WithProducer(bridge))
// Create an OTel MeterProvider with our reader. Metrics from OpenTelemetry
// instruments are combined with metrics from Prometheus instruments in
// exported batches of metrics.
mp := metric.NewMeterProvider(metric.WithReader(reader))

Limitations

  • Summary metrics are dropped by the bridge.
  • Start times for histograms and counters are set to the process start time.
  • It does not currently support exponential histograms.

Documentation

Overview

Package prometheus provides a bridge from Prometheus to OpenTelemetry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMetricProducer

func NewMetricProducer(opts ...Option) metric.Producer

NewMetricProducer returns a metric.Producer that fetches metrics from Prometheus. This can be used to allow Prometheus instrumentation to be added to an OpenTelemetry export pipeline.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option sets producer option values.

func WithGatherer

func WithGatherer(gatherer prometheus.Gatherer) Option

WithGatherer configures which prometheus Gatherer the Bridge will gather from. If no registerer is used the prometheus DefaultGatherer is used.

Jump to

Keyboard shortcuts

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