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.