Skip to content

Feature: Support OpenTelemetry API for Apollo Monitor custom metrics reporting#143

Open
teaho2015 wants to merge 2 commits into
apolloconfig:mainfrom
teaho-infra:main
Open

Feature: Support OpenTelemetry API for Apollo Monitor custom metrics reporting#143
teaho2015 wants to merge 2 commits into
apolloconfig:mainfrom
teaho-infra:main

Conversation

@teaho2015

@teaho2015 teaho2015 commented Jul 12, 2026

Copy link
Copy Markdown

Description

Add OpenTelemetry API integration to Apollo Monitor, enabling users to report Apollo custom monitoring metrics via OpenTelemetry metrics API.

Motivation

Currently Apollo Monitor only supports built-in monitoring reporters. This feature allows observability platforms compatible with OpenTelemetry to consume Apollo monitoring metrics natively, unifying metrics collection in cloud-native environments.

Changes

  • Introduce OpenTelemetry metrics reporter implementation for Apollo Monitor
  • Provide configuration switch to enable OpenTelemetry metrics reporting
  • Keep existing monitoring reporters fully compatible without breaking changes

Testing

  • Verified custom metrics can be collected via OpenTelemetry SDK
  • Existing monitor functions work normally when OpenTelemetry reporter is disabled

Summary by CodeRabbit

  • New Features

    • Added OpenTelemetry support for exporting Apollo client metrics.
    • Supports counter and gauge metrics, including associated tags.
    • Automatically discovers the OpenTelemetry metrics exporter through the plugin system.
    • Added the new exporter as a buildable Apollo plugin module.
  • Tests

    • Added coverage for initialization, metric registration, tag handling, support detection, and status reporting.

@github-actions

Copy link
Copy Markdown

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Added an OpenTelemetry client metrics plugin module with SPI registration, counter and gauge export support, tag attribute caching, status reporting, and unit tests covering initialized and uninitialized behavior.

Changes

OpenTelemetry metrics integration

Layer / File(s) Summary
Module and SPI wiring
apollo-plugin/pom.xml, apollo-plugin/apollo-plugin-client-opentelemetry/pom.xml, apollo-plugin/apollo-plugin-client-opentelemetry/src/main/resources/META-INF/services/...
Adds the Maven module, OpenTelemetry and test dependencies, and the ApolloClientMetricsExporter service-provider entry.
Exporter implementation
apollo-plugin/apollo-plugin-client-opentelemetry/src/main/java/.../OpenTelemetryApolloClientMetricsExporter.java
Initializes a meter from GlobalOpenTelemetry, exports counters and observable gauges, caches tag attributes, and reports exporter state.
Exporter behavior tests
apollo-plugin/apollo-plugin-client-opentelemetry/src/test/java/.../*OpenTelemetryApolloClientMetricsExporterTest.java
Tests support detection, initialization, metric builder interactions, status output, uninitialized calls, and null or empty tags.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ApolloClientMetricsExporter
  participant OpenTelemetryApolloClientMetricsExporter
  participant GlobalOpenTelemetry
  participant Meter
  ApolloClientMetricsExporter->>OpenTelemetryApolloClientMetricsExporter: initialize exporter
  OpenTelemetryApolloClientMetricsExporter->>GlobalOpenTelemetry: get()
  GlobalOpenTelemetry-->>OpenTelemetryApolloClientMetricsExporter: OpenTelemetry instance
  OpenTelemetryApolloClientMetricsExporter->>Meter: build counter or observable gauge
  OpenTelemetryApolloClientMetricsExporter->>Meter: record metric values
Loading

Suggested reviewers: Anilople, hezhangjian

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding OpenTelemetry API support for Apollo Monitor custom metrics reporting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.07%. Comparing base (d4b76f8) to head (2614592).
⚠️ Report is 30 commits behind head on main.

Files with missing lines Patch % Lines
...impl/OpenTelemetryApolloClientMetricsExporter.java 84.61% 9 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #143      +/-   ##
============================================
+ Coverage     68.68%   71.07%   +2.39%     
- Complexity     1503     1656     +153     
============================================
  Files           212      225      +13     
  Lines          6396     6798     +402     
  Branches        647      685      +38     
============================================
+ Hits           4393     4832     +439     
+ Misses         1673     1612      -61     
- Partials        330      354      +24     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
apollo-plugin/apollo-plugin-client-opentelemetry/src/test/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/OpenTelemetryApolloClientMetricsExporterTest.java (1)

75-121: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add test coverage for null tags with initialized meter.

The counter and gauge tests verify builder interactions but don't test null tags when the meter is initialized. This is the exact scenario where registerOrUpdateGaugeSample will NPE (via getGaugeKeycreateCacheKey). Adding this test would have caught the bug flagged in the implementation.

Additionally, testRegisterOrUpdateCounterSample verifies counterBuilder.build() but doesn't verify counter.add() was called with the expected value and attributes.

🧪 Suggested additional test
`@Test`(expected = NullPointerException.class)
public void testRegisterOrUpdateGaugeSampleWithNullTags() {
    // This should NOT throw after the fix; before the fix it throws NPE
    // After fixing createCacheKey to handle null, update this test to assert no exception
    exporter.registerOrUpdateGaugeSample("test_gauge", null, 1.0);
}

`@Test`
public void testRegisterOrUpdateCounterSampleWithNullTags() {
    io.opentelemetry.api.metrics.LongCounterBuilder counterBuilder = mock(io.opentelemetry.api.metrics.LongCounterBuilder.class);
    io.opentelemetry.api.metrics.LongCounter counter = mock(io.opentelemetry.api.metrics.LongCounter.class);
    when(meter.counterBuilder("null_tags_counter")).thenReturn(counterBuilder);
    when(counterBuilder.setDescription(anyString())).thenReturn(counterBuilder);
    when(counterBuilder.setUnit(anyString())).thenReturn(counterBuilder);
    when(counterBuilder.build()).thenReturn(counter);

    exporter.registerOrUpdateCounterSample("null_tags_counter", null, 1.0);

    verify(counter).add(eq(1L), any());
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apollo-plugin/apollo-plugin-client-opentelemetry/src/test/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/OpenTelemetryApolloClientMetricsExporterTest.java`
around lines 75 - 121, Extend testRegisterOrUpdateGaugeSample and
testRegisterOrUpdateCounterSample to cover initialized-meter calls with null
tags, asserting they complete without throwing and that the counter invokes add
with the expected value and attributes. In testRegisterOrUpdateCounterSample,
retain the builder verifications and add verification of counter.add; configure
the mocks using the existing meter and builder setup.
apollo-plugin/apollo-plugin-client-opentelemetry/src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/OpenTelemetryApolloClientMetricsExporter.java (1)

113-115: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Reuse AtomicReference instead of allocating a new one per update.

gaugeValueMap.put(gaugeKey, new AtomicReference<>(value)) creates a new AtomicReference object on every gauge update. The callback in createGauge reads from the map each time, so functionally this works, but it produces unnecessary garbage. Use computeIfAbsent + set to reuse the existing holder.

♻️ Proposed refactor
-    gaugeValueMap.put(gaugeKey, new AtomicReference<>(value));
+    gaugeValueMap.computeIfAbsent(gaugeKey, k -> new AtomicReference<>()).set(value);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apollo-plugin/apollo-plugin-client-opentelemetry/src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/OpenTelemetryApolloClientMetricsExporter.java`
around lines 113 - 115, Update the gauge storage logic in the exporter method
containing gaugeKey and gaugeValueMap so it reuses the existing AtomicReference:
obtain the holder with computeIfAbsent and set the new value on it, rather than
creating a new AtomicReference on every update.
apollo-plugin/apollo-plugin-client-opentelemetry/src/test/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/SimpleOpenTelemetryApolloClientMetricsExporterTest.java (1)

54-113: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Uninitialized-behavior tests don't assert anything meaningful.

Tests testRegisterOrUpdateCounterSampleWithoutInit, testRegisterOrUpdateGaugeSampleWithoutInit, testEmptyTags, and testNullTags all follow the pattern: call method in try-catch, pass whether or not an exception is thrown. This means they pass even if the methods throw unexpected exceptions or silently corrupt state.

Since meter is null (no doInit()), the methods should return early with a warning. The tests should verify this explicitly rather than accepting any outcome.

🧪 Suggested improvement
 `@Test`
 public void testRegisterOrUpdateCounterSampleWithoutInit() {
-    String name = "test_counter";
-    Map<String, String> tags = new HashMap<>();
-    tags.put("namespace", "application");
-    
-    try {
-        exporter.registerOrUpdateCounterSample(name, tags, 1.0);
-        assertTrue(true);
-    } catch (Exception e) {
-        // It's okay if it throws exception when not initialized
-    }
+    String name = "test_counter";
+    Map<String, String> tags = new HashMap<>();
+    tags.put("namespace", "application");
+
+    exporter.registerOrUpdateCounterSample(name, tags, 1.0);
+
+    // Verify no metrics were registered
+    String response = exporter.response();
+    assertTrue(response.contains("Counters: 0"));
+    assertTrue(response.contains("Meter: not initialized"));
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apollo-plugin/apollo-plugin-client-opentelemetry/src/test/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/SimpleOpenTelemetryApolloClientMetricsExporterTest.java`
around lines 54 - 113, Update testRegisterOrUpdateCounterSampleWithoutInit,
testRegisterOrUpdateGaugeSampleWithoutInit, testEmptyTags, and testNullTags to
assert the exporter’s expected uninitialized behavior: with meter unset, each
operation should return normally without throwing and leave state unchanged.
Remove broad try-catch blocks and unconditional assertions, and verify the
relevant warning/early-return outcome using the test’s available observability
mechanism.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apollo-plugin/apollo-plugin-client-opentelemetry/pom.xml`:
- Around line 40-43: Update the opentelemetry-api dependency version from 1.35.0
to at least 1.62.0, preferably the stable 1.63.0 release; if the dependency
version is shared across modules, define it in the parent dependencyManagement
and reuse it here.

In
`@apollo-plugin/apollo-plugin-client-opentelemetry/src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/OpenTelemetryApolloClientMetricsExporter.java`:
- Around line 106-122: Update registerOrUpdateGaugeSample to wrap gauge value
storage and registration in the same try-catch pattern used by
registerOrUpdateCounterSample, logging failures without propagating exceptions.
Also update createCacheKey to handle null tags before iterating entrySet,
preserving the existing key generation for non-null tags.

---

Nitpick comments:
In
`@apollo-plugin/apollo-plugin-client-opentelemetry/src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/OpenTelemetryApolloClientMetricsExporter.java`:
- Around line 113-115: Update the gauge storage logic in the exporter method
containing gaugeKey and gaugeValueMap so it reuses the existing AtomicReference:
obtain the holder with computeIfAbsent and set the new value on it, rather than
creating a new AtomicReference on every update.

In
`@apollo-plugin/apollo-plugin-client-opentelemetry/src/test/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/OpenTelemetryApolloClientMetricsExporterTest.java`:
- Around line 75-121: Extend testRegisterOrUpdateGaugeSample and
testRegisterOrUpdateCounterSample to cover initialized-meter calls with null
tags, asserting they complete without throwing and that the counter invokes add
with the expected value and attributes. In testRegisterOrUpdateCounterSample,
retain the builder verifications and add verification of counter.add; configure
the mocks using the existing meter and builder setup.

In
`@apollo-plugin/apollo-plugin-client-opentelemetry/src/test/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/SimpleOpenTelemetryApolloClientMetricsExporterTest.java`:
- Around line 54-113: Update testRegisterOrUpdateCounterSampleWithoutInit,
testRegisterOrUpdateGaugeSampleWithoutInit, testEmptyTags, and testNullTags to
assert the exporter’s expected uninitialized behavior: with meter unset, each
operation should return normally without throwing and leave state unchanged.
Remove broad try-catch blocks and unconditional assertions, and verify the
relevant warning/early-return outcome using the test’s available observability
mechanism.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: da8f9cbb-981f-48c0-97b4-c598df2d29f8

📥 Commits

Reviewing files that changed from the base of the PR and between 023217c and 2614592.

📒 Files selected for processing (6)
  • apollo-plugin/apollo-plugin-client-opentelemetry/pom.xml
  • apollo-plugin/apollo-plugin-client-opentelemetry/src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/OpenTelemetryApolloClientMetricsExporter.java
  • apollo-plugin/apollo-plugin-client-opentelemetry/src/main/resources/META-INF/services/com.ctrip.framework.apollo.monitor.internal.exporter.ApolloClientMetricsExporter
  • apollo-plugin/apollo-plugin-client-opentelemetry/src/test/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/OpenTelemetryApolloClientMetricsExporterTest.java
  • apollo-plugin/apollo-plugin-client-opentelemetry/src/test/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/SimpleOpenTelemetryApolloClientMetricsExporterTest.java
  • apollo-plugin/pom.xml

Comment on lines +40 to +43
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
<version>1.35.0</version>
</dependency>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

What is the latest stable version of io.opentelemetry:opentelemetry-api, and are there any security advisories for version 1.35.0?

💡 Result:

As of July 12, 2026, the latest stable version of io.opentelemetry:opentelemetry-api is 1.63.0 [1][2]. Regarding version 1.35.0, it is affected by a security advisory: GHSA-rcgg-9c38-7xpx: Unbounded Memory Allocation in W3C Baggage Propagation. This vulnerability, identified as CVE-2026-45292, affects versions up to and including 1.61.0 [3]. Because version 1.35.0 is included in this range, it is considered vulnerable to this issue [3][4]. The vulnerability involves the lack of limits on W3C Baggage header size and entry counts, which can lead to excessive memory allocation and CPU consumption [3]. This was addressed in version 1.62.0 [3].

Citations:


Update opentelemetry-api to a fixed release1.35.0 is affected by GHSA-rcgg-9c38-7xpx (unbounded memory allocation in W3C baggage propagation); upgrade to at least 1.62.0 (latest stable is 1.63.0). If this dependency is shared elsewhere, move the version into the parent dependencyManagement section.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apollo-plugin/apollo-plugin-client-opentelemetry/pom.xml` around lines 40 -
43, Update the opentelemetry-api dependency version from 1.35.0 to at least
1.62.0, preferably the stable 1.63.0 release; if the dependency version is
shared across modules, define it in the parent dependencyManagement and reuse it
here.

Comment on lines +106 to +122
@Override
public void registerOrUpdateGaugeSample(String name, Map<String, String> tags, double value) {
if (meter == null) {
logger.warn("OpenTelemetry meter not initialized, skipping gauge registration for '{}'", name);
return;
}

// Store the gauge value
String gaugeKey = getGaugeKey(name, tags);
gaugeValueMap.put(gaugeKey, new AtomicReference<>(value));

// Register gauge if not already registered
gaugeMap.computeIfAbsent(gaugeKey, key -> createGauge(name, tags, gaugeKey));

logger.debug("Updated OpenTelemetry gauge '{}' with value: {}, tags: {}",
name, value, tags);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

registerOrUpdateGaugeSample lacks error handling and will NPE on null tags.

Two issues:

  1. Inconsistent error handling: registerOrUpdateCounterSample wraps all logic in try-catch, but registerOrUpdateGaugeSample does not. If meter.gaugeBuilder(name) or buildWithCallback throws, the exception propagates unhandled to the caller, potentially crashing the monitoring thread.

  2. NPE on null tags: getGaugeKey(name, tags)createCacheKey(tags) calls tags.entrySet() without a null check. When the meter is initialized and tags is null, this throws NPE. Note that getOrCreateAttributes handles null tags, but it's called inside createGaugeafter getGaugeKey has already thrown.

🐛 Proposed fix: add try-catch and null-guard in createCacheKey
 `@Override`
 public void registerOrUpdateGaugeSample(String name, Map<String, String> tags, double value) {
-    if (meter == null) {
-        logger.warn("OpenTelemetry meter not initialized, skipping gauge registration for '{}'", name);
-        return;
-    }
-
-    // Store the gauge value
-    String gaugeKey = getGaugeKey(name, tags);
-    gaugeValueMap.put(gaugeKey, new AtomicReference<>(value));
-
-    // Register gauge if not already registered
-    gaugeMap.computeIfAbsent(gaugeKey, key -> createGauge(name, tags, gaugeKey));
-
-    logger.debug("Updated OpenTelemetry gauge '{}' with value: {}, tags: {}",
-      name, value, tags);
+    try {
+        if (meter == null) {
+            logger.warn("OpenTelemetry meter not initialized, skipping gauge registration for '{}'", name);
+            return;
+        }
+
+        // Store the gauge value
+        String gaugeKey = getGaugeKey(name, tags);
+        gaugeValueMap.computeIfAbsent(gaugeKey, k -> new AtomicReference<>()).set(value);
+
+        // Register gauge if not already registered
+        gaugeMap.computeIfAbsent(gaugeKey, key -> createGauge(name, tags, gaugeKey));
+
+        logger.debug("Updated OpenTelemetry gauge '{}' with value: {}, tags: {}",
+          name, value, tags);
+    } catch (Exception e) {
+        logger.error("Failed to register or update OpenTelemetry gauge '{}'", name, e);
+    }
 }

And add a null guard in createCacheKey:

 private String createCacheKey(Map<String, String> tags) {
+    if (tags == null || tags.isEmpty()) {
+        return "";
+    }
     // Sort keys to ensure consistent cache key
     return tags.entrySet().stream()
         .sorted(Map.Entry.comparingByKey())
         .map(entry -> entry.getKey() + "=" + entry.getValue())
         .reduce((a, b) -> a + ";" + b)
         .orElse("");
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Override
public void registerOrUpdateGaugeSample(String name, Map<String, String> tags, double value) {
if (meter == null) {
logger.warn("OpenTelemetry meter not initialized, skipping gauge registration for '{}'", name);
return;
}
// Store the gauge value
String gaugeKey = getGaugeKey(name, tags);
gaugeValueMap.put(gaugeKey, new AtomicReference<>(value));
// Register gauge if not already registered
gaugeMap.computeIfAbsent(gaugeKey, key -> createGauge(name, tags, gaugeKey));
logger.debug("Updated OpenTelemetry gauge '{}' with value: {}, tags: {}",
name, value, tags);
}
`@Override`
public void registerOrUpdateGaugeSample(String name, Map<String, String> tags, double value) {
try {
if (meter == null) {
logger.warn("OpenTelemetry meter not initialized, skipping gauge registration for '{}'", name);
return;
}
// Store the gauge value
String gaugeKey = getGaugeKey(name, tags);
gaugeValueMap.computeIfAbsent(gaugeKey, k -> new AtomicReference<>()).set(value);
// Register gauge if not already registered
gaugeMap.computeIfAbsent(gaugeKey, key -> createGauge(name, tags, gaugeKey));
logger.debug("Updated OpenTelemetry gauge '{}' with value: {}, tags: {}",
name, value, tags);
} catch (Exception e) {
logger.error("Failed to register or update OpenTelemetry gauge '{}'", name, e);
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apollo-plugin/apollo-plugin-client-opentelemetry/src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/OpenTelemetryApolloClientMetricsExporter.java`
around lines 106 - 122, Update registerOrUpdateGaugeSample to wrap gauge value
storage and registration in the same try-catch pattern used by
registerOrUpdateCounterSample, logging failures without propagating exceptions.
Also update createCacheKey to handle null tags before iterating entrySet,
preserving the existing key generation for non-null tags.

@nobodyiam nobodyiam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for adding the OpenTelemetry metrics exporter. The SPI wiring and the existing compatibility checks look good, but there are still a few blocking issues on the current head:

  1. opentelemetry-api:1.35.0 is affected by GHSA-rcgg-9c38-7xpx. Please upgrade to a patched supported version (at least 1.62.0; 1.64.0 is the current stable release at review time).

  2. registerOrUpdateCounterSample casts the API's double increment to long. This silently exports 0.5 as 0. Please use a double-valued OpenTelemetry counter and add a regression test covering a fractional increment and its attributes.

  3. Please address the current gauge null-tags/error-handling issue and replace the broad try/catch tests with assertions that verify the actual counter value, attributes, gauge callback output, and uninitialized behavior.

  4. Since this is a user-visible feature, please update CHANGES.md and add minimal usage documentation covering the plugin dependency, apollo.client.monitor.enabled, apollo.client.monitor.external.type=opentelemetry, and the requirement to initialize the OpenTelemetry SDK before Apollo monitoring starts.

Before merge, please also sign the CLA, remove the trailing whitespace reported by git diff --check, and squash the branch to one Conventional Commit.

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