xprom

package
v1.25.8 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONHandler

func JSONHandler() http.Handler

JSONHandler 在使用次方法前,请先调用 promhttp.Handler()

func MetricTypePtr

func MetricTypePtr(mt dto.MetricType) *dto.MetricType

Types

type Family

type Family struct {
	Name    string        `json:"name"`
	Help    string        `json:"help"`
	Type    string        `json:"type"`
	Metrics []interface{} `json:"metrics,omitempty"` // Either metric or summary.
}

Family mirrors the MetricFamily proto message.

func NewFamily

func NewFamily(dtoMF *dto.MetricFamily) *Family

NewFamily consumes a MetricFamily and transforms it to the local Family type.

func (*Family) AddLabel

func (f *Family) AddLabel(key, val string)

type Histogram

type Histogram struct {
	Labels      map[string]string `json:"labels,omitempty"`
	TimestampMs string            `json:"timestamp_ms,omitempty"`
	Buckets     map[string]string `json:"buckets,omitempty"`
	Count       string            `json:"count"`
	Sum         string            `json:"sum"`
}

Histogram mirrors the Histogram proto message.

type Metric

type Metric struct {
	Labels      map[string]string `json:"labels,omitempty"`
	TimestampMs string            `json:"timestamp_ms,omitempty"`
	Value       string            `json:"value"`
}

Metric is for all "single value" metrics, i.e. Counter, Gauge, and Untyped.

type Summary

type Summary struct {
	Labels      map[string]string `json:"labels,omitempty"`
	TimestampMs string            `json:"timestamp_ms,omitempty"`
	Quantiles   map[string]string `json:"quantiles,omitempty"`
	Count       string            `json:"count"`
	Sum         string            `json:"sum"`
}

Summary mirrors the Summary proto message.

Jump to

Keyboard shortcuts

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