metrics: instantiate replication metrics with 0 values
The replication metrics, specifically:
- gitaly_praefect_replication_delay
- gitaly_praefect_replication_latency
are of type HistogramVec, this means the metric is observed against a
{labelName, labelValue} pair[s]. While the label name in our scenario is
fixed to be type
, the labelValue is more dynamic and depends on the
replication job state.
Due to the dynamic-ness of labelValues, HistogramVec (or any *Vec) metrics do not hold a default starting value. This is generally okay, since metrics would be observed anyways. But in the case of replication metrics, unless there is a replication event, there is no observation. So in otherwise what is a positive scenario, the lack of metrics could be a bit-confusing.
To prevent this, during instantiation we call GetMetricWithLabelValues
with the various replication ChangeTypes to set a 0 value for those
labelValues.
Closes #4545 (closed)