Skip to content

Enable setting properties to enrich the emf records emitted by EmfMetricLoggingPublisher #6595

@humanzz

Description

@humanzz

Describe the feature

Enable EmfMetricLoggingPublisher to optionally accept a Supplier<Map<String, String>> that it uses to add properties/metadata to the emf records.

Use Case

Prior to the introduction of EmfMetricLoggingPublisher, I implement a custom emf publisher (#2068 (comment)) to use in my lambda functions.

Now looking to move to the SDK-provided EmfMetricLoggingPublisher, I'm realizing there's a gap. In my custom publisher, I enriched the emf record with some additional metadata like function request id, and other properties to enable emf record analysis/correlation with function invocations.

EmfMetricLoggingPublisher provides no way to interact with the generated emf records and from the implementation I see it's a custom implementation.

I believe the ability to enrich emf records, with identifiers/properties to facilitate investigations/correlating with other metadata is a good practice.

Proposed Solution

The proposal is to update EmfMetricLoggingPublisher.builder() to accept a .propertiesSupplier(...) that takes a Supplier<Map<String, String>> to add as properties - equivalent to https://github.com/awslabs/aws-embedded-metrics-java/blob/master/src/main/java/software/amazon/cloudwatchlogs/emf/logger/MetricsLogger.java#L110

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

2.39.5

JDK version used

25

Operating System and version

Amazon Linux 2023

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions