Documentation
¶
Overview ¶
Package metrics declares the performance metrics compared between builds of the autocore workflow engine, and resolves them against Prometheus.
The declaration is data, in manifest.yaml, validated by the buf.validate rules on manifest.proto. Three failure modes seen in prior measurement campaigns are handled structurally rather than per metric: a removed metric silently resolving to null, a saturated histogram reporting a bucket boundary as though it were a latency, and a delta smaller than its instrument's repeatability being reported as a finding.
Index ¶
- Constants
- Variables
- func ShardSkew(perPodPerDB map[string]int, dbCount int) (float64, error)
- type Client
- type Comparison
- type FloorProvenance
- func (*FloorProvenance) Descriptor() ([]byte, []int)deprecated
- func (x *FloorProvenance) GetCampaign() string
- func (x *FloorProvenance) GetGeneratorReplicas() int32
- func (x *FloorProvenance) GetMeasuredAt() string
- func (x *FloorProvenance) GetPoints() int32
- func (x *FloorProvenance) GetProtocol() string
- func (x *FloorProvenance) GetShardsTotal() int32
- func (x *FloorProvenance) GetWindowSeconds() int32
- func (x *FloorProvenance) GetWorkerReplicas() int32
- func (x *FloorProvenance) GetWorkflowDbCount() int32
- func (x *FloorProvenance) GetWorkflowPoolMaxConns() int32
- func (x *FloorProvenance) GetWorkloadConfigSha256() string
- func (*FloorProvenance) ProtoMessage()
- func (x *FloorProvenance) ProtoReflect() protoreflect.Message
- func (x *FloorProvenance) Reset()
- func (x *FloorProvenance) String() string
- type FloorReport
- type Kind
- type Manifest
- func (*Manifest) Descriptor() ([]byte, []int)deprecated
- func (x *Manifest) GetFloorProvenance() *FloorProvenance
- func (x *Manifest) GetMetrics() []*Metric
- func (*Manifest) ProtoMessage()
- func (x *Manifest) ProtoReflect() protoreflect.Message
- func (x *Manifest) Reset()
- func (x *Manifest) String() string
- type Metric
- func (*Metric) Descriptor() ([]byte, []int)deprecated
- func (x *Metric) GetAbsentMeansZero() bool
- func (x *Metric) GetDescription() string
- func (x *Metric) GetKey() string
- func (x *Metric) GetKind() Kind
- func (x *Metric) GetName() string
- func (x *Metric) GetNoiseFloorPct() float64
- func (x *Metric) GetQuantiles() []float64
- func (x *Metric) GetQuery() string
- func (x *Metric) GetStructurallyZero() bool
- func (x *Metric) GetTier() Tier
- func (x *Metric) GetTopFiniteBucket() string
- func (x *Metric) GetUnit() string
- func (x *Metric) GetZeroReason() string
- func (*Metric) ProtoMessage()
- func (x *Metric) ProtoReflect() protoreflect.Message
- func (x *Metric) Reset()
- func (x *Metric) String() string
- type MetricFloor
- type Provenance
- type Result
- type Sample
- type SeriesFloor
- type Shape
- type Tier
- type Value
Constants ¶
const AbsentSeriesNote = "no series matched the query; absence is defined as zero for this metric"
AbsentSeriesNote is recorded on an absent_means_zero metric whose query matched nothing, so that a defined zero stays distinguishable from a measured one in the result file.
const OverflowUnreliableThreshold = 0.05
OverflowUnreliableThreshold is the share of samples in a histogram's +Inf bucket above which its quantiles are not a measurement. Above this, a quantile reads as the last finite boundary rather than as a latency.
Variables ¶
var ( Tier_name = map[int32]string{ 0: "TIER_UNSPECIFIED", 1: "TIER_OUTCOME", 2: "TIER_COST", 3: "TIER_SATURATION", 4: "TIER_LATENCY", 5: "TIER_BACKLOG", 6: "TIER_GATE", } Tier_value = map[string]int32{ "TIER_UNSPECIFIED": 0, "TIER_OUTCOME": 1, "TIER_COST": 2, "TIER_SATURATION": 3, "TIER_LATENCY": 4, "TIER_BACKLOG": 5, "TIER_GATE": 6, } )
Enum value maps for Tier.
var ( Kind_name = map[int32]string{ 0: "KIND_UNSPECIFIED", 1: "KIND_COUNTER", 2: "KIND_GAUGE", 3: "KIND_HISTOGRAM", } Kind_value = map[string]int32{ "KIND_UNSPECIFIED": 0, "KIND_COUNTER": 1, "KIND_GAUGE": 2, "KIND_HISTOGRAM": 3, } )
Enum value maps for Kind.
var File_scripts_loadtests_autoflow_metrics_manifest_proto protoreflect.FileDescriptor
Functions ¶
func ShardSkew ¶
ShardSkew is the largest relative deviation of any pod's per-database shard ownership from an even split across databases. Zero is even.
Keys are "<pod>/<db_id>". Global balance is not enough: rebalance computes one target over all databases, so a pod can own its exact target while holding almost all of it on one database, which moves that pod's pool acquire wait by orders of magnitude.
The map is normally dense. autocore_shards_owned is an observable instrument whose callback runs per pod and database on every scrape and reports its count unconditionally, so a pod owning nothing on a database still has a series, with an explicit zero. The missing-entry branch is therefore defensive: it scores an absent pair at maximum deviation (1.0), which is what an explicit zero already scores, so a map that is sparse for any reason cannot read as balanced.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient builds a Prometheus client. A non-zero evalAt pins every instant query to that instant through the API's time parameter. Without it each query is evaluated at its own wall-clock arrival time, so an increase() over the capture window measures an interval that slides with however long the caller took to issue the query: pod scheduling and image pull alone move it by tens of seconds. SeriesExists is unaffected, because whether a metric is still exported is a question about the retention window rather than about the measurement window.
func (*Client) SeriesExists ¶
SeriesExists reports whether the metric family currently has any series. It is the guard against a renamed or removed metric resolving to null, which is indistinguishable from "the feature is switched off".
type Comparison ¶
type Comparison struct {
Key string `json:"key"`
Labels map[string]string `json:"labels,omitempty"`
Quantile float64 `json:"quantile,omitempty"`
BaseN int `json:"base_n"`
TipN int `json:"tip_n"`
BaseMean float64 `json:"base_mean"`
TipMean float64 `json:"tip_mean"`
BaseSE float64 `json:"base_se"`
TipSE float64 `json:"tip_se"`
DeltaPct float64 `json:"delta_pct"`
SeparationSE float64 `json:"separation_se"`
// The floor this delta was judged against, so a reader of the output can
// see that a metric had none rather than having to know.
NoiseFloorPct float64 `json:"noise_floor_pct"`
// The smallest delta this run could have called, as a percentage of the
// base mean. Without it a null result says nothing about how large an
// effect could have hidden behind the sample size.
MinDetectablePct float64 `json:"min_detectable_pct"`
Resolvable bool `json:"resolvable"`
Note string `json:"note,omitempty"`
}
type FloorProvenance ¶
type FloorProvenance struct {
MeasuredAt string `protobuf:"bytes,1,opt,name=measured_at" json:"measured_at,omitempty"`
Protocol string `protobuf:"bytes,2,opt,name=protocol" json:"protocol,omitempty"`
Campaign string `protobuf:"bytes,3,opt,name=campaign" json:"campaign,omitempty"`
Points int32 `protobuf:"varint,4,opt,name=points" json:"points,omitempty"`
WindowSeconds int32 `protobuf:"varint,5,opt,name=window_seconds" json:"window_seconds,omitempty"`
ShardsTotal int32 `protobuf:"varint,6,opt,name=shards_total" json:"shards_total,omitempty"`
WorkflowDbCount int32 `protobuf:"varint,7,opt,name=workflow_db_count" json:"workflow_db_count,omitempty"`
WorkerReplicas int32 `protobuf:"varint,8,opt,name=worker_replicas" json:"worker_replicas,omitempty"`
GeneratorReplicas int32 `protobuf:"varint,9,opt,name=generator_replicas" json:"generator_replicas,omitempty"`
WorkflowPoolMaxConns int32 `protobuf:"varint,10,opt,name=workflow_pool_max_conns" json:"workflow_pool_max_conns,omitempty"`
WorkloadConfigSha256 string `protobuf:"bytes,11,opt,name=workload_config_sha256" json:"workload_config_sha256,omitempty"`
// contains filtered or unexported fields
}
func (*FloorProvenance) Descriptor
deprecated
func (*FloorProvenance) Descriptor() ([]byte, []int)
Deprecated: Use FloorProvenance.ProtoReflect.Descriptor instead.
func (*FloorProvenance) GetCampaign ¶
func (x *FloorProvenance) GetCampaign() string
func (*FloorProvenance) GetGeneratorReplicas ¶
func (x *FloorProvenance) GetGeneratorReplicas() int32
func (*FloorProvenance) GetMeasuredAt ¶
func (x *FloorProvenance) GetMeasuredAt() string
func (*FloorProvenance) GetPoints ¶
func (x *FloorProvenance) GetPoints() int32
func (*FloorProvenance) GetProtocol ¶
func (x *FloorProvenance) GetProtocol() string
func (*FloorProvenance) GetShardsTotal ¶
func (x *FloorProvenance) GetShardsTotal() int32
func (*FloorProvenance) GetWindowSeconds ¶
func (x *FloorProvenance) GetWindowSeconds() int32
func (*FloorProvenance) GetWorkerReplicas ¶
func (x *FloorProvenance) GetWorkerReplicas() int32
func (*FloorProvenance) GetWorkflowDbCount ¶
func (x *FloorProvenance) GetWorkflowDbCount() int32
func (*FloorProvenance) GetWorkflowPoolMaxConns ¶
func (x *FloorProvenance) GetWorkflowPoolMaxConns() int32
func (*FloorProvenance) GetWorkloadConfigSha256 ¶
func (x *FloorProvenance) GetWorkloadConfigSha256() string
func (*FloorProvenance) ProtoMessage ¶
func (*FloorProvenance) ProtoMessage()
func (*FloorProvenance) ProtoReflect ¶
func (x *FloorProvenance) ProtoReflect() protoreflect.Message
func (*FloorProvenance) Reset ¶
func (x *FloorProvenance) Reset()
func (*FloorProvenance) String ¶
func (x *FloorProvenance) String() string
type FloorReport ¶
type FloorReport struct {
Protocol string `json:"protocol"`
WindowSeconds int `json:"window_seconds"`
Points int `json:"points"`
Shape Shape `json:"shape"`
Metrics []MetricFloor `json:"metrics"`
}
func Floors ¶
func Floors(m *Manifest, results []*Result) (*FloorReport, error)
Floors estimates each metric's repeatability from points captured against a single unchanged build. Rather than reading one delta out of a base arm against a tip arm, it splits the points into two arms every way it can and takes a high quantile of the resulting delta distribution: an A/A campaign of ten points yields 252 splits rather than a single sample of the quantity being estimated.
type Kind ¶
type Kind int32
func (Kind) Descriptor ¶
func (Kind) Descriptor() protoreflect.EnumDescriptor
func (Kind) EnumDescriptor
deprecated
func (Kind) Number ¶
func (x Kind) Number() protoreflect.EnumNumber
func (Kind) Type ¶
func (Kind) Type() protoreflect.EnumType
type Manifest ¶
type Manifest struct {
Metrics []*Metric `protobuf:"bytes,1,rep,name=metrics" json:"metrics,omitempty"`
FloorProvenance *FloorProvenance `protobuf:"bytes,2,opt,name=floor_provenance" json:"floor_provenance,omitempty"`
// contains filtered or unexported fields
}
func (*Manifest) Descriptor
deprecated
func (*Manifest) GetFloorProvenance ¶
func (x *Manifest) GetFloorProvenance() *FloorProvenance
func (*Manifest) GetMetrics ¶
func (*Manifest) ProtoMessage ¶
func (*Manifest) ProtoMessage()
func (*Manifest) ProtoReflect ¶
func (x *Manifest) ProtoReflect() protoreflect.Message
type Metric ¶
type Metric struct {
Key string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
Query string `protobuf:"bytes,3,opt,name=query" json:"query,omitempty"`
Description string `protobuf:"bytes,4,opt,name=description" json:"description,omitempty"`
Tier Tier `protobuf:"varint,5,opt,name=tier,enum=gitlab.agent.loadtest.metrics.Tier" json:"tier,omitempty"`
Kind Kind `protobuf:"varint,6,opt,name=kind,enum=gitlab.agent.loadtest.metrics.Kind" json:"kind,omitempty"`
Unit string `protobuf:"bytes,7,opt,name=unit" json:"unit,omitempty"`
NoiseFloorPct float64 `protobuf:"fixed64,8,opt,name=noise_floor_pct" json:"noise_floor_pct,omitempty"`
Quantiles []float64 `protobuf:"fixed64,9,rep,packed,name=quantiles" json:"quantiles,omitempty"`
TopFiniteBucket string `protobuf:"bytes,10,opt,name=top_finite_bucket" json:"top_finite_bucket,omitempty"`
StructurallyZero bool `protobuf:"varint,11,opt,name=structurally_zero" json:"structurally_zero,omitempty"`
ZeroReason string `protobuf:"bytes,12,opt,name=zero_reason" json:"zero_reason,omitempty"`
AbsentMeansZero bool `protobuf:"varint,13,opt,name=absent_means_zero" json:"absent_means_zero,omitempty"`
// contains filtered or unexported fields
}
func (*Metric) Descriptor
deprecated
func (*Metric) GetAbsentMeansZero ¶
func (*Metric) GetDescription ¶
func (*Metric) GetNoiseFloorPct ¶
func (*Metric) GetQuantiles ¶
func (*Metric) GetStructurallyZero ¶
func (*Metric) GetTopFiniteBucket ¶
func (*Metric) GetZeroReason ¶
func (*Metric) ProtoMessage ¶
func (*Metric) ProtoMessage()
func (*Metric) ProtoReflect ¶
func (x *Metric) ProtoReflect() protoreflect.Message
type MetricFloor ¶
type MetricFloor struct {
Key string `json:"key"`
// The widest of the metric's series, because the manifest carries one floor
// per metric while a comparison reports one row per series. Taking the
// narrowest would publish another series' noise as a finding.
FloorPct float64 `json:"floor_pct"`
Series []SeriesFloor `json:"series"`
}
type Provenance ¶
type Provenance struct {
GitSHA string `json:"git_sha"`
ImageDigest string `json:"image_digest"`
WorkloadConfigSHA256 string `json:"workload_config_sha256"`
ShardsTotal int `json:"shards_total"`
WorkflowDBCount int `json:"workflow_db_count"`
ShardsPerPodPerDB map[string]int `json:"shards_per_pod_per_db"`
ShardSkewRatio float64 `json:"shard_skew_ratio"`
WorkerReplicas int `json:"worker_replicas"`
GeneratorReplicas int `json:"generator_replicas"`
WorkflowPoolMaxConns int `json:"workflow_pool_max_conns"`
ChaosCRCount int `json:"chaos_cr_count"`
CapturedAt time.Time `json:"captured_at"`
}
Provenance is stamped into every captured result.
type Result ¶
type Result struct {
Protocol string `json:"protocol"`
WindowSeconds int `json:"window_seconds"`
Provenance Provenance `json:"provenance"`
Values []Value `json:"values"`
Invalid bool `json:"invalid"`
InvalidReasons []string `json:"invalid_reasons,omitempty"`
BacklogStart float64 `json:"backlog_start"`
BacklogEnd float64 `json:"backlog_end"`
}
type SeriesFloor ¶
type SeriesFloor struct {
Labels map[string]string `json:"labels,omitempty"`
Quantile float64 `json:"quantile,omitempty"`
Points int `json:"points"`
Splits int `json:"splits"`
MedianPct float64 `json:"median_delta_pct"`
FloorPct float64 `json:"floor_delta_pct"`
MaxPct float64 `json:"max_delta_pct"`
}
type Shape ¶
type Shape struct {
ShardsTotal int `json:"shards_total"`
WorkflowDBCount int `json:"workflow_db_count"`
WorkerReplicas int `json:"worker_replicas"`
GeneratorReplicas int `json:"generator_replicas"`
WorkflowPoolMaxConns int `json:"workflow_pool_max_conns"`
WorkloadConfigSHA256 string `json:"workload_config_sha256"`
}
Shape is the part of a point's provenance that a floor is only valid under. It is the same field set the campaign driver compares across a campaign's points, because "these points are comparable with each other" and "this floor applies to these points" are the same question.
type Tier ¶
type Tier int32
func (Tier) Descriptor ¶
func (Tier) Descriptor() protoreflect.EnumDescriptor
func (Tier) EnumDescriptor
deprecated
func (Tier) Number ¶
func (x Tier) Number() protoreflect.EnumNumber
func (Tier) Type ¶
func (Tier) Type() protoreflect.EnumType
type Value ¶
type Value struct {
Key string `json:"key"`
Labels map[string]string `json:"labels,omitempty"`
Value float64 `json:"value"`
Quantile float64 `json:"quantile,omitempty"`
OverflowFraction float64 `json:"overflow_fraction,omitempty"`
Reliable bool `json:"reliable"`
Note string `json:"note,omitempty"`
}