Version: v0.0.0-...-6f3af1f Latest Latest

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

Go to latest
Published: Jul 18, 2022 License: Apache-2.0 Imports: 13 Imported by: 0




This section is empty.


View Source
var (

	// MCreatedLoadtestCountStat counts the number of loadtests created
	MCreatedLoadtestCountStat = stats.Int64("created_loadtests_count", "Number of loadtests created", stats.UnitDimensionless)

	// MFinishedLoadtestCountStat counts the number of finished loadtests
	MFinishedLoadtestCountStat = stats.Int64("finished_loadtests_count", "Number of finished loadtests", stats.UnitDimensionless)
View Source
var ControllerViews = []*view.View{
		Description: "Depth of the work queue",
		Measure:     workQueueDepthStat,
		Aggregation: view.LastValue(),
		TagKeys:     []tag.Key{reconcilerTagKey},
		Description: "Number of reconcile operations",
		Measure:     reconcileCountStat,
		Aggregation: view.Count(),
		TagKeys:     []tag.Key{reconcilerTagKey, keyTagKey, successTagKey},
		Description: "Latency of reconcile operations",
		Measure:     reconcileLatencyStat,
		Aggregation: reconcileDistribution,
		TagKeys:     []tag.Key{reconcilerTagKey, keyTagKey, successTagKey},
		Description: MCreatedLoadtestCountStat.Description(),
		Measure:     MCreatedLoadtestCountStat,
		Aggregation: view.Count(),
		Description: MFinishedLoadtestCountStat.Description(),
		Measure:     MFinishedLoadtestCountStat,
		Aggregation: view.Count(),

ControllerViews are the views needed to be registered for getting metrics from the kangal controller


func NewLogger

func NewLogger(cfg LoggerConfig) (*zap.Logger, bool, error)

NewLogger initializes and returns logger instance and flag if it is in debug mode

func NewPrometheusExporter

func NewPrometheusExporter(serviceName string, serviceViews []*view.View) (*prometheus.Exporter, error)

NewPrometheusExporter builds and configures Prometheus exporter


type LoggerConfig

type LoggerConfig struct {
	Level string `envconfig:"LOG_LEVEL" default:"info"`
	Type  string `envconfig:"LOG_TYPE" default:"kangal"`

LoggerConfig is the possible logger configurations

type StatsReporter

type StatsReporter interface {
	// ReportQueueDepth reports the queue depth metric
	ReportQueueDepth(v int64) error

	// ReportReconcile reports the count and latency metrics for a reconcile operation
	ReportReconcile(duration time.Duration, key, success string) error

StatsReporter defines the interface for sending metrics

func NewStatsReporter

func NewStatsReporter(reconciler string) (StatsReporter, error)

NewStatsReporter creates a reporter that collects and reports metrics

Jump to

Keyboard shortcuts

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