prometheusreceiver

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

README

Prometheus Receiver

Receives metric data in Prometheus format. See the Design for additional information on this receiver.

This receiver is a drop-in replacement for getting Prometheus to scrape your services. It supports the full set of Prometheus configuration, including service discovery. Just like you would write in a YAML configuration file before starting Prometheus, such as with:

prometheus --config.file=prom.yaml

You can copy and paste that same configuration under section

receivers:
  prometheus:
    config:

For example:

receivers:
    prometheus:
      config:
        scrape_configs:
          - job_name: 'otel-collector'
            scrape_interval: 5s
            static_configs:
              - targets: ['0.0.0.0:8888']
          - job_name: k8s
            kubernetes_sd_configs:
            - role: pod
            relabel_configs:
            - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
              regex: "true"
              action: keep
            metric_relabel_configs:
            - source_labels: [__name__]
              regex: "(request_duration_seconds.*|response_duration_seconds.*)"
              action: keep
Include Filter

Include Filter provides ability to filter scraping metrics per target. If a filter is specified for a target then only those metrics which exactly matches one of the metrics specified in the Include Filter list will be scraped. Rest of the metrics from the targets will be dropped.

Syntax
  • Endpoint should be double quoted.
  • Metrics should be specified in form of a list.
Example
receivers:
    prometheus:
      include_filter: {
        "0.0.0.0:9777" : [http/server/server_latency, custom_metric1],
        "0.0.0.0:9778" : [http/client/roundtrip_latency],
      }
      config:
        scrape_configs:
          ...

The full list of settings exposed for this receiver are documented here with detailed sample configurations here.

Documentation

Overview

Package prometheusreceiver has the logic for scraping Prometheus metrics from already instrumented applications and then passing them onto a metricsink instance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory added in v0.8.0

func NewFactory() component.ReceiverFactory

Types

type Config

type Config struct {
	configmodels.ReceiverSettings `mapstructure:",squash"`
	PrometheusConfig              *config.Config `mapstructure:"-"`
	BufferPeriod                  time.Duration  `mapstructure:"buffer_period"`
	BufferCount                   int            `mapstructure:"buffer_count"`
	UseStartTimeMetric            bool           `mapstructure:"use_start_time_metric"`
	StartTimeMetricRegex          string         `mapstructure:"start_time_metric_regex"`

	// ConfigPlaceholder is just an entry to make the configuration pass a check
	// that requires that all keys present in the config actually exist on the
	// structure, ie.: it will error if an unknown key is present.
	ConfigPlaceholder interface{} `mapstructure:"config"`
}

Config defines configuration for Prometheus receiver.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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