awslabs/aws-embedded-metrics-java

Context copying is disabling default dimensions

markkuhn opened this issue · 0 comments

Issue

When flushPreserveDimensions is true, the context will disable default dimensions after the first flush.

Reproduction

MetricsLogger logger = new MetricsLogger(environment);
logger.putMetric("Example", 100);
logger.flush();
logger.putMetric("Example", 200);
logger.flush(); // This logger will not contain any default dimensions

Cause

Context copy uses setDimensions() to copy custom dimensions which disables default dimensions.