awslabs / awslabs/aws-embedded-metrics-python

flush() doesn't clear properties

Open
#35 2 comments 2 reactions 0 assignees View on GitHub
documentation enhancement
Dominant language
Python
Stars
231
Forks
44
PR merge metrics
No merged PRs in 30d

Description

According the README, `flush()` "[f]lushes 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."

However, in `MetricContext.create_copy_with_context()`, which is used by `MetricsLogger.flush()` to reset the context, [copies the old properties](https://github.com/awslabs/aws-embedded-metrics-python/blob/c85dcdd9a45be18aba7ffbcbd0e540a7a88d55f7/aws_embedded_metrics/logger/metrics_context.py#L127). This means in my Lambda function, if I have conditional properties in my logging object, once I've set one in one invocation, it remains present in the context in future invocations.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.