-
Notifications
You must be signed in to change notification settings - Fork 117
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
Report Ruby VM probe metrics as gauges with a hostname tag #866
Conversation
The problem the distribution values is that they will always be the same because we report the metrics at very regular intervals, so the values between mean, 90th percentile and 95 percentile won't be any different as we've seen in the graphs these metrics create.
Call a private method that calls `Appsignal.set_guage` so that if we want to change some defaults in metrics reported by this probe we only have to do it in one place. Like adding a hostname tag.
The added hostname tag allows us to tell multiple hosts from each other and graph them separately. If we do not, an app with multiple hosts would have hosts overwrite one another's metrics. Only the last reported value would be stored and shown. I've copied some of the Sidekiq probe's and Puma plugin to determine the hostname automatically and listen to the AppSignal config in case a hostname was configured.
We've noticed that distributions are not a good fit for this. For more PR appsignal/appsignal-ruby#866 on the Ruby gem.
key, value, tags = distribution_value | ||
next unless key == expected_key | ||
next unless expected_value ? expected_value == value : !value.nil? | ||
next unless tags == expected_tags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next unless ...
? Shouldn't this be return false unless ...
?
I suppose it doesn't make a difference -- next gives nil
, which is falsy anyway. I've never seen it used this way before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you call return
the loop will exit and no other values will be checked. If you want it to exit out of that loop iteration with false
you need to call next false if ...
which is the same as next if ...
for this because nil
is falsy like you say.
Change all Ruby VM distributions to gauges
The problem the distribution values is that they will always be the same
because we report the metrics at very regular intervals, so the values
between mean, 90th percentile and 95 percentile won't be any different
as we've seen in the graphs these metrics create.
Refactor gauge calls to helper method in MRI probe
Call a private method that calls
Appsignal.set_guage
so that if wewant to change some defaults in metrics reported by this probe we only
have to do it in one place. Like adding a hostname tag.
Report hostname tag for Ruby VM probe metrics
The added hostname tag allows us to tell multiple hosts from each other
and graph them separately. If we do not, an app with multiple hosts
would have hosts overwrite one another's metrics. Only the last reported
value would be stored and shown.
I've copied some of the Sidekiq probe's and Puma plugin to determine the
hostname automatically and listen to the AppSignal config in case a
hostname was configured.