Skip to content

Commit 7510193

Browse files
authored
Merge pull request kubernetes#1358 from RainbowMango/pr_ship_stability_framework
Update KEP(metrics stability) about the escape hatch flag
2 parents e62401d + e81e67c commit 7510193

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

keps/sig-instrumentation/20190404-kubernetes-control-plane-metrics-stability.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ approvers:
2020
- "@x13n"
2121
editor: "@brancz"
2222
creation-date: 2019-04-04
23-
last-updated: 2019-06-05
23+
last-updated: 2019-11-06
2424
status: implementable
2525
see-also:
2626
- 20181106-kubernetes-metrics-overhaul
@@ -43,6 +43,8 @@ see-also:
4343
- [Stability Classes](#stability-classes)
4444
- [API Review](#api-review)
4545
- [Deprecation Lifecycle](#deprecation-lifecycle)
46+
- [Show Hidden Metrics](#show-hidden-metrics)
47+
- [Why Not Bool Flag](#why-not-bool-flag)
4648
- [Design Details](#design-details)
4749
- [Test Plan](#test-plan)
4850
- [Graduation Criteria](#graduation-criteria)
@@ -260,7 +262,40 @@ some_counter 0
260262
```
261263
Like their stable metric counterparts, deprecated metrics will be automatically registered to the metrics endpoint.
262264

263-
On a subsequent release (when the metric's deprecatedVersion is equal to current_kubernetes_version - 1)), a deprecated metric will become a __hidden metric__. _Unlike_ their deprecated counterparts, hidden metrics will __*no longer be automatically registered*__ to the metrics endpoint (hence hidden). However, they can be explicitly enabled through a command line flag on the binary (i.e. '--enable-hidden-metrics=really_deprecated_metric'). This is to provide cluster admins an escape hatch to properly migrate off of a deprecated metric, if they were not able to react to the earlier deprecation warnings. Hidden metrics should be deleted after one release.
265+
On a subsequent release (when the metric's deprecatedVersion is equal to current_kubernetes_version - 1)), a deprecated metric will become a __hidden metric__. _Unlike_ their deprecated counterparts, hidden metrics will __*no longer be automatically registered*__ to the metrics endpoint (hence hidden). However, they can be explicitly enabled through a command line flag on the binary (i.e. '--show-hidden-metrics-for-version=<previous minor release>'). This is to provide cluster admins an escape hatch to properly migrate off of a deprecated metric, if they were not able to react to the earlier deprecation warnings. Hidden metrics should be deleted after one release.
266+
267+
### Show Hidden Metrics
268+
As described above, admins can enable hidden metrics through a command-line flag on a specific binary.
269+
This intends to be used as an escape hatch for admins if they missed the migration of the metrics deprecated in the last release.
270+
271+
The flag `show-hidden-metrics-for-version` takes a version for which you want to show metrics deprecated in that release.
272+
The version is expressed as __x.y__, where __x__ is the major version, __y__ is the minor version.
273+
The patch version is not needed even though a metrics can be deprecated in a patch release, the reason for that is
274+
the metrics deprecation policy runs against the minor release.
275+
276+
The flag can only take the previous minor version as it's value.
277+
All metrics hidden in previous will be emitted if admins set the previous version to `show-hidden-metrics-for-version`.
278+
The too old version is not allowed because this violates the metrics deprecated policy.
279+
280+
Take metric `A` as an example, here assumed that `A` is deprecated in `1.n`.
281+
According to metrics deprecated policy, we can reach the following conclusion:
282+
- In release `1.n`, the metric is deprecated, and it can be emitted by default.
283+
- In release `1.n+1`, the metric is hidden by default and it can be emitted by command line `show-hidden-metrics-for-version=1.n`.
284+
- In release `1.n+2`, the metric should be removed from the codebase. No escape hatch anymore.
285+
286+
So, if admins want to enable metric `A` in release `1.n+1`, they should set `1.n` to the command line flag.
287+
That is `show-hidden-metrics=1.n`.
288+
289+
### Why Not Bool Flag
290+
Alternatively, another solution which was previously suggested(refer to the discussion on [PR](https://github.com/kubernetes/kubernetes/pull/84292))
291+
was provide a bool flag-like `show-hidden-metrics`. That works like:
292+
- `show-hidden-metrics=true`: enable all hidden metrics deprecated in a previous minor version.
293+
- `show-hidden-metrics=false`: the default value, do nothing.
294+
295+
This proposal has a side effect(thanks for @lavalamp pointed it out) in the scenario:
296+
1. in version X, turn this on to get back deprecated metric M
297+
2. in version Y, not turn this off, and therefore fail to notice metric N is being deprecated
298+
3. in version Z, metric N is removed with (effectively) no warning
264299

265300
## Design Details
266301

0 commit comments

Comments
 (0)