aws-observability / aws-otel-java-instrumentation

AWS Distro for OpenTelemetry Java Instrumentation Library
https://aws-otel.github.io/
Apache License 2.0
76 stars 56 forks source link

ForceFlush Implementation #885

Closed thpierce closed 1 month ago

thpierce commented 3 months ago

Description:

Passed the forceflush function from SdkMeteringProvider to the AwsSpanMetricProcessor to forceFlush remaining metrics on shutdown to the cwAgent/Collector.

Tesing:

Increased the metricExporter interval and the BatchSpanProcessor delay to 10 minutes using:

OTEL_METRIC_EXPORT_INTERVAL=600000 \
OTEL_BSP_SCHEDULE_DELAY=600000 \

Without the force flush change, exiting the sample app only flushed the traces without the metrics. With the forceFlush change, both traces and metrics were flushed to the collector.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.