-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[haproxy] Fix
KeyError
when an unknown status is found (#2681)
* [haproxy] Fix `KeyError` when an unknown status is found An unknown status (i.e. one that's not listed in `Services.ALL_STATUSES`) would make the check fail with a `KeyError` because that status wasn't in the initialized `dict` of statuses. The check now sends unknown statuses as: * an `UNAVAILABLE` status if `collate_status_tags_per_host` is enabled, in order to keep the number of contexts low * the unknown status as-is if `collate_status_tags_per_host` is left disabled, in order to give maximum visibility in the actual statuses This commit also improves the parsing of status suffixes: * Introduce normalization of statuses to regard `UP`, `UP 1/2`, and `UP (agent)` statuses as the same `up` status. This fixes a regression. * Use the same logic for the `haproxy.backend_hosts` metric See related documentation (thanks @alexism for the links): https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#9.1 : `17. status [LFBS]: status (UP/DOWN/NOLB/MAINT/MAINT(via)...)` More precisely, the haproxy code shows that 2 suffixes might be used: ` %d/%d` and ` (agent)` https://github.com/haproxy/haproxy/blob/a5de024d42c4113fc6e189ea1d0ba6335219e151/src/dumpstats.c#L4117-L4129 Misc: * move the remaining mock test in `integration/` to `mock/`
- Loading branch information
1 parent
bba3833
commit 9640c1d
Showing
3 changed files
with
133 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.