Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add denylist to stats logger #25118

Closed
wants to merge 1 commit into from

Conversation

villebro
Copy link
Member

SUMMARY

This is an alternative solution to #25104 and a follow-up to #25080 that makes it possible to ignore logging of certain metrics.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@villebro
Copy link
Member Author

Ping @zephyring

@villebro villebro requested review from bkyryliuk and eschutho August 29, 2023 22:23
You can also pass metric names that should be ignored via an optional `metric_denylist` parameter:

```
STATS_LOGGER = StatsdStatsLogger(host='localhost', port=8125, prefix='superset', metric_denylist={"reports.scheduler"})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's better to promote metrics_denylist to be a config that can be overridden.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like

Suggested change
STATS_LOGGER = StatsdStatsLogger(host='localhost', port=8125, prefix='superset', metric_denylist={"reports.scheduler"})
STATS_LOGGER_METRICS_DENYLIST: Set[str] = {}
STATS_LOGGER = StatsdStatsLogger(host='localhost', port=8125, prefix='superset', metrics_denylist=STATS_LOGGER_METRICS_DENYLIST)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't that be the same as just overwriting the STATS_LOGGER with different arguments?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zephyring or @craig-rueda mentioned a good point that there's no guarantee that a metric name might not change. What do you all think about having an enum of strings that we can reference instead? It will have to be maintained and updated of course, but at least then we can export it and refer to the enum in the config rather than the string.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If promoting to be a config, we can just override the config and use the default StatsdStatsLogger logger.
If later on there's any default in the denylist that will be easier to reference and merge/override also

+ f"{value}"
+ Style.RESET_ALL
)
if self.should_log(key):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@villebro so anyone who wants to use this denylist is going to have to implement the functionality in their own statslogger if they don't use the dummy. Should we put something in UPDATING to explain how to do this or do you think it's evident enough when reading this local example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, maybe we should just add it to StatsdStatsLogger, and remove it from BaseStatsLogger. This will cover the vanilla StatsD use case, and should serve as an example for anyone who wants similar functionality in their own custom logger class. Thoughts @eschutho

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that sounds like a good idea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to comments above.
I don't find much value in having the deny list and find def should_log sufficient for filtering and good enough example on how to define a custom logger with filtering.

But that's just a minor preference and current solution is fine by me as well

@rusackas
Copy link
Member

Heya... it seems like this PR hasn't been rebased or touched in quite a while. Do we still want to keep it open?

@villebro
Copy link
Member Author

I'm assuming this is no longer needed, so closing it out.

@villebro villebro closed this Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants