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: README.md
+18-2Lines changed: 18 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -187,13 +187,29 @@ Requirements:
187
187
188
188
Examples:
189
189
190
-
```py
190
+
```js
191
191
setNamespace("MyApplication");
192
192
```
193
193
194
+
-**setTimestamp**(Date | number timestamp)
195
+
196
+
Sets the CloudWatch [timestamp](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#about_timestamp) that extracted metrics are associated with. If not set a default value of `new Date()` will be used.
197
+
198
+
If set for a given `MetricsLogger`, timestamp will be preserved across calls to flush().
199
+
200
+
Requirements:
201
+
* Date or Unix epoch millis, up to two weeks in the past and up to two hours in the future, as enforced by [CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#about_timestamp).
202
+
203
+
Examples:
204
+
205
+
```js
206
+
setTimestamp(newDate())
207
+
setTimestamp(newDate().getTime())
208
+
```
209
+
194
210
-**flush**()
195
211
196
-
Flushes the current MetricsContext to the configured sink and resets all properties, dimensions and metric values. The namespace and default dimensions will be preserved across flushes.
212
+
Flushes the current MetricsContext to the configured sink and resets all properties, dimensions and metric values. The namespace and default dimensions will be preserved across flushes. Timestamp will be preserved if set explicitly via `setTimestamp()`.
0 commit comments