Tags: zirain/gostats
Tags
introduce MilliTimer functions (lyft#131) This provides an API so that we can move away from microsecond-based timers. The StatsD spec suggests using milliseconds, and they're a great fit for the typical RPCs we are measuring. Most RPCs take about 1-1000ms, which makes it easy for a human to spot and tell the difference vs. microseconds which would be 1000us-1000000us. We don't need that amount of fidelity. Consumers can continue using NewTimer, using microseconds, which might be appropriate for other use cases like timing functions or tight in-memory queues. But most new callers should move toward MilliTimer functions.
Retry failed writes once (lyft#120) Introduce a retry channel, giving buffers one more chance to be successfully flushed before they're dropped. This is intended to improve handling the case where the underlying connection is intermittently closed, but the destination sink is otherwise generally healthy.
tags: move tags logic to internal pkg and add ParseTags() and Seriali… …zeTags() helpers (lyft#103) Move all tags logic to the internal/tags package and add the SerializeTags() and ParseTags() helper functions to the mock package. Moving the tags logic was required to make it accessible by the mock package. This commit also increases a bit and adds some examples to the mock package.
tags: change serializeTags to never modify the tags map (lyft#101) This changes serializeTags() to not delete entries from the provided tags map when keys/values are invalid. This prevents a race condition when users pass the same tags map with invalid entries to NewCounterWithTags, NewGaugeWithTags, or NewTimerWithTags.
mock: add Counters, Gauges and Timers methods to get a map of all sta… …ts (lyft#90) * mock: Sink replace mutex with atomic.Value This improves Sink performance when called in parallel. ``` benchmark old ns/op new ns/op delta BenchmarkFlushCounter-12 50.4 51.9 +2.98% BenchmarkFlushCounter_Parallel-12 36.5 10.5 -71.23% BenchmarkFlushTimer-12 52.1 49.8 -4.41% BenchmarkFlushTimer_Parallel-12 42.0 13.5 -67.86% benchmark old allocs new allocs delta BenchmarkFlushCounter-12 0 0 +0.00% BenchmarkFlushCounter_Parallel-12 0 0 +0.00% BenchmarkFlushTimer-12 0 0 +0.00% BenchmarkFlushTimer_Parallel-12 0 0 +0.00% benchmark old bytes new bytes delta BenchmarkFlushCounter-12 0 0 +0.00% BenchmarkFlushCounter_Parallel-12 0 0 +0.00% BenchmarkFlushTimer-12 0 0 +0.00% BenchmarkFlushTimer_Parallel-12 0 0 +0.00% ``` * mock: add Counters, Gauges and Timers methods to get a map of all stats This PR also increases test coverage.
subScope: use a slice of tags instead of a map (lyft#97) * subScope: use a slice of tags instead of a map This commit changes the subScope to keep a slice of tags instead of a map. This means that we no longer modify or "own" the map we're passed, which has been a source of bugs recently (that gostats owns any map passed to it was poorly, if at all, documented). This change also improves performance by 2x and reduces memory usage and GC pressure as each subScope will no longer be holding a map (which is sparse and the GC must scan). This change also moves us closer to passing tags via a slice (instead of a map) which is a change that I intend to make part of the V1 release (assuming I ever get around to that). ``` benchmark old ns/op new ns/op delta BenchmarkStore_ScopeWithTags-12 1321 646 -51.10% BenchmarkStore_ScopeNoTags-12 583 179 -69.30% benchmark old allocs new allocs delta BenchmarkStore_ScopeWithTags-12 4 3 -25.00% BenchmarkStore_ScopeNoTags-12 4 2 -50.00% benchmark old bytes new bytes delta BenchmarkStore_ScopeWithTags-12 544 512 -5.88% BenchmarkStore_ScopeNoTags-12 304 112 -63.16% ``` * Update tags.go Co-authored-by: Max R <[email protected]> * stats_test: code review comments * tags_test: benchmark tagSet.Search * tags: rename CompareAndSwap => cas and document network sort * tags: save alloc in replaceChars Co-authored-by: Max R <[email protected]>
Add setting for disabling logging sink (lyft#94) * Add setting for disabling logging sink * Default to current behavior * Update settings.go Co-Authored-By: Charlie Vieth <[email protected]> Co-authored-by: Charlie Vieth <[email protected]>
Add UDP as a sink protocol (lyft#95) * sink: add UDP support This commit adds support for UDP statsd sinks with the STATSD_PROTOCOL environment variable and the WithStatsdProtocol() SinkOption. * tests: don't run TestHTTPHandler_WrapResponse in parallel This test is incredibly fast so doesn't need to run in parallel and I'm trying to reduce the number of goroutines we have in flight at any time during out tests.
PreviousNext