nginxreceiver

package
v0.0.0-...-77fd705 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package nginxreceiver polls the status page provided by the nginx module nginx_latency_status_module and generates metrics based on it. It is a metric receiver designed to work with OpenTelemetry Collector.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() component.ReceiverFactory

NewFactory creates and returns a factory for the nginx receiver.

Types

type Config

type Config struct {
	config.ReceiverSettings `mapstructure:",squash"`
	ExportInterval          time.Duration `mapstructure:"export_interval"`
	StatsURL                string        `mapstructure:"stats_url"`
}

Config defines the configuration for the nginx stats receiver.

type LatencyStats

type LatencyStats struct {
	RequestCount int64   `json:"request_count"`
	LatencySum   int64   `json:"latency_sum"`
	SumSquares   int64   `json:"sum_squares"`
	Distribution []int64 `json:"distribution"`
}

LatencyStats is a struct to parse the latency stats json into.

type NginxStats

type NginxStats struct {
	RequestLatency      LatencyStats `json:"request_latency"`
	UpstreamLatency     LatencyStats `json:"upstream_latency"`
	WebsocketLatency    LatencyStats `json:"websocket_latency"`
	LatencyBucketBounds []float64    `json:"latency_bucket_bounds"`
}

NginxStats is a struct to parse the nginx stats json into.

type NginxStatsCollector

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

NginxStatsCollector is a struct that generates metrics by polling the nginx status page at statsURL.

func NewNginxStatsCollector

func NewNginxStatsCollector(interval time.Duration, statsURL string, logger *zap.Logger, consumer consumer.Metrics) (*NginxStatsCollector, error)

NewNginxStatsCollector creates a new NginxStatsCollector that generates metrics based on nginx stats found by polling the url

func (*NginxStatsCollector) StartCollection

func (collector *NginxStatsCollector) StartCollection()

StartCollection starts a go routine that periodically polls nginx for stats and exports metrics based on them.

func (*NginxStatsCollector) StopCollection

func (collector *NginxStatsCollector) StopCollection()

StopCollection stops the polling for nginx stats and the export of the metrics.

type Receiver

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

Receiver is the type that provides Receiver functionality for the nginx stats metrics.

func (*Receiver) Shutdown

func (receiver *Receiver) Shutdown(ctx context.Context) error

Shutdown stops and cancels the underlying nginx metrics generator.

func (*Receiver) Start

func (receiver *Receiver) Start(ctx context.Context, host component.Host) error

Start starts the underlying nginx metrics generator.

Jump to

Keyboard shortcuts

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