Documentation
¶
Index ¶
Constants ¶
const DefaultEndpoint = "http://localhost:8428/api/v1/import/prometheus"
DefaultEndpoint is default endpoint to send metrics too
const DefaultMetricsEndpointRelativePath = "/metrics"
DefaultMetricsEndpointRelativePath is usual path to expose metrics for Prometheus scrappers
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// MetricSet is
MetricSet *metrics.Set
// ExposeRuntimeMetrics toggles exposing default golang runtime metrics at scrapper endpoint
ExposeRuntimeMetrics bool
// ExtraLabels are added to all metrics being sent via PUSH mechanism into Prometheus/Victoria Metrics database
ExtraLabels map[string]string
// ExtraHeaders are added to HTTP requests being sent
ExtraHeaders map[string]string
// Endpoint sets destination for metrics, by default it is DefaultEndpoint
Endpoint string
// Method defines http method used to deliver metrics, default is http.MethodGet
Method string
}
Handler stores logic in it
func NewWithDefaultMetricsSet ¶
func NewWithDefaultMetricsSet() *Handler
NewWithDefaultMetricsSet creates new Handler with default golang runtime metrics set
func NewWithEmptyMetricsSet ¶
func NewWithEmptyMetricsSet() *Handler
NewWithEmptyMetricsSet creates new Handler with empty metrics set
func (*Handler) ExposeMetrics ¶
ExposeMetrics expose metrics endpoint
func (*Handler) InjectMiddleware ¶
InjectMiddleware injects middleware into gin.Engine that counts requests
func (*Handler) StartPushing ¶
StartPushing starts pushing handler metrics into Victoria/Prometheus
func (*Handler) StartPushingDefaultMetrics ¶
StartPushingDefaultMetrics starts pushing default (including runtime with 'process_*' and `go_*` if Handler.ExposeRuntimeMetrics enabled) metrics into Victoria/Prometheus