Documentation ¶
Overview ¶
Package metrics defines metrics for various build events, and utility functions to be used in other modules for the metric updates.
Index ¶
- Variables
- func BuildCompleted(ctx context.Context, b *model.Build)
- func BuildCreated(ctx context.Context, b *model.Build)
- func BuildStarted(ctx context.Context, b *model.Build)
- func ExpiredLeaseReset(ctx context.Context, b *model.Build)
- func ReportBuilderMetrics(ctx context.Context) error
- func WithBuilder(ctx context.Context, project, bucket, builder string) context.Context
- func WithServiceInfo(ctx context.Context, service, job, instance string) context.Context
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // V1 is a collection of metric objects for V1 metrics. V1 = struct { BuildCount metric.Int BuildCountCreated metric.Counter BuildCountStarted metric.Counter BuildCountCompleted metric.Counter BuildDurationCycle metric.CumulativeDistribution BuildDurationRun metric.CumulativeDistribution BuildDurationScheduling metric.CumulativeDistribution ExpiredLeaseReset metric.Counter MaxAgeScheduled metric.Float }{ BuildCount: metric.NewInt( "buildbucket/builds/count", "Number of pending/running prod builds", nil, bFields("status")..., ), BuildCountCreated: metric.NewCounter( "buildbucket/builds/created", "Build creation", nil, bFields("user_agent")..., ), BuildCountStarted: metric.NewCounter( "buildbucket/builds/started", "Build start", nil, bFields("canary")..., ), BuildCountCompleted: metric.NewCounter( "buildbucket/builds/completed", "Build completion, including success, failure and cancellation", nil, bFields("result", "failure_reason", "cancelation_reason", "canary")..., ), BuildDurationCycle: newbuildDurationMetric( "buildbucket/builds/cycle_durations", "Duration between build creation and completion", ), BuildDurationRun: newbuildDurationMetric( "buildbucket/builds/run_durations", "Duration between build start and completion", ), BuildDurationScheduling: newbuildDurationMetric( "buildbucket/builds/scheduling_durations", "Duration between build creation and start", ), ExpiredLeaseReset: metric.NewCounter( "buildbucket/builds/lease_expired", "Build lease expirations", nil, bFields("status")..., ), MaxAgeScheduled: metric.NewFloat( "buildbucket/builds/max_age_scheduled", "Age of the oldest SCHEDULED build", &types.MetricMetadata{Units: types.Seconds}, bFields("must_be_never_leased")..., ), } )
View Source
var ( // V2 is a collection of metric objects for V2 metrics. V2 = struct { BuildCount metric.Int BuildCountCreated metric.Counter BuildCountStarted metric.Counter BuildCountCompleted metric.Counter BuildDurationCycle metric.CumulativeDistribution BuildDurationRun metric.CumulativeDistribution BuildDurationScheduling metric.CumulativeDistribution BuilderPresence metric.Bool ConsecutiveFailureCount metric.Int MaxAgeScheduled metric.Float }{ BuildCount: metric.NewIntWithTargetType( "buildbucket/v2/builds/count", (&bbmetrics.BuilderTarget{}).Type(), "Number of pending/running prod builds", nil, field.String("status"), ), BuildCountCreated: metric.NewCounterWithTargetType( "buildbucket/v2/builds/created", (&bbmetrics.BuilderTarget{}).Type(), "Build creation", nil, field.String("experiments"), ), BuildCountStarted: metric.NewCounterWithTargetType( "buildbucket/v2/builds/started", (&bbmetrics.BuilderTarget{}).Type(), "Build start", nil, field.String("experiments"), ), BuildCountCompleted: metric.NewCounterWithTargetType( "buildbucket/v2/builds/completed", (&bbmetrics.BuilderTarget{}).Type(), "Build completion, including success, failure and cancellation", nil, field.String("status"), field.String("experiments"), ), BuildDurationCycle: metric.NewCumulativeDistributionWithTargetType( "buildbucket/v2/builds/cycle_durations", (&bbmetrics.BuilderTarget{}).Type(), "Duration between build creation and completion", &types.MetricMetadata{Units: types.Seconds}, distribution.GeometricBucketer(math.Pow(10, 0.053), 100), field.String("status"), field.String("experiments"), ), BuildDurationRun: metric.NewCumulativeDistributionWithTargetType( "buildbucket/v2/builds/run_durations", (&bbmetrics.BuilderTarget{}).Type(), "Duration between build start and completion", &types.MetricMetadata{Units: types.Seconds}, distribution.GeometricBucketer(math.Pow(10, 0.053), 100), field.String("status"), field.String("experiments"), ), BuildDurationScheduling: metric.NewCumulativeDistributionWithTargetType( "buildbucket/v2/builds/scheduling_durations", (&bbmetrics.BuilderTarget{}).Type(), "Duration between build creation and start", &types.MetricMetadata{Units: types.Seconds}, distribution.GeometricBucketer(math.Pow(10, 0.053), 100), field.String("experiments"), ), BuilderPresence: metric.NewBoolWithTargetType( "buildbucket/v2/builder/presence", (&bbmetrics.BuilderTarget{}).Type(), "A constant, always-true metric that indicates the presence of LUCI Builder", nil, ), ConsecutiveFailureCount: metric.NewIntWithTargetType( "buildbucket/v2/builds/consecutive_failure_count", (&bbmetrics.BuilderTarget{}).Type(), "Number of consecutive non-successful build terminations since the last successful build.", nil, field.String("status"), ), MaxAgeScheduled: metric.NewFloatWithTargetType( "buildbucket/v2/builds/max_age_scheduled", (&bbmetrics.BuilderTarget{}).Type(), "Age of the oldest SCHEDULED build", &types.MetricMetadata{Units: types.Seconds}, ), } )
Functions ¶
func BuildCompleted ¶
BuildCompleted updates metrics for a build completion event.
func BuildCreated ¶
BuildCreated updates metrics for a build creation event.
func BuildStarted ¶
BuildStarted updates metrics for a build start event.
func ExpiredLeaseReset ¶
ExpiredLeaseReset updates metrics for an expired lease reset.
func ReportBuilderMetrics ¶
ReportBuilderMetrics computes and reports Builder metrics.
func WithBuilder ¶
WithBuilder returns a context for a Builder target with the given info.
WithServiceInfo must be called once before this function. Otherwise, this panics.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.