insmetrics

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package insmetrics provides helpers for opencesus metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeTags

func ChangeTags(ctx context.Context, mutator ...tag.Mutator) context.Context

ChangeTags wrapper around opencensus tag.New which panics on any tag creation error.

Panics on errors.

func ExtractValue

func ExtractValue(s string) string

ExtractValue extracts value of metric from line in OpenMetrics format.

func FindMetricsByNamePrefix

func FindMetricsByNamePrefix(r io.Reader, prefix string) []string

FindMetricsByNamePrefix finds all metrics with prefix. Reader expects to provide text stream in OpenMetrics format,

func InsertTag

func InsertTag(ctx context.Context, key tag.Key, value string) context.Context

InsertTag inserts (add) tag with provided value into context.

Panics on error.

func MustTagKey

func MustTagKey(key string) tag.Key

MustTagKey creates new tag.Key, panics on error

func RegisterPrometheus

func RegisterPrometheus(
	namespace string,
	registry *prometheusclient.Registry,
	reportperiod time.Duration,
	logger Errorer,
	nodeRole string,
) (*prometheus.Exporter, error)

RegisterPrometheus creates prometheus exporter and registers it in opencensus view lib.

func SumMetricsValueByNamePrefix

func SumMetricsValueByNamePrefix(r io.Reader, prefix string) float64

SumMetricsValueByNamePrefix summarizes values of metrics with prefix. Reader expects to provide text stream in OpenMetrics format,

Types

type Errorer

type Errorer interface {
	Error(...interface{})
}

Errorer is a logger with error

Jump to

Keyboard shortcuts

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