Skip to content

HTTP health check filter depends on stats #14610

Open

Description

@baojr

Title: HTTP health check filter depends on stats

Description:
The HTTP health check filter relies on the presence of the following stats: membership_total, membership_healthy, and membership_degraded. Running a configuration that filters out these stats will cause the filter to not work properly. Like #9856, this falls into the category of using stats for control flow.

Activity

  1. added
    triage
    on Jan 8, 2021
  2. added
    help wanted
    and removed
    triage
    on Jan 8, 2021
  3. mattklein123 commented on Jan 8, 2021

    @mattklein123
    Member

    cc @jmarantz another one of these. If you are looking for another slog project this general topic would be a good one to go after. :)

  4. jmarantz commented on Jan 9, 2021

    @jmarantz
    Contributor

    Heh. I don't think this is much of a slog; it's just a question of whether we think it's worthwhile to pursue #14120 .

  5. mattklein123 commented on Jan 10, 2021

    @mattklein123
    Member

    Heh. I don't think this is much of a slog; it's just a question of whether we think it's worthwhile to pursue #14120 .

    I'm of too minds. On one hand, it seems like a reasonable workaround to this problem, but it's also still playing whack a mole. I'm not sure what the best solution here is tbh.

  6. jmarantz commented on Jan 11, 2021

    @jmarantz
    Contributor

    One other that I just thought of is to add pattern-based overrides into the matcher system. This has the advantage that the complexity stays purely in the stats-matcher infrastructure, rather than bleeding into the API.

    One disadvantage of that is that the patterns might be a little imprecise and potentially force-enable unrelated stats. But enabling a few extra stats might not catastrophic.

    Arguably a fatal disadvantage is that it centralizes the enumeration of stats that must be force-enabled, as the stats-matcher object may not be accessible to every subsystem or extension that needs to force-enable a stat.

    So IMO #14120 seems more maintainable than that.

    Maybe the simplest option is to just disallow this scenario with doc, and wherever we have code that relies on a stat for functionality, we just add a parallel atomic, even though there's some duplication that way.

  7. jmarantz commented on Jan 11, 2021

    @jmarantz
    Contributor

    I thought of another option, which would be a lot of toil to implement, but might be easier to maintain: to disallow reading the value() of a stat from production code.

    There are a few hurdles to doing this:

    • legit uses of reading value() from stats in production, such as in the implementation of stats sinks and the admin console, where it's expected behavior for those to just return 0 if the stats were disallowed
    • many many tests that call value().

    There are a few possible solutions to dealing with this that involve changing a lot of code. The first I thought of is:

    1. Make value() be protected in the stats classes, and use friend to allow admin/stats-sink access
    2. Add a method valueForTest to counters/gauges/text-readout which is public, but use lint to avoid calling that from production code

    This is a bit of toil because it involves changing a huge number of lines of unit tests, and that. will may make future backports fail, adding further toil. But maybe that's the best long term solution.

    A variant on that is to use a testing peer class for looking at stats in tests, rather than having a specially-named method. That avoids relying on lint, but involves slightly more toil in doing the conversion.

  8. mattklein123 commented on Jan 11, 2021

    @mattklein123
    Member

    So I agree ^ is probably the correct solution, as it would actually fix the problem for real versus still having to play whack a mole all the time. I'm not sure if it's worth the effort vs. just fixing issues as the come up.

    WDYT?

  9. jmarantz commented on Sep 10, 2021

    @jmarantz
    Contributor

    @yanavlasov FYI -- this would be a good candidate for someone to build up some clang skills with.

  10. self-assigned this
    on Sep 17, 2021
  11. jmarantz commented on Apr 28, 2022

    @jmarantz
    Contributor

    @krajshiva FYI -- this was the bug I was talking about where we might be able to save a lot of toil if we build some clang skills.

  12. jmarantz commented on Mar 4, 2023

    @jmarantz
    Contributor

    @stevenzzzz note that #23921 adds a new instance of the anti-pattern of reading a stat value from production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions