Skip to content

fix: enable prom exporter only if config set#934

Merged
ferhatelmas merged 1 commit intomasterfrom
ferhat/prom-exporter
Mar 26, 2026
Merged

fix: enable prom exporter only if config set#934
ferhatelmas merged 1 commit intomasterfrom
ferhat/prom-exporter

Conversation

@ferhatelmas
Copy link
Member

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Prom exporter is created unconditionally even if config is set to false.

What is the new behavior?

Guard to create only if config requires.
Extract some test functions into utilities.

Additional context

It should help to stabilize memory usage.

Copilot AI review requested due to automatic review settings March 26, 2026 10:35
@ferhatelmas ferhatelmas requested a review from a team as a code owner March 26, 2026 10:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes OpenTelemetry metrics initialization so the Prometheus exporter/reader is only created when prometheusMetricsEnabled is enabled in config, and refactors some repeated Jest test helpers into shared test utilities.

Changes:

  • Guard Prometheus exporter creation in otel-metrics behind prometheusMetricsEnabled.
  • Add a regression test ensuring no Prometheus reader is created when Prometheus metrics are disabled.
  • Extract createDeferred and an async module-isolation helper into src/test/utils.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/internal/monitoring/otel-metrics.ts Only instantiates the Prometheus exporter when prometheusMetricsEnabled is true.
src/test/otel-metrics.test.ts Adds coverage for the “Prometheus disabled” case; switches to shared isolate helper and resets modules in teardown.
src/test/otel-tracing.test.ts Reuses shared createDeferred and isolate helper; adjusts one test to control class-instrumentations timing.
src/test/progressive-migrations.test.ts Reuses shared createDeferred helper.
src/test/utils/promise.ts New shared deferred-promise utility.
src/test/utils/jest.ts New shared async “isolate modules” utility for tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ferhatelmas ferhatelmas merged commit a463143 into master Mar 26, 2026
7 checks passed
@ferhatelmas ferhatelmas deleted the ferhat/prom-exporter branch March 26, 2026 11:43
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.

3 participants