httpcheckreceiver

package module
v0.119.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 18 Imported by: 9

README

HTTP Check Receiver

Status
Stability alpha: metrics
Distributions contrib, k8s
Issues Open issues Closed issues
Code Owners @codeboten

The HTTP Check Receiver can be used for synthetic checks against HTTP endpoints. This receiver will make a request to the specified endpoint using the configured method. This scraper generates a metric with a label for each HTTP response status class with a value of 1 if the status code matches the class. For example, the following metrics will be generated if the endpoint returned a 200:

httpcheck.status{http.status_class:1xx, http.status_code:200,...} = 0
httpcheck.status{http.status_class:2xx, http.status_code:200,...} = 1
httpcheck.status{http.status_class:3xx, http.status_code:200,...} = 0
httpcheck.status{http.status_class:4xx, http.status_code:200,...} = 0
httpcheck.status{http.status_class:5xx, 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 (optional): A single URL to be monitored.
  • endpoints (optional): A list of URLs to be monitored.
  • method (optional, default: GET): The HTTP method used to call the endpoint or endpoints.

At least one of endpoint or endpoints must be specified. Additionally, each target supports the client configuration options of confighttp.

Example Configuration
receivers:
  httpcheck:
    collection_interval: 30s
    targets:
      - method: "GET"
        endpoints:
          - "https://opentelemetry.io"
      - method: "GET"
        endpoints: 
          - "http://localhost:8080/hello1"
          - "http://localhost:8080/hello2"
        headers:
          Authorization: "Bearer <your_bearer_token>"
      - method: "GET"
        endpoint: "http://localhost:8080/hello"
        headers:
          Authorization: "Bearer <your_bearer_token>"
processors:
  batch:
    send_batch_max_size: 1000
    send_batch_size: 100
    timeout: 10s
exporters:
  debug:
    verbosity: detailed
service:
  pipelines:
    metrics:
      receivers: [httpcheck]
      processors: [batch]
      exporters: [debug]

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.ControllerConfig `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 top-level Config by checking each targetConfig.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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