You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: FmtLabels impls use exhaustive bindings (#3988)
this is based on #3987.
in #3987 (_see https://github.com/linkerd/linkerd2/issues/13821_) we discovered that some of the types that implement [`FmtLabels`](https://github.com/linkerd/linkerd2-proxy/blob/085be9978d437800a1a8ff0c2457b9bb9712a166/linkerd/metrics/src/fmt.rs#L5) could collide when used in registry keys; i.e., they might emit identical label sets, but distinct `Hash` values.
#3987 solves two bugs. this pull request proposes a follow-on change, introducing _exhaustive_ bindings to implementations of `FmtLabels`, to prevent this category of bug from reoccurring again in the future.
this change means that the introduction of an additional field to any of these label structures, e.g. `OutboundEndpointLabels` or `HTTPLocalRateLimitLabels`, will cause a compilation error unless said new field is handled in the corresponding `FmtLabels` implementation.
### 🔖 a note
in writing this pull request, i noticed one label that i believe is unintentionally being elided. i've refrained from changing behavior in this pull request. i do note it though, as an example of this syntax identifying the category of bug i hope to hedge against here.
---
* fix: do not key transport metrics registry on `ClientTls`
Signed-off-by: katelyn martin <[email protected]>
* fix: do not key transport metrics registry on `ServerTls`
Signed-off-by: katelyn martin <[email protected]>
* refactor(transport-metrics): exhaustive `Eos: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `ServerLabels: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `TlsAccept: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `TargetAddr: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(metrics): exhaustive `Label: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(http/metrics): exhaustive `Status: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `ControlLabels: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `ProfileRouteLabels: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `InboundEndpointLabels: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `ServerLabel: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `ServerAuthzLabels: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `RouteLabels: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `RouteAuthzLabels: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `OutboundEndpointLabels: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `Authority: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/core): exhaustive `StackLabels: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/inbound): exhaustive `HTTPLocalRateLimitLabels: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* refactor(app/inbound): exhaustive `Key<L>: FmtLabels`
Signed-off-by: katelyn martin <[email protected]>
* nit(metrics): remove redundant banner comment
these impl blocks are all `FmtLabels`, following another series of the
same, above. we don't need another one of these comments.
Signed-off-by: katelyn martin <[email protected]>
* nit(metrics): exhaustive `AndThen: FmtMetrics`
Signed-off-by: katelyn martin <[email protected]>
* nit(app/core): note unused label
see #3262 (618838e), which introduced this label.
to preserve behavior, this label remains unused.
X-Ref: #3262
Signed-off-by: katelyn martin <[email protected]>
---------
Signed-off-by: katelyn martin <[email protected]>
0 commit comments