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
This adds retry support for submitting metrics. It’s rare, but at scale most users have probably encountered some failures to send metrics (although they might not have noticed it in their logs). Fixes#108.
The basic approach here is to just retry failed requests rather than some more complicated (re-)queuing mechanism. @datadog/datadog-api-client has built-in retry support, but it doesn't handle network errors, so we’ve essentially re-created that retry logic here.
You can configure retries through the `retries` and `retryBackoff` options:
```
metrics.init({
// How many times to retry a railed request.
retries: 3,
// Subsequent retries multiply this by powers of two, so this produces retries after:
// 1 second, 2 seconds, 4 seconds
retryBackoff: 1
});
```
*`appKey`: ⚠️ Deprecated. This does nothing and will be removed in an upcoming
133
135
release.
134
136
@@ -145,6 +147,14 @@ Where `options` is an object and can contain the following:
145
147
same properties as the options object on the `histogram()` method. Options
146
148
specified when calling the method are layered on top of this object.
147
149
(optional)
150
+
*`retries`: How many times to retry failed metric submissions to Datadog’s API.
151
+
* Defaults to `2`.
152
+
* Ignored if you set the `reporter` option.
153
+
*`retryBackoff`: How long to wait before retrying a failed Datadog API call.
154
+
Subsequent retries multiply this delay by 2^(retry count). For example, if
155
+
this is set to `1`, retries will happen after 1, then 2, then 4 seconds.
156
+
* Defaults to `1`.
157
+
* Ignored if you set the `reporter` option.
148
158
*`reporter`: An object that actually sends the buffered metrics. (optional)
149
159
* There are two built-in reporters you can use:
150
160
1. `reporters.DatadogReporter` sends metrics to Datadog’s API, and is
@@ -330,17 +340,23 @@ Contributions are always welcome! For more info on how to contribute or develop
330
340
331
341
**Breaking Changes:**
332
342
333
-
TBD
343
+
* The `DatadogReporter` constructor now takes an options object instead of positional arguments. Using this constructor directly is pretty rare, so this likely doesn’t affect you!
334
344
335
345
**New Features:**
336
346
337
-
*Asynchronous actions now use promises instead of callbacks. In places where `onSuccess` and `onError` callbacks were used, they are now deprecated. Instead, those methods return promises (callbacks still work, but support will be removed in a future release). This affects:
347
+
*Promises: asynchronous actions now use promises instead of callbacks. In places where `onSuccess` and `onError` callbacks were used, they are now deprecated. Instead, those methods return promises (callbacks still work, but support will be removed in a future release). This affects:
338
348
339
349
* The `flush()` method now returns a promise.
340
350
* The `report(series)` method on any custom reporters should now return a promise. For now, datadog-metrics will use the old callback-based behavior if the method signature has callbacks listed after `series` argument.
341
351
352
+
* Retries: flushes to Datadog’s API are now retried automatically. This can help you work around intermittent network issues or rate limits. To adjust retries, use the `retries` and `retryBackoff` options.
353
+
342
354
* Environment variables can now be prefixed with *either*`DATADOG_` or `DD_` (previously, only `DATADOG_` worked) in order to match configuration with the Datadog agent. For example, you can set your API key via `DATADOG_API_KEY` or `DD_API_KEY`.
343
355
356
+
**Deprecations:**
357
+
358
+
* The `appKey` option is no longer supported. Application keys (as opposed to API keys) are not actually needed for sending metrics or distributions to the Datadog API. Including it in your configuration adds no benefits, but risks exposing a sensitive credential.
359
+
344
360
**Bug Fixes:**
345
361
346
362
* Support setting the `site` option via the `DATADOG_SITE` environment variable. The `apiHost` option was renamed to `site` in v0.11.0, but the `DATADOG_API_HOST` environment variable was accidentally left as-is. The old environment variable name is now deprecated, and will be removed at the same time as the `apiHost` option is removed.
@@ -349,8 +365,6 @@ Contributions are always welcome! For more info on how to contribute or develop
349
365
350
366
* Buffer metrics using `Map` instead of a plain object.
351
367
352
-
* Deprecated the `appKey` option. Application keys (as opposed to API keys) are not actually needed for sending metrics or distributions to the Datadog API. Including it in your configuration adds no benefits, but risks exposing a sensitive credential.
0 commit comments