metrics

package
v1.28.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package metrics provides functionalities for instrumenting GoFr applications with metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHandler

func GetHandler(m Manager) http.Handler

GetHandler creates a new HTTP handler that serves metrics collected by the provided metrics manager to '/metrics' route`.

Types

type Logger

type Logger interface {
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
}

Logger defines a simple interface for logging messages at different log levels.

type Manager

type Manager interface {
	NewCounter(name, desc string)
	NewUpDownCounter(name, desc string)
	NewHistogram(name, desc string, buckets ...float64)
	NewGauge(name, desc string)

	IncrementCounter(ctx context.Context, name string, labels ...string)
	DeltaUpDownCounter(ctx context.Context, name string, value float64, labels ...string)
	RecordHistogram(ctx context.Context, name string, value float64, labels ...string)
	SetGauge(name string, value float64, labels ...string)
}

Manager defines the interface for registering and interacting with different types of metrics (counters, up-down counters, histograms, and gauges).

func NewMetricsManager added in v0.3.0

func NewMetricsManager(meter metric.Meter, logger Logger) Manager

NewMetricsManager creates a new metrics manager instance with the provided metric meter and logger.

type Store

type Store interface {
	// contains filtered or unexported methods
}

Store represents a store for registered metrics. It provides methods to retrieve and manage different types of metrics (counters, up-down counters, histograms, and gauges).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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