metrics

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package metrics emits gitdr's run metrics in Prometheus text-exposition format to a file that node_exporter's textfile collector scrapes. The metric DR alerting cares about is gitdr_last_successful_run (unix seconds of the last successful backup). An empty path is a no-op, so the tool runs anywhere. OTel users can still consume these via the Collector's Prometheus receiver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

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

Writer writes the metrics file. Construct with New; an empty path disables output.

func New

func New(path string) *Writer

New returns a Writer for the given textfile-collector path ("" = disabled).

func (*Writer) WriteSuccess

func (w *Writer) WriteSuccess(repos int) error

WriteSuccess records the last-successful-run timestamp and protected-repo count, writing the file atomically (temp + rename) so the collector never reads a partial file. Call only after a fully successful run, so a failure leaves the value stale and DR alerting fires.

Jump to

Keyboard shortcuts

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