telemetry

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package telemetry provides geolocation lookup and Prometheus metric registry helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCoordinates

func GetCoordinates()

GetCoordinates initializes geolocation metrics and starts a background goroutine that periodically fetches and updates geolocation data from a remote service. Fetches occur every 10 minutes. This function should be called once at application startup.

func GetCurrentCountry

func GetCurrentCountry() string

GetCurrentCountry returns the cached country string

func GetCurrentCountryISO

func GetCurrentCountryISO() string

GetCurrentCountryISO returns the cached country ISO code

func NewCounter

func NewCounter(name, subsystem, help string, opts ...MetricOption) prometheus.Counter

NewCounter creates a Counter metrics under the global namespace returns nop if metrics are disabled.

func NewCounterVec

func NewCounterVec(name, subsystem, help string, labels []string, opts ...MetricOption) *prometheus.CounterVec

NewCounterVec creates a CounterVec metrics under the global namespace returns nop if metrics are disabled.

func NewGauge

func NewGauge(name, subsystem, help string, opts ...MetricOption) prometheus.Gauge

NewGauge creates a Gauge metrics under the global namespace returns nop if metrics are disabled.

func NewGaugeVec

func NewGaugeVec(name, subsystem, help string, labels []string, opts ...MetricOption) *prometheus.GaugeVec

NewGaugeVec creates a Gauge metrics under the global namespace returns nop if metrics are disabled.

func NewHistogram

func NewHistogram(name, subsystem, help string, labels []string, opts ...MetricOption) *prometheus.HistogramVec

NewHistogram creates and registers a new Prometheus histogram metric with the given parameters.

func NewHistogramWithBuckets

func NewHistogramWithBuckets(
	name, subsystem, help string,
	labels []string,
	buckets []float64,
	opts ...MetricOption,
) *prometheus.HistogramVec

NewHistogramWithBuckets creates a Histogram metrics with custom buckets.

func NewSimpleHistogram

func NewSimpleHistogram(name, subsystem, help string, buckets []float64, opts ...MetricOption) prometheus.Histogram

NewSimpleHistogram returns a histogram without labels.

func SetLabeledRegistry

func SetLabeledRegistry(lr prometheus.Registerer, ns string)

Types

type MetricOption

type MetricOption func(*metricOptions)

MetricOption customizes a metric created by the telemetry helpers.

func WithConstLabels

func WithConstLabels(labels prometheus.Labels) MetricOption

WithConstLabels attaches fixed labels to every series emitted by the metric.

Jump to

Keyboard shortcuts

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