openmetrics

package
v14.2.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 16 Imported by: 0

README

OpenMetrics Source

The openmetrics source is used to ingest metrics into Veneur by scraping endpoints that support the OpenMetrics specification.

Development Status

This source is still under active development, and is subject to breaking changes.

Usage

In order to enable the source, add the following entry to the sources field in Veneur's configuration:

sources:
  - kind: openmetrics
    name: openmetrics
    config:
      scrape_interval: 30s
      scrape_target: http://example-service:8000/metrics
      scrape_timeout: 5s

The metrics source can be configured with the following attributes:

allowlist

Optional. Type: regex.

A regular expression matching metric names that should be used by the source.

denylist

Optional. Type: regex.

A regular expression matching metric names that should be ignored by the source. This field is not used if allowlist is set.

histogram_bucket_tag

Optional. Type: string. Default: "le".

This field overrides the default histogram bucket tag specified by OpenMetrics. This field generally should not be used.

scrape_interval

Required. Type: duration.

The interval at which the source scrapes targets. Warning: Currently this must be set to the flush interval for the OpenMetrics source to work.

scrape_target

Required. Type: URL.

scrape_timeout

Optional. Type: duration. Default: scrape_interval.

The duration after which a scrape request times out. The value of scrape_timeout must be less than or equal to the value of scrape_interval.

summary_quantile_tag

Optional. Type: string. Default: "quantile"

This field overrides the default summary quantile tag specified by OpenMetrics. This field generally should not be used.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(
	server *veneur.Server, name string, logger *logrus.Entry,
	sourceConfig veneur.ParsedSourceConfig,
) (sources.Source, error)

func ParseConfig

func ParseConfig(
	name string, config interface{},
) (veneur.ParsedSourceConfig, error)

Types

type OpenMetricsSource

type OpenMetricsSource struct {
	Denylist *regexp.Regexp

	HttpClient *http.Client

	ScrapeTarget  *url.URL
	ScrapeTimeout time.Duration
	// contains filtered or unexported fields
}

TODO(arnavdugar): Make public fields private once veneur-prometheus is removed.

func (*OpenMetricsSource) Convert

func (source *OpenMetricsSource) Convert(
	prometheusResults <-chan QueryResults,
) <-chan *convertResults

func (OpenMetricsSource) Name

func (source OpenMetricsSource) Name() string

func (*OpenMetricsSource) Query

func (source *OpenMetricsSource) Query(
	ctx context.Context,
) (<-chan QueryResults, error)

func (OpenMetricsSource) Start

func (source OpenMetricsSource) Start(ingest sources.Ingest) error

func (OpenMetricsSource) Stop

func (source OpenMetricsSource) Stop()

type OpenMetricsSourceConfig

type OpenMetricsSourceConfig struct {
	Allowlist          util.Regexp   `yaml:"allowlist"`
	Denylist           util.Regexp   `yaml:"denylist"`
	HistogramBucketTag string        `yaml:"histogram_bucket_tag"`
	ScrapeInterval     time.Duration `yaml:"scrape_interval"`
	ScrapeTarget       util.Url      `yaml:"scrape_target"`
	ScrapeTimeout      time.Duration `yaml:"scrape_timeout"`
	SummaryQuantileTag string        `yaml:"summary_quantile_tag"`
}

type QueryResults

type QueryResults struct {
	MetricFamily dto.MetricFamily
	Error        error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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