Merged
Conversation
added 27 commits
February 15, 2017 19:26
…re about it (gives ~15% perf improvement)
Merged
Contributor
What do you think about
💥 That's wayyyy nicer :) |
Contributor
Author
|
I'm good with |
Contributor
sgtm! |
tysonmote
approved these changes
Feb 23, 2017
Contributor
tysonmote
left a comment
There was a problem hiding this comment.
I didn't do a full deep dive on all the changes because it's such a large change, but on a cursory read-through this looks great!
| // Creates a new datadog client reporting the state of the default stats | ||
| // engine to localhost:8125. | ||
| dd := datadog.NewDefaultClient() | ||
| // Creates a new datadog client publishing emtrics to localhost:8125 |
Contributor
|
Ping me when |
Contributor
Author
|
Thanks for the review guys! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey guys, I'd like to introduce some breaking changes here, mainly to make the code easier to use, but also to simplify the design so the package is easier to test.
Changes
The
stats.Enginetype is now much simpler, instead of being a metrics aggregator with its own goroutine it's just carrying the context to produce metrics (namespace + tags + handlers).Functions like
httpstats.NewHandlerwhere receiving astats.Engineas first argument, which in practice was alwaysnilbecause using the default engine is good enough. They've been refactored like this:stats.Enginecan now be cloned to inherit the tags that were set on it and add new ones, this was a missing feature that Prateek pointed out to me, for example:The new design allows for zero memory allocations when publishing stats, thanks to a simpler architecture and the use of memory pools for the two objects that need dynamic memory allocations (
stats.Metricand the buffer where it's serialized on the datadog client).Thanks to the zero-allocation we're seeing great perf improvements, it takes ~600ns to publish a metric to the datadog client.
The buffer size of the datadog client has been adjusted so it doesn't overflow the agent, despite what they say that 8KB buffer size was added just recently, historically the agent has used a 1KB buffer.
I got rid of the in-process aggregation because the heavy use of tags greatly reduces the opportunities for merging metrics. This can be reintroduced later on within the datadog client.
Also a bunch more stuff like fixing docs, better name consistency, cleaner implementations, better defaults, more tests...
Upgrade
In most cases the work required to move to this new version is:
to
to
Please take a look and let me know what your thoughts are, also if you have any ideas to contribute this is the time!