Skip to content

feat(configuration): add prometheus exporter support#6400

Merged
maryliag merged 3 commits intoopen-telemetry:mainfrom
honeycombio:mike/add-prometheus-exporter
Feb 12, 2026
Merged

feat(configuration): add prometheus exporter support#6400
maryliag merged 3 commits intoopen-telemetry:mainfrom
honeycombio:mike/add-prometheus-exporter

Conversation

@MikeGoldsmith
Copy link
Copy Markdown
Member

Which problem is this PR solving?

Adds support for the Prometheus exporter in the OpenTelemetry configuration package to support RC3 configuration specification.

Currently, the configuration package supports OTLP and console exporters for metrics, but does not support Prometheus, which is a commonly used metrics backend that requires different configuration (pull-based vs push-based).

Short description of the changes

This PR adds Prometheus exporter support to the @opentelemetry/configuration package:

  1. Added Prometheus exporter handling in EnvironmentConfigFactory.ts

    • Checks for OTEL_METRICS_EXPORTER=prometheus
    • Uses PullMetricReader (not PeriodicMetricReader) since Prometheus is pull-based
    • Supports environment variables:
      • OTEL_EXPORTER_PROMETHEUS_HOST (default: localhost)
      • OTEL_EXPORTER_PROMETHEUS_PORT (default: 9464)
    • Prometheus check happens first in the loop since it requires a different reader type
  2. Added tests in ConfigFactory.test.ts

    • Test for default Prometheus configuration
    • Test for custom host/port configuration

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • New tests added for Prometheus exporter
  • All existing tests pass (49 passing)
  • Verified Prometheus uses PullMetricReader (not PeriodicMetricReader)
  • Tested with environment variables set

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

- Add PullMetricReader import
- Handle 'prometheus' exporter type with pull reader
- Support OTEL_EXPORTER_PROMETHEUS_HOST and OTEL_EXPORTER_PROMETHEUS_PORT
- Default to localhost:9464
- Added tests for default and custom config
@MikeGoldsmith MikeGoldsmith requested a review from a team as a code owner February 11, 2026 19:11
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.50%. Comparing base (fcafab5) to head (889e2c9).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6400   +/-   ##
=======================================
  Coverage   95.50%   95.50%           
=======================================
  Files         365      365           
  Lines       11609    11615    +6     
  Branches     2677     2680    +3     
=======================================
+ Hits        11087    11093    +6     
  Misses        522      522           
Files with missing lines Coverage Δ
...ages/configuration/src/EnvironmentConfigFactory.ts 99.51% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@maryliag
Copy link
Copy Markdown
Contributor

maryliag commented Feb 11, 2026

Thank you for working on these changes. Can you also add the correspondent changes to the FileConfigFactory and add tests for that one too
nv, the code was only missing in the env file

Closes #6063

Comment thread experimental/CHANGELOG.md Outdated
Co-authored-by: Marylia Gutierrez <maryliag@gmail.com>
@maryliag maryliag added this pull request to the merge queue Feb 12, 2026
Merged via the queue into open-telemetry:main with commit 3e68499 Feb 12, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants