Skip to main content

Bug Fix: OTLP Exporter Node Example in OpenTelemetry JS

·222 words·2 mins
Adrien Raimbault
Author
Adrien Raimbault

OpenTelemetry JS is the JavaScript implementation of the OpenTelemetry observability framework, enabling standardized tracing and metrics in distributed systems.

It provides tools to collect and export telemetry data (traces, metrics) from applications to various backends, helping developers monitor and debug distributed systems effectively.


🧩 My Contribution: OTLP Exporter Node Example Bug Fix
#

The goal of this contribution was to correct an issue in the example code where provider.register() was incorrectly called, leading to a runtime error.

I contributed to the OpenTelemetry JS repository by fixing a bug in the OTLP exporter node example:
🔗 Pull Request: #5586 – fix(examples): use correct node tracer provider function
🔗 Related Issue: #5569 – provider.register is not a function
📌 Status: Merged and Closed

🔧 What I Fixed
#

  • Corrected the usage of the tracer provider in the OTLP exporter example (examples/otlp-exporter-node/tracing.js).
  • Removed the invalid call to provider.register() which caused a runtime error.
  • Ensured the example runs correctly with current OpenTelemetry APIs and Node.js versions.

This fix helps keep example code in sync with the evolving OpenTelemetry API and prevents errors for users trying out the examples.


💡 Why It Matters
#

  • 🛠️ Ensures that new users can run the example without runtime errors.
  • 📚 Maintains up-to-date documentation and examples.
  • 📚 Improves code consistency and maintainability across the project.

📂 See my other contributions: github.com/Assstra