prometheus

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

README

Micro Prometheus

Go Micro monitoring plugin, export prometheus metrics through target address.

Usage

import (
	"github.com/micro/go-micro/v2"
	prometheus "github.com/x-punch/micro-prometheus/v2"
)

func main(){
    service := micro.NewService()
    prom := prometheus.NewPrometheus()
    service.Init(micro.WrapHandler(prom.NewHandlerWrapper()), micro.WrapSubscriber(prom.NewSubscriberWrapper()))
}
curl http://:8080/metrics

Tips

When plugin created, it'll listen on http address(default :8080), if the port is not avaiable or other issues, you'll have an error, but the program'll still be running.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option represents prometheus options update method

func ListenAddress

func ListenAddress(address string) Option

ListenAddress represents exposing metrics address.

func MetricsPath

func MetricsPath(path string) Option

MetricsPath represents exposing metrics path

func ServiceID

func ServiceID(id string) Option

ServiceID represents service id

func ServiceName

func ServiceName(name string) Option

ServiceName represents service name

func ServiceVersion

func ServiceVersion(version string) Option

ServiceVersion represents service version

type Options

type Options struct {
	ServiceID      string
	ServiceName    string
	ServiceVersion string
	Subsystem      string
	ListenAddress  string
	MetricsPath    string
}

Options represents prometheus metrics options

type Prometheus

type Prometheus interface {
	NewClientWrapper() client.Wrapper
	NewCallWrapper() client.CallWrapper
	NewHandlerWrapper() server.HandlerWrapper
	NewSubscriberWrapper() server.SubscriberWrapper
}

Prometheus represents go micro monitoring plugin for prometheus

func NewPrometheus

func NewPrometheus(opts ...Option) Prometheus

NewPrometheus generates a new set of metrics with a certain subsystem name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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