vitess
vitess copied to clipboard
Deprecate old metrics in VTOrc and replace with new ones
Description
This PR deprecates the names for some old metrics and replace with new ones. Since the new metric names and the old metric names resolved to the same snake case name in prometheus, just adding a new metric was causing a panic because of re-registration of a metric with the same name.
This PR resolves this issue by creating 2 new helper functions in stats
package called NewCounterWithDeprecatedName
and NewGaugeWithDeprecatedName
which register metrics with a name and a deprecated name. They only publish one to prometheus (or other registered backend), while still exporting both to expvar.
This allows for us to have both the metrics new and old available on the debug/vars
page. Since the 2 metrics resolve to the same name for prometheus, even when we remove the old metrics, nothing will change there.
Related Issue(s)
Checklist
- [x] "Backport to:" labels have been added if this change should be back-ported to release branches
- [x] If this change is to be back-ported to previous releases, a justification is included in the PR description
- [x] Tests were added or are not required
- [x] Did the new or modified tests pass consistently locally and on CI?
- [x] Documentation was added or is not required