Otel integrations#108
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds optional OpenTelemetry tracing (v4.12.0) via a ChangesOpenTelemetry Telemetry + Service Operation Identifiers
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Comment |
Verifies that a TelemetryAdapter set per call through RequestOptions/withOptions fires for that request, and that telemetry is skipped when no adapter is configured on the call or client. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/test/java/com/chargebee/v4/services/ServiceTelemetryOptionsTest.java (1)
100-107: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
noAdapterSkipsis a no-op assertion. Theadapteris never attached to the client orRequestOptions, soadapter.eventsis guaranteed empty regardless of telemetry behavior — the test would pass even if the skip logic were broken. Drive the request through an adapter that would record, but configured with no client/per-request adapter, to actually exercise the skip path.♻️ Suggested approach
void noAdapterSkips() throws Exception { - RecordingAdapter adapter = new RecordingAdapter(); TestService service = new TestService(clientWithoutAdapter()); - service.ping(); - - assertTrue(adapter.events.isEmpty()); + // No adapter on client or RequestOptions; telemetry must be skipped. + Response response = service.ping(); + assertEquals(200, response.getStatusCode()); }A stronger variant: install a recording adapter that throws if invoked, then assert
ping()still succeeds.🤖 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 `@src/test/java/com/chargebee/v4/services/ServiceTelemetryOptionsTest.java` around lines 100 - 107, The no-op assertion in noAdapterSkips does not exercise the skip path because the RecordingAdapter is never wired into clientWithoutAdapter() or RequestOptions, so its events stay empty regardless of behavior. Update the test to route TestService.ping() through a RecordingAdapter that would record or throw if invoked, while still configuring no client/per-request adapter, so the request actually proves telemetry is skipped. Keep the assertion focused on ping() succeeding and the adapter remaining untouched, using the existing noAdapterSkips, RecordingAdapter, and clientWithoutAdapter helpers to locate the change.
🤖 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.
Nitpick comments:
In `@src/test/java/com/chargebee/v4/services/ServiceTelemetryOptionsTest.java`:
- Around line 100-107: The no-op assertion in noAdapterSkips does not exercise
the skip path because the RecordingAdapter is never wired into
clientWithoutAdapter() or RequestOptions, so its events stay empty regardless of
behavior. Update the test to route TestService.ping() through a RecordingAdapter
that would record or throw if invoked, while still configuring no
client/per-request adapter, so the request actually proves telemetry is skipped.
Keep the assertion focused on ping() succeeding and the adapter remaining
untouched, using the existing noAdapterSkips, RecordingAdapter, and
clientWithoutAdapter helpers to locate the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 791137b5-d4c8-4158-a12d-c0cbfca7f8ca
📒 Files selected for processing (1)
src/test/java/com/chargebee/v4/services/ServiceTelemetryOptionsTest.java
Summary
telemetryAdapterhook for tracing Chargebee API calls via OpenTelemetry (or any APM), configurable on the client (ChargebeeClient.Builder#telemetryAdapter) or per call (RequestOptions.Builder#telemetryAdapter)chargebee.{resource}.{operation}with OTel HTTP semantic-convention +chargebee.*attributestraceparent/tracestate) into outbound request headers for distributed tracingTelemetryAdapter, and pass it to the clientRequestOptionscopies, so class-based adapters are preservedresource/operationnames into each call (used for span naming); adds a convenienceupdateGift(String giftId)overloadTelemetryExecutorTest) and README docs; bumps version to4.12.0with a changelog entryIntroduced optional
telemetryAdapterhooks (client + per-request) to emit one OpenTelemetry-compatible CLIENT span per Chargebee API call (chargebee.{resource}.{operation}) withchargebee.*/HTTP attributes and optional W3C trace-context header injection. Updated generated service wiring to pass resource/operation names, addedupdateGift(String)overload, plus tests/docs and a 4.12.0 version/changelog bump.