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
Adds a new metric to the current logger context. Multiple metrics using the same key will be appended to an array of values. The Embedded Metric Format supports a maxumum of 100 metrics per key.
164
+
165
+
Metrics must meet CloudWatch Metrics requirements, otherwise a `InvalidMetricException` will be thrown. See [MetricDatum](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html) for valid values.
Adds or updates the value for a given property on this context. This value is not submitted to CloudWatch Metrics but is searchable by CloudWatch Logs Insights. This is useful for contextual and potentially high-cardinality data that is not appropriate for CloudWatch Metrics dimensions.
Adds a new set of dimensions that will be associated with all metric values.
194
+
195
+
**WARNING**: Each dimension set will result in a new CloudWatch metric (even dimension sets with the same values).
196
+
If the cardinality of a particular value is expected to be high, you should consider
197
+
using `setProperty` instead.
198
+
199
+
Dimensions must meet CloudWatch Dimensions requirements, otherwise a `InvalidDimensionException` will be thrown. See [Dimensions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_Dimension.html) for valid values.
Explicitly override all dimensions. This will remove the default dimensions unless `useDefault` is set to true.
214
+
215
+
**WARNING**:Each dimension set will result in a new CloudWatch metric (even dimension sets with the same values).
216
+
If the cardinality of a particular value is expected to be high, you should consider
217
+
using `setProperty` instead.
218
+
219
+
Dimensions must meet CloudWatch Dimensions requirements, otherwise a `InvalidDimensionException` will be thrown. See [Dimensions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_Dimension.html) for valid values.
Sets the CloudWatch [namespace](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace) that extracted metrics should be published to. If not set, a default value of aws-embedded-metrics will be used.
244
+
Namespaces must meet CloudWatch Namespace requirements, otherwise a `InvalidNamespaceException` will be thrown. See [Namespace](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace) for valid values.
245
+
246
+
Example:
247
+
248
+
```c#
249
+
SetNamespace("MyApplication")
250
+
```
251
+
252
+
-**Flush**()
253
+
254
+
Flushes the current MetricsContext to the configured sink and resets all properties and metric values. The namespace and default dimensions will be preserved across flushes. Custom dimensions are preserved by default, but this behavior can be changed by setting `flushPreserveDimensions = false` on the metrics logger.
255
+
256
+
Examples:
257
+
258
+
```c#
259
+
flush(); // default dimensions and custom dimensions will be preserved after each flush()
260
+
```
261
+
262
+
```c#
263
+
logger.setFlushPreserveDimensions=false;
264
+
flush(); // only default dimensions will be preserved after each flush()
265
+
```
266
+
267
+
```c#
268
+
setFlushPreserveDimensions(false);
269
+
resetDimensions(false); // default dimensions are disabled; no dimensions will be preserved after each flush()
0 commit comments