Version: v0.0.0-...-5e0f84c Latest Latest

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

Go to latest
Published: Feb 15, 2018 License: Apache-2.0 Imports: 21 Imported by: 0




View Source
const (
	//HeaderUserName is a variable of type string
	HeaderUserName   = "x-user-name"
	HeaderDomainName = "x-domain-name"
	ContentType      = "Content-Type"
	Name             = "monitor"

	// Metrics is the constant string
	Metrics = "PrometheusMetrics"

constants for header parameters


This section is empty.


func GetOrCreateRegistry

func GetOrCreateRegistry(name string) metrics.Registry

GetOrCreateRegistry return a go-metrics registry which go chassis framework use to report metrics

func GetSystemPrometheusRegistry

func GetSystemPrometheusRegistry() *prometheus.Registry

GetSystemPrometheusRegistry return prometheus registry which go chassis use

func GetSystemRegistry

func GetSystemRegistry() metrics.Registry

GetSystemRegistry return metrics registry which go chassis use

func Init

func Init() error

Init prepare the metrics functions

func MetricsHandleFunc

func MetricsHandleFunc(req *restful.Request, rep *restful.Response)

MetricsHandleFunc is a restful handler which can expose metrics in http server

func ReportMetricsToOpenTSDB

func ReportMetricsToOpenTSDB(r metrics.Registry)

ReportMetricsToOpenTSDB use go-metrics reporter to send metrics to opentsdb

func ReportMetricsToPrometheus

func ReportMetricsToPrometheus(r metrics.Registry)

ReportMetricsToPrometheus report metrics to prometheus registry, you can use GetSystemPrometheusRegistry to get prometheus registry. by default chassis will report system metrics to prometheus


type PrometheusSinker

type PrometheusSinker struct {
	Registry      metrics.Registry      // Registry to be exported
	PromRegistry  prometheus.Registerer //Prometheus registry
	FlushInterval time.Duration         //interval to update prom metrics
	// contains filtered or unexported fields

PrometheusSinker is the struct for prometheus configuration parameters

var DefaultPrometheusSinker *PrometheusSinker

DefaultPrometheusSinker variable for default prometheus configurations

func GetPrometheusSinker

func GetPrometheusSinker(mr metrics.Registry, pr *prometheus.Registry) *PrometheusSinker

GetPrometheusSinker get prometheus configurations

func NewPrometheusProvider

func NewPrometheusProvider(r metrics.Registry, promRegistry prometheus.Registerer, FlushInterval time.Duration) *PrometheusSinker

NewPrometheusProvider returns the object of prometheus configurations

func (*PrometheusSinker) EnableRunTimeMetrics

func (c *PrometheusSinker) EnableRunTimeMetrics()

EnableRunTimeMetrics enable runtime metrics

func (*PrometheusSinker) UpdatePrometheusMetrics

func (c *PrometheusSinker) UpdatePrometheusMetrics()

UpdatePrometheusMetrics update prometheus metrics

func (*PrometheusSinker) UpdatePrometheusMetricsOnce

func (c *PrometheusSinker) UpdatePrometheusMetricsOnce() error

UpdatePrometheusMetricsOnce update prometheus metrics once

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL