-
Notifications
You must be signed in to change notification settings - Fork 96
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
Add statsd event & service checks #109
Conversation
a23d65d
to
8c729d8
Compare
Yes; we have too many users of this gem and I don't want to spend time updating all of them. I also don't find this a good enough reason to break backwards compatibility. Also, can you run some benchmarks to see if this refactor has any impact on the performance of the hot code paths? |
@@ -3,21 +3,108 @@ | |||
module StatsD::Instrument::Backends | |||
class UDPBackend < StatsD::Instrument::Backend | |||
|
|||
class DatadogStatsDProtocol |
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.
You can call it DogStatsDProtocol
, which matches Datadog's naming.
|
||
def initialize(server = nil, implementation = nil) | ||
super() | ||
self.server = server || "localhost:8125" | ||
self.implementation = (implementation || DEFAULT_IMPLEMENTATION).to_sym | ||
end | ||
|
||
def implementation=(value) | ||
@packet_factory = | ||
case value |
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.
Nitpick: I prefer the case
to be after the =
sign.
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 can show that this doesn't impact hot path performance, and is backwards compatible, 🚢
@wvanbergen |
Its primarily sending a metric. You can measure it using benchmark-ips, and compare before and after. |
Warming up --------------------------------------
Warming up -------------------------------------- |
@wvanbergen I carried out some benchmarking tests and posted the results above. Performance on hot code paths was affected by 16%. I don't think this is too much of a concern. What are your thoughts? |
Is the refactor necessary to add the new features? I assume it's the additional indirection that is costing us some performance. |
I'm pretty curious about this 16% increase. I assume the method dispatch is more costly than I assumed it would :( |
Created a new PR that adds the same functionality without the refactoring, and benchmarked the changes (https://github.com/Shopify/statsd-instrument/pull/122/files). The performance hit increased to a value of 42%. We asked on #core-cloud-migration and they didn’t veto the 16% performance hit. I'll merge the changes (approval by Willem). |
fix performance regression from PR #109
Fixes #89
This exposes 2 datadog specific metric types: event and service checks.
Few questions before I proceed with this:
Do we mind keeping
UdpBackend.new("localhost:1234", :datadog)
? Because I would change this public api to expose directly the protocol supported. E.g.This way, it's easier to define what a specific implementation can and can't do.
@wvanbergen WDYT?