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

replace statsd with prometheus client #6897

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AndrewChubatiuk
Copy link
Collaborator

What type of PR is this?

currently there's only one option to expose metrics - statsd client, which doesn't support custom metric name -> value separator
added metrics endpoint and ability to enable statsd output using prometheus-client

  • Refactor
  • Feature
  • Bug Fix
  • New Query Runner (Data Source)
  • New Alert Destination
  • Other

Description

How is this tested?

  • Unit tests (pytest, jest)
  • E2E Tests (Cypress)
  • Manually
  • N/A

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

@justinclift
Copy link
Member

I don't personally use either statsd nor Prometheus, so I don't have strong feelings with way. 😄

@getredash/maintainers What do you reckon?

@AndrewChubatiuk
Copy link
Collaborator Author

AndrewChubatiuk commented Apr 16, 2024

I don't personally use either statsd nor Prometheus, so I don't have strong feelings with way. 😄

@getredash/maintainers What do you reckon?

cannot use this statsd library with victoriametrics. it has hardcoded colon as a separator, which is not configurable and looks like library is not well maintained
anyway, i do not remove statsd support, just adding prometheus by default and making statsd optional

@lucasfcnunes lucasfcnunes changed the title replaced statsd with prometheus client replace statsd with prometheus client Apr 19, 2024
@AndrewChubatiuk AndrewChubatiuk force-pushed the prometheus-endpoint branch 4 times, most recently from 2881606 to ec4b4cc Compare April 19, 2024 19:59
@vtatarin
Copy link

vtatarin commented Apr 19, 2024

Thank you for refactoring Job serializer and Athena config as well! This is a huge improvement, would love to see this merged!

cc @justinclift

@justinclift
Copy link
Member

Uh oh, this is a very large PR. 😦

Can it be broken up into smaller pieces that each individually work by themselves (aka not break things)?

That would make the review process be far more likely to go ok. 😉

@wlach
Copy link
Contributor

wlach commented Apr 20, 2024

Uh oh, this is a very large PR. 😦

Can it be broken up into smaller pieces that each individually work by themselves (aka not break things)?

That would make the review process be far more likely to go ok. 😉

I agree, it's difficult to give something this large a proper review to as-is. Even if everything in this PR is related to this feature (I'm not sure?), it looks at a glance like some changes (e.g. the frontend changes) could be landed seperately.

There's a number of tools that can be used to support a stacking workflow online: https://stacking.dev/stacking-site

@AndrewChubatiuk
Copy link
Collaborator Author

AndrewChubatiuk commented Apr 21, 2024

@wlach @justinclift
divided all effort into PRs
#6897
#6913
#6914
#6912

@justinclift
Copy link
Member

@AndrewChubatiuk Cool, that seems like a good start. 😄

@gaecoli gaecoli removed their request for review April 22, 2024 07:40
@AndrewChubatiuk
Copy link
Collaborator Author

@wlach @eradman could you please review?

Copy link
Contributor

@wlach wlach left a comment

Choose a reason for hiding this comment

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

I took a pass at this. This mostly looks reasonable to me, except for maybe adding a gotcha about statsd no longer being unconditionally enabled -- do we need to update any documentation or release notes?

I'm a little hestitant to hit the approve button just because I'm not super familiar with statsd or prometheus in the context of redash. I'd rather leave that to @eradman or someone else who has more domain context.

@@ -22,9 +22,11 @@
REDIS_URL = add_decode_responses_to_redis_url(_REDIS_URL)
PROXIES_COUNT = int(os.environ.get("REDASH_PROXIES_COUNT", "1"))

STATSD_ENABLED = parse_boolean(os.environ.get("REDASH_STATSD_ENABLED", "false"))
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like STATSD was always unconditionally enabled before? Do we need to update the documentation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it makes no sense to enable statsd by default if it has no remote endpoint configured

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

statsd uses push model, and prometheus - pull. for statsd you should specify remote url to push metrics to and prometheus exposes metrics at configured endpoint

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, makes sense!

self.factory.create_query()
timing.assert_called_with("db.changes.insert", ANY)
observe.assert_called_with(ANY)
Copy link
Contributor

Choose a reason for hiding this comment

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

Feels like we're not testing as much as we were before here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

interface has changed and observe function calculates histograms and expect time at the input. we cannot predict the time it takes to run a function, so ANY value was set here. regarding metric name, it should not be passed anymore as it's initialized in a different manner from statsd python client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants