consumer

package
v0.0.0-...-750d6ac Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CLF contains a time.Parse reference timestamp for strftime
	// "%d/%b/%Y:%H:%M:%S %z" used in CLF.
	CLF = "02/Jan/2006:15:04:05 -0700"

	// ISO8601 contains a time.Parse reference timestamp for ISO 8601.
	ISO8601 = "2006-01-02T15:04:05-07:00"

	// ResponseCountMetricName is the name of the metric reporting total number
	// of response counts.
	ResponseCountMetricName = "nginx_http_response_total"
	// ResponseCountDetailedMetricName is the name of the metric reporting total
	// number of response counts for the configured "detail" paths.
	ResponseCountDetailedMetricName = "nginx_http_response_detailed_total"
	// ResponseDurationMetricName is the name of the metric reporting the
	// distribution of response durations (i.e., processing latency)
	ResponseDurationMetricName = "nginx_http_response_duration_seconds"
	// ResponseSizeMetricName is the name of the metric reporting the
	// distribution of response sizes.
	ResponseSizeMetricName = "nginx_http_response_size_bytes"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	Period time.Duration
	// contains filtered or unexported fields
}

Consumer implements periodic polling of the supplied nginx access log tailer, aggregation of response counts from the returned log lines.

func NewConsumer

func NewConsumer(period time.Duration, tailer file.TailerT, manager metrics.ManagerT, paths []string, format string) (*Consumer, error)

NewConsumer returns a Consumer polling the supplied tailer for new access log lines and exporting counts / stats to the supplied manager at the specified period. The specific metrics exported by the Consumer will be created during init in NewConsumer. Log lines provided by the tailer are expected to be in the supplied format, of which "JSON" (see README.md) and "CLF" are supported.

func (*Consumer) Run

func (c *Consumer) Run() error

Run performs periodic polling and exporting. It will only return on error or if Stop is called.

func (*Consumer) Stop

func (c *Consumer) Stop()

Stop signals that polling should cease in Run and the latter should return (e.g. if Run is blocking in another goroutine).

Jump to

Keyboard shortcuts

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