Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(js/plugins/google-cloud): Implement forceFlush and shutdown #1869

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

schnecle
Copy link
Contributor

@schnecle schnecle commented Feb 5, 2025

We were seeing occasions where flows run on Cloud functions are not exporting all metrics. We suspect that there are times where we were not waiting for metrics to complete because of the way that the cloud exporter exports asynchronously: https://github.com/GoogleCloudPlatform/opentelemetry-operations-js/blob/main/packages/opentelemetry-cloud-monitoring-exporter/src/monitoring.ts#L117C53-L117C56

Adding a shutdown hook to our metrics wrapper ensures we are awaiting the callback function from the wrapped cloud exporter.

Manually tested locally using forceDevExport = true to make sure metrics are still being exported.
image

Checklist (if applicable):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant