You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+21-1Lines changed: 21 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,8 +5,28 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
7
7
## [Unreleased]
8
+
- Put unreleased items here.
8
9
9
-
- Add unreleased items here.
10
+
## [1.3.0] - 2018-03-19
11
+
12
+
- Add `WithRate(float64)` to the metrics interface and to all clients that implement
13
+
the interface. All metrics calls support sample rates.
14
+
- The `LoggerClient`:
15
+
- Applies the sample rate when printing log messages. If the rate is `0.1` and you call `Incr()` ten times, expect about one message to have been printed out.
16
+
- Displays the sample rate for counts if it is not `1.0`, e.g: `Count foo:0.2 (2 * 0.1) [tag1 tag2]`. This shows the sampled value, the passed value, and the sample rate.
17
+
- Gauges, timings, and histograms will show the sample rate, but he value is left unmodified just like the DataDog implementation.
18
+
- The `RecorderClient`:
19
+
- Records all sample rates for metrics calls in `MetricCall.Rate`. No calls are excluded from the call list based on the sample rate, and the value recorded is the full value before multiplying by the sample rate.
20
+
- Adds a `Rate(float64)` query method to filter by sampled metrics.
- Add`Colorized()` method to `LoggerClient`, and automatically detect a TTY and enable color when `nil` is passed to the `NewLoggerClient` constructor.
The above code would result in `myprefix.requests.count` with a value of `1` showing up in DataDog if you have [`dogstatsd`](https://docs.datadoghq.com/guides/dogstatsd/) running locally and an environment variable `env` set to `prod`, otherwise it will print metrics to standard out. See the [`Client`](https://godoc.org/github.com/istreamlabs/go-metrics/metrics/#Client) interface for a list of available metrics methods.
51
51
52
+
Sometimes you wouldn't want to send a metric every single time a piece of code is executed. This is supported by setting a sample rate:
53
+
54
+
```go
55
+
// Sample rate for high-throughput applications
56
+
client.WithRate(0.01).Incr("requests.count")
57
+
```
58
+
59
+
Sample rates apply to metrics but not events. Any count-type metric (`Incr`, `Decr`, `Count`, and timing/histogram counts) will get multiplied to the full value, while gauges are sent unmodified. For example, when emitting a 10% sampled timing metric that takes an average of `200ms` to DataDog, you would see `1 call * (1/0.1 sample rate) = 10 calls` added to the histogram count while the average value remains `200ms` in the DataDog UI.
60
+
52
61
Also provided are useful clients for testing. For example, the following asserts that a metric with the given name, value, and tag was emitted during a test:
0 commit comments