metrics

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package metrics defines metrics and implements reporting utilities.

Index

Constants

This section is empty.

Variables

View Source
var Internal = struct {
	BuildbucketRPCCount            metric.Counter
	BuildbucketRPCDurations        metric.CumulativeDistribution
	CLIngestionAttempted           metric.Counter
	CLIngestionLatency             metric.CumulativeDistribution
	CLIngestionLatencyWithoutFetch metric.CumulativeDistribution
	CLTriggererTaskCompleted       metric.Counter
	CLTriggererTaskDuration        metric.CumulativeDistribution
	BigQueryExportDelay            metric.CumulativeDistribution
	RunTryjobResultReportDelay     metric.CumulativeDistribution
	RunResetTriggerAttempted       metric.Counter
	QuotaOp                        metric.Counter
	CreateToFirstTryjobLatency     metric.CumulativeDistribution
	StartToFirstTryjobLatency      metric.CumulativeDistribution
}{
	BuildbucketRPCCount: metric.NewCounter(
		"cv/internal/buildbucket_rpc/count",
		"Total number of RPCs to Buildbucket.",
		nil,
		field.String("project"),
		field.String("host"),
		field.String("method"),
		field.String("canonical_code"),
	),
	BuildbucketRPCDurations: metric.NewCumulativeDistribution(
		"cv/internal/buildbucket_rpc/durations",
		"Distribution of RPC duration (in milliseconds).",
		&types.MetricMetadata{Units: types.Milliseconds},

		distribution.GeometricBucketer(math.Pow(float64(10*time.Minute/time.Millisecond), 1.0/nBuckets), nBuckets),
		field.String("project"),
		field.String("host"),
		field.String("method"),
		field.String("canonical_code"),
	),
	CLIngestionAttempted: metric.NewCounter(
		"cv/internal/changelist/ingestion_attempted",
		"Occurrences of CL updates by processing UpdateCLTask with an actual "+
			"fetch operation in the updater backend",
		nil,
		field.String("requester"),

		field.Bool("changed"),

		field.Bool("dep"),

		field.String("project"),

		field.Bool("changed_snapshot"),
	),
	CLIngestionLatency: metric.NewCumulativeDistribution(
		"cv/internal/changelist/ingestion_latency",
		"Distribution of the time elapsed "+
			"from the time of a Gerrit update event occurrence "+
			"to the time of the snapshot ingested in CV",
		&types.MetricMetadata{Units: types.Seconds},

		distribution.GeometricBucketer(
			math.Pow(float64(8*time.Hour/time.Second), 1.0/nBuckets), nBuckets,
		),
		field.String("requester"),
		field.Bool("dep"),
		field.String("project"),
		field.Bool("changed_snapshot"),
	),
	CLIngestionLatencyWithoutFetch: metric.NewCumulativeDistribution(
		"cv/internal/changelist/ingestion_latency_without_fetch",
		"Distribution of the time elapsed "+
			"from the time of a Gerrit update event occurrence "+
			"to the time of the snapshot ingested in CV, but excluding "+
			"the time taken to fetch the snapshot from the backend",
		&types.MetricMetadata{Units: types.Seconds},

		distribution.GeometricBucketer(
			math.Pow(float64(8*time.Hour/time.Second), 1.0/nBuckets), nBuckets,
		),
		field.String("requester"),
		field.Bool("dep"),
		field.String("project"),
		field.Bool("changed_snapshot"),
	),
	CLTriggererTaskCompleted: metric.NewCounter(
		"cv/internal/cltriggerer/tasks/completed",
		"Count of Chained CQ vote tasks completed",
		nil,

		field.String("project"),

		field.String("config_group"),

		field.Int("num_deps"),

		field.String("status"),
	),
	CLTriggererTaskDuration: metric.NewCumulativeDistribution(
		"cv/internal/cltriggerer/tasks/duration",
		"Distribution of processing time for chained CQ vote processes",
		&types.MetricMetadata{Units: types.Milliseconds},

		distribution.GeometricBucketer(
			math.Pow(float64(20*time.Minute/time.Millisecond), 1.0/nBuckets), nBuckets,
		),

		field.String("project"),

		field.String("config_group"),

		field.Int("num_deps"),

		field.String("status"),
	),
	BigQueryExportDelay: metric.NewCumulativeDistribution(
		"cv/internal/runs/bq_export_delay",
		"Distribution of the time elapsed from the time a Run ends to the "+
			"time CV exports this Run to BigQuery",
		&types.MetricMetadata{Units: types.Milliseconds},

		distribution.GeometricBucketer(
			math.Pow(float64(8*time.Hour/time.Millisecond), 1.0/nBuckets), nBuckets,
		),
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
	),
	RunTryjobResultReportDelay: metric.NewCumulativeDistribution(
		"cv/internal/runs/tryjob_result_report_delay",
		"Distribution of the time elapsed from the time Run Tryjob execution has "+
			"completed to the time LUCI CV successfully reports the result to the CL",
		&types.MetricMetadata{Units: types.Milliseconds},

		distribution.GeometricBucketer(
			math.Pow(float64(8*time.Hour/time.Millisecond), 1.0/nBuckets), nBuckets,
		),
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
	),
	RunResetTriggerAttempted: metric.NewCounter(
		"cv/internal/runs/reset_trigger_attempted",
		"Record the number of attempts to reset the triggers of Run",
		nil,
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
		field.Bool("succeeded"),
		field.String("gerrit_error"),
	),
	QuotaOp: metric.NewCounter(
		"cv/internal/quota/op",
		"Count of server quota operation",
		nil,
		field.String("project"),
		field.String("policy_namespace"),
		field.String("policy_name"),
		field.String("policy_resource"),
		field.String("op"),
		field.String("status"),
	),
	CreateToFirstTryjobLatency: metric.NewCumulativeDistribution(
		"cv/internal/runs/create_to_first_tryjob_latency",
		"Time elapsed from the Run creation to the first successful tryjob launch "+
			"time. Runs that do not successfully launch any Tryjob are not reported. "+
			"It's possible due to tryjob reuse, launch failure or 0 tryjob configured.",
		&types.MetricMetadata{Units: types.Milliseconds},

		distribution.GeometricBucketer(
			math.Pow(float64(1*time.Hour/time.Millisecond), 1.0/nBuckets), nBuckets,
		),
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
	),
	StartToFirstTryjobLatency: metric.NewCumulativeDistribution(
		"cv/internal/runs/start_to_first_tryjob_latency",
		"Time elapsed from the Run start to the first successful tryjob launch "+
			"time. Runs that do not successfully launch any Tryjob are not reported. "+
			"It's possible due to tryjob reuse, launch failure or 0 tryjob configured.",
		&types.MetricMetadata{Units: types.Milliseconds},

		distribution.GeometricBucketer(
			math.Pow(float64(1*time.Hour/time.Millisecond), 1.0/nBuckets), nBuckets,
		),
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
	),
}

Internal contains a collection of metric definitions internal to LUCI CV.

View Source
var Public = struct {
	RunCreated         metric.Counter
	RunStarted         metric.Counter
	RunEnded           metric.Counter
	RunDuration        metric.CumulativeDistribution
	RunTotalDuration   metric.CumulativeDistribution
	ActiveRunCount     metric.Int
	ActiveRunDuration  metric.NonCumulativeDistribution
	PendingRunCount    metric.Int
	PendingRunDuration metric.NonCumulativeDistribution
	MaxPendingRunAge   metric.Int

	TryjobLaunched        metric.Counter
	TryjobEnded           metric.Counter
	TryjobBuilderPresence metric.Bool

	RunQuotaRejection metric.Counter
}{
	RunCreated: metric.NewCounter(
		"cv/runs/created",
		"Count of the newly created Runs",
		nil,
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
	),
	RunStarted: metric.NewCounter(
		"cv/runs/started",
		"Count of the started Runs",
		nil,
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
	),
	RunEnded: metric.NewCounter(
		"cv/runs/ended",
		"Count of the ended Runs",
		nil,
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
		field.String("status"),
		field.Bool("successfully_started"),
	),
	RunDuration: metric.NewCumulativeDistribution(
		"cv/runs/ended/durations",
		"The distribution of time elapsed from Run start to Run end",
		&types.MetricMetadata{Units: types.Seconds},

		distribution.GeometricBucketer(math.Pow(float64(2*24*time.Hour/time.Second), 1.0/nBuckets), nBuckets),
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
		field.String("status"),
	),
	RunTotalDuration: metric.NewCumulativeDistribution(
		"cv/runs/ended/total_durations",
		"The distribution of time elapsed from Run creation to Run end",
		&types.MetricMetadata{Units: types.Seconds},

		distribution.GeometricBucketer(math.Pow(float64(2*24*time.Hour/time.Second), 1.0/nBuckets), nBuckets),
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
		field.String("status"),
		field.Bool("successfully_started"),
	),
	ActiveRunCount: metric.NewInt(
		"cv/runs/active",
		"The current count of the Runs that are active (started but not ended yet)",
		nil,
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
	),
	ActiveRunDuration: metric.NewNonCumulativeDistribution(
		"cv/runs/active/durations",
		"The distribution of all the currently active run durations (started but not ended yet)",
		&types.MetricMetadata{Units: types.Seconds},

		distribution.GeometricBucketer(math.Pow(float64(2*24*time.Hour/time.Second), 1.0/nBuckets), nBuckets),
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
	),
	PendingRunCount: metric.NewInt(
		"cv/runs/pending",
		"The current count of the Runs that are pending (created but not started yet)",
		nil,
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
	),
	PendingRunDuration: metric.NewNonCumulativeDistribution(
		"cv/runs/pending/durations",
		"The distribution of all the currently pending Run durations (created but not started yet)",
		&types.MetricMetadata{Units: types.Milliseconds},

		distribution.GeometricBucketer(math.Pow(float64(2*time.Hour/time.Millisecond), 1.0/nBuckets), nBuckets),
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
	),
	MaxPendingRunAge: metric.NewInt(
		"cv/runs/max_pending_age",
		"The age of the oldest run that has been created but not started yet (aka age of the oldest pending run)",
		&types.MetricMetadata{Units: types.Milliseconds},
		field.String("project"),
		field.String("config_group"),
		field.String("mode"),
	),
	TryjobLaunched: metric.NewCounterWithOptions(
		"cv/tryjobs/launched",
		&metric.Options{TargetType: ((*bbmetrics.BuilderTarget)(nil)).Type()},
		"Count of Tryjobs launched by LUCI CV",
		nil,
		field.String("cv_project"),
		field.String("config_group"),
		field.Bool("critical"),
		field.Bool("retry"),
	),
	TryjobEnded: metric.NewCounterWithOptions(
		"cv/tryjobs/ended",
		&metric.Options{TargetType: ((*bbmetrics.BuilderTarget)(nil)).Type()},
		"Count of Tryjobs launched by LUCI CV that have ended",
		nil,
		field.String("cv_project"),
		field.String("config_group"),
		field.Bool("critical"),
		field.Bool("retry"),
		field.String("status"),
	),
	TryjobBuilderPresence: metric.NewBoolWithOptions(
		"cv/tryjobs/builders/presence",
		&metric.Options{TargetType: ((*bbmetrics.BuilderTarget)(nil)).Type()},
		"Provides a list of configured builders in the Project config",
		nil,
		field.String("cv_project"),
		field.String("config_group"),
		field.Bool("includable_only"),
		field.Bool("path_cond"),
		field.Bool("experimental"),
	),
	RunQuotaRejection: metric.NewCounter(
		"cv/runs/quota/rejected",
		"Count of run rejection",
		nil,
		field.String("project"),
		field.String("config_group"),
		field.String("gerrit_account_id"),
	),
}

Public contains a collection of public LUCI CV metric definitions.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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