Documentation ¶
Index ¶
- Variables
- func RecordDeployFrequency(ctx context.Context, environmentName, serviceName string)
- func RecordLeadTime(ctx context.Context, leadTimeHours float64, ...)
- func RegisterPrometheusMetricsHandler(metricsGroup *gin.RouterGroup)
- func RegisterStackdriverExporter() (*stackdriver.Exporter, error)
- type LatestLeadTimesLister
- type LeadTimeData
- type LeadTimePoller
Constants ¶
This section is empty.
Variables ¶
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") )
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 ¶
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 ¶
type LatestLeadTimesLister ¶ added in v0.0.81
type LatestLeadTimesLister interface {
ListLatestLeadTimes() ([]LeadTimeData, error)
}
LatestLeadTimes is an interface that represents the capability to enumerate over all the latest lead time values for all releases in all environments. Currently it is only implemented for the V1 APIs, When we are ready to switch to V2 apis as the source for accelerate data it will need to implement this interface
type LeadTimeData ¶ added in v0.0.81
type LeadTimePoller ¶ added in v0.0.81
type LeadTimePoller struct { LatestLeadTimesLister // contains filtered or unexported fields }
LeadTimePoller contains wraps the information needed to continuously poll the DB for the latest lead time interval.
func NewLeadTimePoller ¶ added in v0.0.81
func NewLeadTimePoller( deploys LatestLeadTimesLister, pollInterval, cacheFlushInterval time.Duration, ) *LeadTimePoller
func (*LeadTimePoller) InitializeAndPoll ¶ added in v0.0.81
func (p *LeadTimePoller) InitializeAndPoll(ctx context.Context) error
This function will block until the initialization completes or errors so that sherlock will not start serving requests until the data for the /metrics endpoint is initialized. then it will kick off the lead time polling loop it's an own go routine which will listen for cancellation signals via ctx