opencensus

package module
v0.0.0-...-2e0044a Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// ValAllChecks is the value used for the check tags when tagging all tests
	ValAllChecks = "all_checks"
)

Variables

View Source
var (

	// ViewCheckExecutionTime is the checks execution time aggregation tagged by check name
	ViewCheckExecutionTime = &view.View{
		Measure:     mCheckDuration,
		TagKeys:     []tag.Key{keyCheck, keyClassification},
		Aggregation: view.Distribution(0, 1, 2, 3, 4, 6, 8, 10, 13, 16, 20, 25, 30, 40, 50, 65, 80, 100, 120, 160, 200, 250, 300, 500),
	}

	// ViewCheckCountByNameAndStatus is the checks execution count aggregation grouped by check name, and check status
	ViewCheckCountByNameAndStatus = &view.View{
		Name:        "health/check_count_by_name_and_status",
		Measure:     mCheckStatus,
		TagKeys:     []tag.Key{keyCheck, keyCheckPassing, keyClassification},
		Aggregation: view.Count(),
	}

	// ViewCheckStatusByName is the checks status aggregation tagged by check name
	ViewCheckStatusByName = &view.View{
		Name:        "health/check_status_by_name",
		Measure:     mCheckStatus,
		TagKeys:     []tag.Key{keyCheck, keyClassification},
		Aggregation: view.LastValue(),
	}

	// DefaultHealthViews are the default health check views provided by this package.
	DefaultHealthViews = []*view.View{
		ViewCheckCountByNameAndStatus,
		ViewCheckStatusByName,
		ViewCheckExecutionTime,
	}
)

Functions

This section is empty.

Types

type MetricsListener

type MetricsListener struct {
	// contains filtered or unexported fields
}

MetricsListener reports metrics on each check registration, start and completion event (as gosundheit.CheckListener) This listener all reports metrics for the entire service health (as gosundheit.HealthListener)

func NewMetricsListener

func NewMetricsListener(opts ...Option) *MetricsListener

func (*MetricsListener) OnCheckCompleted

func (c *MetricsListener) OnCheckCompleted(name string, result gosundheit.Result)

func (*MetricsListener) OnCheckRegistered

func (c *MetricsListener) OnCheckRegistered(name string, result gosundheit.Result)

func (*MetricsListener) OnCheckStarted

func (c *MetricsListener) OnCheckStarted(_ string)

func (*MetricsListener) OnResultsUpdated

func (c *MetricsListener) OnResultsUpdated(results map[string]gosundheit.Result)

type Option

type Option func(*MetricsListener)

func WithClassification

func WithClassification(classification string) Option

WithClassification set custom classification for metrics

func WithDefaults

func WithDefaults() Option

func WithLivenessClassification

func WithLivenessClassification() Option

WithLivenessClassification sets the classification to "liveness"

func WithReadinessClassification

func WithReadinessClassification() Option

WithReadinessClassification sets the classification to "readiness"

func WithStartupClassification

func WithStartupClassification() Option

WithStartupClassification sets the classification to "startup"

Jump to

Keyboard shortcuts

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