feat(opentelemetry): add metrics lifecycle methods - #10023
Conversation
🎉 All green!🧪 All tests passed 🔄 Datadog auto-retried 6 jobs - 5 passed on retry 🎯 Code Coverage (details) 🔗 Commit SHA: 471864e | Docs | View more details | Give us feedback! |
Overall package sizeSelf size: 8.41 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.3 | 125.43 kB | 445.14 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
BenchmarksBenchmark execution time: 2026-08-27 13:17:12 Comparing candidate commit 471864e in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2300 metrics, 10 unstable metrics.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10023 +/- ##
=======================================
Coverage 98.57% 98.57%
=======================================
Files 990 990
Lines 148949 149047 +98
Branches 13143 13148 +5
=======================================
+ Hits 146827 146926 +99
+ Misses 2122 2121 -1 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What does this PR do?
Adds Promise-returning
forceFlush()andshutdown()methods to the concrete Datadog MeterProvider used by the global OTel metrics API.The reader serializes periodic, explicit, and final exports. Lifecycle Promises settle after the OTLP HTTP result, and shutdown performs one final export before closing the exporter. The Datadog provider type is exported in both TypeScript declaration surfaces without changing upstream OTel types.
Motivation
Short-lived Node.js jobs can exit before the periodic OTel metrics interval. They need a supported way to wait for pending custom metrics before the process ends.
Additional Notes