prom

package
v1.4.20 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package prom provides prometheus metrics handler options for httpserver module.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithMetrics

func WithMetrics(p *metrics.Prometheus) httpserver.Opt

WithMetrics replaces servers handler with http.Handler which is instrumented with /metrics endpoint. This option is meant be used with stand alone metrics server, not embedded inside application server. For serving metrics endpoint inside your application web server check lower level functionalities from metrics.

Example
package main

import (
	"github.com/elisasre/go-common/metrics"
	"github.com/elisasre/go-common/service/module/httpserver"
	"github.com/elisasre/go-common/service/module/httpserver/prom"
)

func main() {
	httpserver.New(
		httpserver.WithAddr(":6062"),
		prom.WithMetrics(metrics.New()),
	)
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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