promwish

package module
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 12 Imported by: 7

README

promwish

Package promwish provides a simple wish middleware exposing some Prometheus metrics.

Example Usage

You can add promwish as a middleware to your app:

promwish.Middleware("localhost:9222", "my-app"),

This will create the metrics and start a HTTP server on localhost:9222 to expose the metrics.

You can also use promwish.MiddlewareRegistry and promwish.Listen if you need more options.

Check the _examples folder for a full working example.

Example Dashboard

image

Documentation

Overview

Package promwish provides a simple middleware to expose some metrics to Prometheus.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultCommandFn added in v0.4.0

func DefaultCommandFn(s ssh.Session) string

DefaultCommandFn is a CommandFn that returns the first part of s.Command().

func Listen

func Listen(address string)

Listen starts a HTTP server on the given address, serving the metrics from the default registerer to /metrics. It handles exit signals to gracefully shutdown the server.

func Middleware

func Middleware(address, app string) wish.Middleware

Middleware starts a HTTP server on the given address, serving the metrics from the default registerer to /metrics.

func MiddlewareRegistry

func MiddlewareRegistry(registry prometheus.Registerer, constLabels prometheus.Labels, fn CommandFn) wish.Middleware

Middleware setup the metrics for the given registry without starting any HTTP servers. The caller is then responsible for serving the metrics.

func MiddlewareWithCommand added in v0.4.0

func MiddlewareWithCommand(address, app string, fn CommandFn) wish.Middleware

MiddlewareWithCommand() starts a HTTP server on the given address, serving the metrics from the default registerer to /metrics, using the given CommandFn to extract the `command` label value.

Types

type CommandFn added in v0.4.0

type CommandFn func(s ssh.Session) string

CommandFn is used to get the value of the `command` label in the Prometheus metrics.

Jump to

Keyboard shortcuts

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