metrics

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MDeployCounter Counts/groups deployments to a particular service/environment
	MDeployCounter = stats.Int64("sherlock/deploy_frequency", "count of deploy events for various services and environments", "deploys")
	// MLeadTimeToEnv tracks time elapsed between an image being built, and when it is deployed to an environment
	MLeadTimeToEnv = stats.Float64("sherlock/lead_time_to_env", "time elapsed between build and deploy to an environment", "h")

	// KeyService is used to add a tag for a service to the time series above
	KeyService, _ = tag.NewKey("service")
	// KeyEnvironment is used to add a tag for an environment to the time series above
	KeyEnvironment, _ = tag.NewKey("environment")
)
View Source
var (
	DeployCounterView = &view.View{
		Name:        "deploy_frequency",
		Measure:     MDeployCounter,
		TagKeys:     []tag.Key{KeyService, KeyEnvironment},
		Description: "Count of deploy events",
		Aggregation: view.Count(),
	}
	LeadTimeView = &view.View{
		Name:        "lead_time_to_environment",
		Measure:     MLeadTimeToEnv,
		TagKeys:     []tag.Key{KeyService, KeyEnvironment},
		Description: "time between when a build was created and when it was deployed to a particular environment",
		Aggregation: view.LastValue(),
	}
)

metrics views

Functions

func RecordDeployFrequency

func RecordDeployFrequency(ctx context.Context, environmentName, serviceName string)

RecordDeployFrequency will record a new data point for the given service and environment on sherlock's deploy frequency time series

func RecordLeadTime

func RecordLeadTime(ctx context.Context, leadTimeHours float64, environmentName, serviceName string)

RecordLeadTime will extract tags from the context and then write a lead time data point to the appropriate time series

func RegisterPrometheusMetricsHandler

func RegisterPrometheusMetricsHandler(metricsGroup *gin.RouterGroup)

RegisterPrometheusMetricsHandler accepts a gin.RouterGroup and will set up a prometheus metrics endpoint on the provided route

func RegisterStackdriverExporter

func RegisterStackdriverExporter() (*stackdriver.Exporter, error)

RegisterStackdriverExporter will

Types

This section is empty.

Jump to

Keyboard shortcuts

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