-
Notifications
You must be signed in to change notification settings - Fork 306
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
Feature request: configure underlying metric used by statsd.timer
#563
Comments
Happy to open a PR and QA on our end if this is something you're interested in! |
doing a quick local qa of this here: seatgeek@87d3c86 |
@zhammer I think the best approach would be just to create a new decorator that calls statsd.distribution, would that work? |
Hi @zhammer, I agree that the feature would be very useful. First of, to answer your question about For the implementation we're always happy to receive PR. I agree with @jbarciauskas that a new decorator might be better. Any reason/use case where you might want to switch an entire application from histogram to distribution instead of choosing per |
Thanks for your contribution! This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community. If you would like this issue to remain open:
|
Hi @zhammer - is this something you're still interested in? |
Hey @jbarciauskas! This is definitely still something our team is interested in. I've been a bit busy with some other work and forgot to respond. @hush-hush - that is a very helpful description, thank you :) also, cool to see where that is actually happening in the agent code.
Choosing per TIMER call seems good to me. I realize that even to migrate from using histogram to distribution timers in our apps, we may want to migrate specific timers/metrics in phases, so one global toggle for distribution vs. histogram would be tough. The only pros of using a global toggle I can think of would be:
Happy to work on a PR, but this work is a bit lower priority at the moment so it could be some time until I have a PR to share. |
Also very much interested in this. 🤓 I agree a specific decorator could work just fine (e.g.,
|
First step will be a new decorator and then we can work on a global switch. Right now I'm quite busy on other project but will come back to this as soon as I can (I'll create a card in our backlog to keep track of this). If this is a urgent matter I would be more than happy to review a PR ! |
A decorator or context manager that will measure the distribution of a function's/context's run time using custom metric DISTRIBUTION. E.g. of usage follows: @statsd.distributed('user.query.time', sample_rate=0.5) def get_user(user_id): # Do what you need to ... pass # Is equivalent to ... with statsd.distributed('user.query.time', sample_rate=0.5): # Do what you need to ... pass # Is equivalent to ... start = time.time() try: get_user(user_id) finally: statsd.distribution('user.query.time', time.time() - start) Closes DataDog#563
Opened PR #581. |
A decorator or context manager that will measure the distribution of a function's/context's run time using custom metric DISTRIBUTION. E.g. of usage follows: @statsd.distributed('user.query.time', sample_rate=0.5) def get_user(user_id): # Do what you need to ... pass # Is equivalent to ... with statsd.distributed('user.query.time', sample_rate=0.5): # Do what you need to ... pass # Is equivalent to ... start = time.time() try: get_user(user_id) finally: statsd.distribution('user.query.time', time.time() - start) Closes DataDog#563
A decorator or context manager that will measure the distribution of a function's/context's run time using custom metric DISTRIBUTION. E.g. of usage follows: @statsd.distributed('user.query.time', sample_rate=0.5) def get_user(user_id): # Do what you need to ... pass # Is equivalent to ... with statsd.distributed('user.query.time', sample_rate=0.5): # Do what you need to ... pass # Is equivalent to ... start = time.time() try: get_user(user_id) finally: statsd.distribution('user.query.time', time.time() - start) Closes DataDog#563
Hey datadog team! I'm curious what y'all think of making it so that folks can configure the underlying metruc used by
statsd.timer
. I just got off a call with our org's datadog reps and it seems that usingdistribution
instead ofhistogram
metrics for timers would be better for our orgs use cases.The changes needed seem fairly straightforward: the desired metric could be passed into
DogStatsd
->TimedContextManagerDecorator
and then used to configure the metricTiemContextManagerDecorator
uses to emit the timer stats:datadogpy/datadog/dogstatsd/context.py
Line 75 in 0cb3794
Also on a related note, I'm a little confused that
TimedContextManagerDecorator
emits aself.statsd.timing
rather thanself.statsd.histogram
as suggested by the docsThe text was updated successfully, but these errors were encountered: