package module
Version: v0.35.0 Latest Latest

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

Go to latest
Published: Jan 29, 2023 License: Apache-2.0 Imports: 19 Imported by: 100



Package prometheus provides a Prometheus Exporter that converts OTLP metrics into the Prometheus exposition format and implements prometheus.Collector to provide a handler for these metrics.



This section is empty.


This section is empty.


This section is empty.


type Exporter

type Exporter struct {

Exporter is a Prometheus Exporter that embeds the OTel metric.Reader interface for easy instantiation with a MeterProvider.

func New

func New(opts ...Option) (*Exporter, error)

New returns a Prometheus Exporter.

type Option added in v0.32.0

type Option interface {
	// contains filtered or unexported methods

Option sets exporter option values.

func WithAggregationSelector added in v0.33.0

func WithAggregationSelector(agg metric.AggregationSelector) Option

WithAggregationSelector configure the Aggregation Selector the exporter will use. If no AggregationSelector is provided the DefaultAggregationSelector is used.

func WithRegisterer added in v0.33.0

func WithRegisterer(reg prometheus.Registerer) Option

WithRegisterer configures which prometheus Registerer the Exporter will register with. If no registerer is used the prometheus DefaultRegisterer is used.

func WithoutScopeInfo added in v0.34.0

func WithoutScopeInfo() Option

WithoutScopeInfo configures the Exporter to not export the otel_scope_info metric. If not specified, the Exporter will create a otel_scope_info metric containing the metrics' Instrumentation Scope, and also add labels about Instrumentation Scope to all metric points.

func WithoutTargetInfo added in v0.33.0

func WithoutTargetInfo() Option

WithoutTargetInfo configures the Exporter to not export the resource target_info metric. If not specified, the Exporter will create a target_info metric containing the metrics' resource.Resource attributes.

func WithoutUnits added in v0.33.0

func WithoutUnits() Option

WithoutUnits disables exporter's addition of unit suffixes to metric names, and will also prevent unit comments from being added in OpenMetrics once unit comments are supported.

By default, metric names include a unit suffix to follow Prometheus naming conventions. For example, the counter metric request.duration, with unit milliseconds would become request_duration_milliseconds_total. With this option set, the name would instead be request_duration_total.

Jump to

Keyboard shortcuts

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