awslabs / awslabs/aws-embedded-metrics-python
flush() doesn't clear properties
- 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
Assessment
This issue has not been assessed yet.