prometheusreceiver

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 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. 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: 'opencensus_service'
            scrape_interval: 5s
            static_configs:
              - targets: ['0.0.0.0:8889']
          - job_name: 'jdbc_apps'
            scrape_interval: 3s
            static_configs:
              - targets: ['0.0.0.0:9777']
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 CustomUnmarshalerFunc

func CustomUnmarshalerFunc(componentViperSection *viper.Viper, intoCfg interface{}) error

CustomUnmarshalerFunc performs custom unmarshaling of config.

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"`

	// 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.

type Factory

type Factory struct {
}

Factory is the factory for receiver.

func (*Factory) CreateDefaultConfig

func (f *Factory) CreateDefaultConfig() configmodels.Receiver

CreateDefaultConfig creates the default configuration for receiver.

func (*Factory) CreateMetricsReceiver

func (f *Factory) CreateMetricsReceiver(ctx context.Context, logger *zap.Logger, cfg configmodels.Receiver, nextConsumer consumer.MetricsConsumerOld) (component.MetricsReceiver, error)

CreateMetricsReceiver creates a metrics receiver based on provided config.

func (*Factory) CreateTraceReceiver

func (f *Factory) CreateTraceReceiver(
	ctx context.Context,
	logger *zap.Logger,
	cfg configmodels.Receiver,
	nextConsumer consumer.TraceConsumerOld,
) (component.TraceReceiver, error)

CreateTraceReceiver creates a trace receiver based on provided config.

func (*Factory) CustomUnmarshaler

func (f *Factory) CustomUnmarshaler() component.CustomUnmarshaler

CustomUnmarshaler returns custom unmarshaler for this config.

func (*Factory) Type

func (f *Factory) Type() configmodels.Type

Type gets the type of the Receiver config created by this factory.

type Preceiver

type Preceiver struct {
	// contains filtered or unexported fields
}

Preceiver is the type that provides Prometheus scraper/receiver functionality.

func (*Preceiver) Flush

func (pr *Preceiver) Flush()

Flush triggers the Flush method on the underlying Prometheus scrapers and instructs them to immediately sned over the metrics they've collected, to the MetricsConsumer. it's not needed on the new prometheus receiver implementation, let it do nothing

func (*Preceiver) Shutdown

func (pr *Preceiver) Shutdown(context.Context) error

Shutdown stops and cancels the underlying Prometheus scrapers.

func (*Preceiver) Start

func (pr *Preceiver) Start(ctx context.Context, host component.Host) error

Start is the method that starts Prometheus scraping and it is controlled by having previously defined a Configuration using perhaps New.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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