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.
This PR adds support for InfluxDB to the stats package. The intent here is to have a InfluxDB client so I can start experimenting with it without having to rewrite any instrumentation code.
The client API is very similar to the one for datadog, basically:
I spent a bit of time profiling and optimizing the code, basically I was thinking of taking two different approaches to manage the batches of metrics:
I ended going for the first solution because it was the most time-efficient implementation (~200ns per metric), however it requires sorting the tags when handling the metrics, which is on the hot path here... if sorting ends up being a bottleneck we can revisit and see if we can optimize the second approach.
The implementation also is fully wait-free, it uses atomic operations to synchronize concurrent operations on shared resources, this prevents having a high contention point if we were using a mutex in HandleMetrics.
Please take a look and let me know if you'd like to see anything changed.