metrics

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package metrics exposes runtime counters in Prometheus text format.

Written by hand rather than with client_golang. The data already exists as atomics on each node runner, the exposition format is small and stable, and the library would add a couple of megabytes to a binary whose whole argument is that it is small. What the library buys — label escaping, consistent HELP/TYPE emission, collision safety — is reproduced here deliberately rather than skipped.

Node-RED exposes nothing comparable. Per-node message counts, error counts and queue depth are the difference between knowing a flow is backing up and finding out when the pod is OOM-killed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler serves the metrics endpoint.

func NewHandler

func NewHandler(version string, source Source) *Handler

NewHandler builds the endpoint.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, _ *http.Request)

func (*Handler) Write

func (h *Handler) Write(w io.Writer)

Write emits the exposition.

type NodeStat

type NodeStat struct {
	NodeID    string
	Type      string
	Received  int64
	Sent      int64
	Errors    int64
	Dropped   int64
	Blocked   int64
	QueueLen  int
	QueueCap  int
	QueueHigh int64
}

NodeStat is one node's counters. Mirrors runtime.Snapshot, kept separate so this package does not depend on the runtime and can be tested on its own.

type Source

type Source func() []NodeStat

Source supplies the current counters.

Jump to

Keyboard shortcuts

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