telemetry

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package telemetry sets up logging (and, later, metrics).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(w io.Writer, level string) *slog.Logger

NewLogger returns a JSON logger that drops credentials and email bodies.

Types

type Metrics

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

Metrics is the daemon's Prometheus registry. This file is the only place that imports the Prometheus client: the HTTP layer reports through ObserveHTTP and serves Handler. A nil *Metrics records nothing.

func NewMetrics

func NewMetrics(version string) *Metrics

NewMetrics returns a registry with the Go runtime and process collectors, the build version and the HTTP request metrics.

func (*Metrics) Handler

func (m *Metrics) Handler() http.Handler

Handler serves the registry in the Prometheus text format.

func (*Metrics) ObserveHTTP

func (m *Metrics) ObserveHTTP(method, route string, status int, took time.Duration)

ObserveHTTP records one served request. route is the matched route pattern, never the raw path, so ids do not become label values.

Jump to

Keyboard shortcuts

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