Skip to content

Using MetricPublisher in AWS Lambda #2068

@powerful23

Description

@powerful23

Hi AWS SDK team,

We want to publish the AWS SDK metrics in the lambda function following the guide: https://docs.aws.amazon.com/sdk-for-java/v2/developer-guide/configuration-metrics.html

We found there seems no way to manually flush the metrics without which the lambda function will lose part of the metrics data. If I am understanding correctly, the CloudWatchMetricsPublisher will only flush itself when closing and you can only setup the flush frequency when building the publisher. We want to know if there is way to manually flush the metrics.

Expected Behavior

Flush the metrics manually.

Current Behavior

Flush the metrics when closing the publisher.

Possible Solution

Make the flush method public.

Steps to Reproduce (for bugs)

Use MetricsPublisher in a lambda function.

Your Environment

  • AWS Java SDK version used: 2.14 or up
  • JDK version used: JDK 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.p3This is a minor priority issuesdk-metrics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions