httpmetricsreceiver

package module
v0.0.0-...-31c957e Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

README

HTTP Metrics Receiver

Status
Stability development: metrics
Distributions contrib
Issues Open issues Closed issues
Code Owners @lpegoraro

The HTTP Metrics Receiver is a component of the OpenTelemetry Collector that collects metrics from HTTP endpoints. It was made to fetch information about the endpoint and extract metrics from

httpcheck.status{http.status_class:1xx, http.status_code:200,...} = 0

Configuration

The following configuration settings are available:

  • targets (required): The list of targets to be monitored.
  • collection_interval (optional, default = 60s): This receiver collects metrics on an interval. Valid time units are ns, us (or µs), ms, s, m, h.
  • initial_delay (optional, default = 1s): defines how long this receiver waits before starting.

Each target has the following properties:

  • endpoint (required): the URL to be monitored
  • method (optional, default: GET): The HTTP method used to call the endpoint
  • follow_redirect (optional, default: false): If true, the receiver will follow redirects
  • fail_if_not_ssl (optional, default: false): If true, the receiver will notify a failure if the endpoint is not using SSL
  • contains_text (optional): If set, the receiver will show a count of the number of times the text appears in the response body
  • tags (optional): A map of tags to be added to the metrics produced by this receiver

Additionally, each target supports the client configuration options of confighttp.

Example Configuration
receivers:
  httpmetrics:
    collection_interval: 1m
    targets:
      - endpoint: http://localhost:12312
        method: GET
        follow_redirect: true
        fail_if_not_ssl: true
        contains_text: ["home", "0.0.1", "logo"]
        tags: { "env": "prod", "customer": "acme" }
      - endpoint: http://localhost:12312/login
        method: GET
        follow_redirect: false
        fail_if_not_ssl: true
        contains_text: [ "login", "0.0.1", "logo" ]
        tags: { "env": "prod", "customer": "acme" }

Metrics

Details about the metrics produced by this receiver can be found in documentation.md

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() receiver.Factory

NewFactory creates a new receiver factory

Types

type Config

type Config struct {
	scraperhelper.ScraperControllerSettings `mapstructure:",squash"`
	metadata.MetricsBuilderConfig           `mapstructure:",squash"`
	Targets                                 []*targetConfig `mapstructure:"targets"`
}

Config defines the configuration for the various elements of the receiver agent.

func (*Config) Validate

func (cfg *Config) Validate() error

Validate validates the configuration by checking for missing or invalid fields

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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