prometrics

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

* prometrics

 [[https://github.com/jiacai2050/prometrics/actions/workflows/test.yml][https://github.com/jiacai2050/prometrics/workflows/test/badge.svg]]

Prometheus metrics collector for [[https://github.com/cep21/circuit][circuit]].

*  Example

#+BEGIN_SRC go

import (
    "github.com/jiacai2050/prometrics"
    "github.com/prometheus/client_golang/prometheus"
)

prom := prometrics.GetFactory(prometheus.DefaultRegisterer)
h := circuit.Manager{
	DefaultCircuitProperties: []circuit.CommandPropertiesConstructor{
		prom.CommandProperties,
		// ... other config
	}
}

c := h.MustCreateCircuit("hello-world")
#+END_SRC

Exported metrics can be found in [[metrics.go]]. You can also check via

#+BEGIN_SRC bash
curl 0:8080/metrics | grep circuit
#+END_SRC

* License
[[LICENSE.txt][Apache License 2.0]]

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandFactory

type CommandFactory struct {
}

CommandFactory allows ingesting prometheus metrics

func GetFactory

func GetFactory(r prometheus.Registerer) *CommandFactory

GetFactory returns a global-shared CommandFactory, with metrics registered into r

func GetFactoryWithNamespace added in v0.1.0

func GetFactoryWithNamespace(r prometheus.Registerer, namespace string) *CommandFactory

GetFactoryWithNamespace returns a global-shared CommandFactory, with metrics registered into r Metrics will be created in particular namespace

func (*CommandFactory) CommandProperties

func (c *CommandFactory) CommandProperties(circuitName string) circuit.Config

CommandProperties creates prometheus metrics for a circuit

Jump to

Keyboard shortcuts

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