OpenTelemetry-Go Prometheus Exporter

OpenTelemetry Prometheus exporter


go get -u




This section is empty.


This section is empty.


func InstallNewPipeline

func InstallNewPipeline(config Config) (*push.Controller, http.HandlerFunc, error)

    InstallNewPipeline instantiates a NewExportPipeline and registers it globally. Typically called as: pipeline, hf, err := prometheus.InstallNewPipeline(prometheus.Config{...}) if err != nil {


    } http.HandleFunc("/metrics", hf) defer pipeline.Stop() ... Done

    func NewExportPipeline

    func NewExportPipeline(config Config) (*push.Controller, http.HandlerFunc, error)

      NewExportPipeline sets up a complete export pipeline with the recommended setup, chaining a NewRawExporter into the recommended selectors and batchers.


      type Config

      type Config struct {
      	// Registry is the prometheus registry that will be used as the default Registerer and
      	// Gatherer if these are not specified.
      	// If not set a new empty Registry is created.
      	Registry *prometheus.Registry
      	// Registerer is the prometheus registerer to register
      	// metrics with.
      	// If not specified the Registry will be used as default.
      	Registerer prometheus.Registerer
      	// Gatherer is the prometheus gatherer to gather
      	// metrics with.
      	// If not specified the Registry will be used as default.
      	Gatherer prometheus.Gatherer
      	// DefaultSummaryQuantiles is the default summary quantiles
      	// to use. Use nil to specify the system-default summary quantiles.
      	DefaultSummaryQuantiles []float64
      	// OnError is a function that handle errors that may occur while exporting metrics.
      	// TODO: This should be refactored or even removed once we have a better error handling mechanism.
      	OnError func(error)

        Config is a set of configs for the tally reporter.

        type Exporter

        type Exporter struct {
        	// contains filtered or unexported fields

          Exporter is an implementation of metric.Exporter that sends metrics to Prometheus.

          func NewRawExporter

          func NewRawExporter(config Config) (*Exporter, error)

            NewRawExporter returns a new prometheus exporter for prometheus metrics for use in a pipeline.

            func (*Exporter) Export

            func (e *Exporter) Export(_ context.Context, checkpointSet export.CheckpointSet) error

              Export exports the provide metric record to prometheus.

              func (*Exporter) ServeHTTP

              func (e *Exporter) ServeHTTP(w http.ResponseWriter, r *http.Request)