metrics

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package metrics contains the prometheus infrastructure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseMetrics

type DatabaseMetrics struct {
	// Counts of database operations
	DatabaseOperations *prometheus.CounterVec

	// Latencies of database operations.
	DatabaseLatencies *prometheus.HistogramVec
}

Default service metrics for database operations.

func NewDefaultDatabaseMetrics

func NewDefaultDatabaseMetrics(pkg string) DatabaseMetrics

NewDefaultDatabaseMetrics creates Prometheus metric instrumentation for basic metrics common to database accesses. Default metrics include:

1. Counts of database operations. 2. Latencies for database operations.

func (*DatabaseMetrics) DatabaseCounter

func (m *DatabaseMetrics) DatabaseCounter(labels ...string) prometheus.Counter

DatabaseCounter returns the counter for the database operation. Provided labels should be database, operation, status, and cause.

func (*DatabaseMetrics) DatabaseTimer

func (m *DatabaseMetrics) DatabaseTimer(labels ...string) *prometheus.Timer

DatabaseTimer returns a new latency timer for the provided database operation. Provided labels should be database and operation.

type PullService

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

PullService is a service that supports the Prometheus pull method.

func NewPullService

func NewPullService(pullEndpoint string, rootLogger *log.Logger) (*PullService, error)

Creates a new Prometheus pull service.

func (*PullService) StartInstrumentation

func (s *PullService) StartInstrumentation()

StartInstrumentation starts the pull metrics service.

type RequestMetrics

type RequestMetrics struct {
	// Counts of requests made to each service endpoint.
	RequestCounts *prometheus.CounterVec

	// Latencies of serving incoming requests.
	RequestLatencies *prometheus.HistogramVec
}

Default service metrics for requests.

func NewDefaultRequestMetrics

func NewDefaultRequestMetrics(pkg string) RequestMetrics

NewDefaultRequestMetrics creates Prometheus metric instrumentation for basic metrics common to serving requests. Default metrics include:

1. Counts of service endpoints hit. 2. Latencies for requests.

func (*RequestMetrics) RequestCounter

func (m *RequestMetrics) RequestCounter(labels ...string) prometheus.Counter

RequestCounter returns the counter for the calling request. Provided labels should be endpoint, status, and cause.

func (*RequestMetrics) RequestTimer

func (m *RequestMetrics) RequestTimer(labels ...string) *prometheus.Timer

RequestTimer creates a new latency timer for the provided request endpoint.

Jump to

Keyboard shortcuts

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