channels

package
v0.0.0-...-45fb3ff Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package channels implements fetching and exporting NixOS channel metadata as Prometheus metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExporter

func NewExporter(data Data, baseURL string, client *http.Client) (prometheus.Collector, error)

NewExporter constructs a prometheus.Collector which gathers NixOS channel metadata about the channels defined in data, from the HTTP server specified by baseURL.

If baseURL is empty, a sane default is used. If client is nil, a default HTTP client with timeouts is used.

Types

type Channel

type Channel struct {
	Job     string `json:"job"`
	Current bool   `json:"current"`
}

A Channel describes an individual NixOS channel.

type Data

type Data struct {
	Channels map[string]Channel `json:"channels"`
}

Data is the top-level wrapper for NixOS channel metadata.

func ParseData

func ParseData(r io.Reader) (*Data, error)

ParseData parses Data from an input JSON stream.

type Exporter

type Exporter struct {
	ChannelRevision        *prometheus.Desc
	ChannelUpdateTime      *prometheus.Desc
	ChannelCurrent         *prometheus.Desc
	ChannelRequestFailures *prometheus.Desc
	// contains filtered or unexported fields
}

An Exporter is a prometheus.Collector for NixOS channel metadata.

func (*Exporter) Collect

func (e *Exporter) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*Exporter) Describe

func (e *Exporter) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

Jump to

Keyboard shortcuts

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