Documentation
¶
Overview ¶
Package telemetry provides geolocation lookup and Prometheus metric registry helpers.
Index ¶
- func GetCoordinates()
- func GetCurrentCountry() string
- func GetCurrentCountryISO() string
- func NewCounter(name, subsystem, help string, opts ...MetricOption) prometheus.Counter
- func NewCounterVec(name, subsystem, help string, labels []string, opts ...MetricOption) *prometheus.CounterVec
- func NewGauge(name, subsystem, help string, opts ...MetricOption) prometheus.Gauge
- func NewGaugeVec(name, subsystem, help string, labels []string, opts ...MetricOption) *prometheus.GaugeVec
- func NewHistogram(name, subsystem, help string, labels []string, opts ...MetricOption) *prometheus.HistogramVec
- func NewHistogramWithBuckets(name, subsystem, help string, labels []string, buckets []float64, ...) *prometheus.HistogramVec
- func NewSimpleHistogram(name, subsystem, help string, buckets []float64, opts ...MetricOption) prometheus.Histogram
- func SetLabeledRegistry(lr prometheus.Registerer, ns string)
- type MetricOption
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.