Skip to content

fix(cloud-tasks): restore gRPC server trace spans - #548

Merged
sanjay-saxena merged 1 commit into
mainfrom
fix/observability/grpc
Jul 30, 2026
Merged

fix(cloud-tasks): restore gRPC server trace spans#548
sanjay-saxena merged 1 commit into
mainfrom
fix/observability/grpc

Conversation

@sanjay-saxena

@sanjay-saxena sanjay-saxena commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Restore gRPC server trace spans for Cloud Tasks by registering Micrometer's
OpenTelemetry-compatible observation interceptor and adding regression coverage
for the exported RPC attributes.

Additional Details

  • Registers ObservationGrpcServerInterceptor as a global gRPC server
    interceptor using the application's existing ObservationRegistry.
  • Guards the interceptor bean so future framework-provided instrumentation does
    not create duplicate spans.
  • Adds an integration test that calls the gRPC health endpoint and verifies the
    exported span kind, RPC service, RPC method, and gRPC status code.
  • Captures the random test server port from the gRPC lifecycle event so the test
    does not depend on a fixed port.
  • Declares the existing gRPC health and starter artifacts as direct Bazel test
    dependencies; no third-party dependency or version was added.
  • Replaces deprecated URL(String) calls found during test compilation with
    URI.create(...).toURL().

For the Reviewer

Please pay particular attention to:

  • Global interceptor registration and the missing-bean guard in
    GrpcConfiguration.
  • The expected span attributes: rpc.service, rpc.method, and
    grpc.status_code.
  • The random-port capture used by the tracing integration test.

For QA

Validated locally with Bazel 9.1.1:

  • bazel build //src/control-plane-services/cloud-tasks/nvct-core:nvct_core //src/control-plane-services/cloud-tasks/nvct-core:tests passes.
  • bazel test //src/control-plane-services/cloud-tasks/nvct-core:tests --test_filter=ActuatorTracingIntegrationTest passes.
  • git diff --check passes.

No additional QA is needed.

Issues

Fixes #547

Checklist

  • I am familiar with the Contributing Guidelines.
  • I have signed off my commits for Developer Certificate of Origin (DCO) compliance.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Summary by CodeRabbit

  • New Features
    • Enabled observation-backed server-side tracing for gRPC by adding a global interceptor when none is already configured, including actuator management gRPC endpoints.
    • Added richer tracing attributes for gRPC (service, method, and status code).
  • Bug Fixes
    • Improved robustness of URL handling when generating signed JWT assertions.
  • Tests
    • Extended actuator tracing integration tests to validate server-side OpenTelemetry spans from a gRPC health check, including management gRPC endpoint discovery via runtime port capture.

@sanjay-saxena
sanjay-saxena requested a review from a team as a code owner July 29, 2026 21:50
@sanjay-saxena
sanjay-saxena requested a review from Max-NV July 29, 2026 21:50
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b9be4933-a1b0-40ee-b8f0-8f468811bb8a

📥 Commits

Reviewing files that changed from the base of the PR and between 8b6bd88 and 932c2d5.

📒 Files selected for processing (5)
  • src/control-plane-services/cloud-tasks/nvct-core/BUILD.bazel
  • src/control-plane-services/cloud-tasks/nvct-core/src/main/java/com/nvidia/nvct/configuration/GrpcConfiguration.java
  • src/control-plane-services/cloud-tasks/nvct-core/src/test/java/com/nvidia/nvct/actuator/ActuatorTracingIntegrationTest.java
  • src/control-plane-services/cloud-tasks/nvct-core/src/test/java/com/nvidia/nvct/actuator/ActuatorTracingTestConfiguration.java
  • src/control-plane-services/cloud-tasks/nvct-core/src/test/java/com/nvidia/nvct/util/NotaryServiceResponseTransformer.java

📝 Walkthrough

Walkthrough

Cloud Tasks adds Micrometer gRPC server observation instrumentation and verifies OpenTelemetry server spans from a real health-check request. Test dependencies and runtime port capture are updated, while JWT helpers use URI-based URL conversion.

Changes

gRPC tracing

Layer / File(s) Summary
Observation interceptor registration
src/control-plane-services/cloud-tasks/nvct-core/src/main/java/com/nvidia/nvct/configuration/GrpcConfiguration.java, src/control-plane-services/cloud-tasks/nvct-core/BUILD.bazel
Registers a conditional global ObservationGrpcServerInterceptor and adds the required test dependencies.
Runtime port capture and span validation
src/control-plane-services/cloud-tasks/nvct-core/src/test/java/com/nvidia/nvct/actuator/*
Captures the actuator gRPC port, performs a health check, and verifies server span attributes.

JWT URL conversion

Layer / File(s) Summary
URI-based JWT URL conversion
src/control-plane-services/cloud-tasks/nvct-core/src/test/java/com/nvidia/nvct/util/NotaryServiceResponseTransformer.java
Converts issuer and notary base URL strings with URI.create(...).toURL() before JWT creation.

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

Sequence Diagram(s)

sequenceDiagram
  participant HealthGrpc as HealthGrpc client
  participant GrpcServer as actuator gRPC server
  participant Interceptor as ObservationGrpcServerInterceptor
  participant ObservationRegistry
  participant SpanCapture as captured spans

  HealthGrpc->>GrpcServer: Send Health check
  GrpcServer->>Interceptor: Process inbound RPC
  Interceptor->>ObservationRegistry: Record server observation
  ObservationRegistry->>SpanCapture: Export RPC span
  SpanCapture-->>HealthGrpc: Assert service, method, and status
Loading

Suggested reviewers: balajinvda, max-nv, kristinapathak

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits and accurately describes the main bug fix: restoring gRPC server trace spans.
Linked Issues check ✅ Passed The interceptor registration, duplicate guard, integration test, and related test dependencies match issue #547's requirements.
Out of Scope Changes check ✅ Passed The URL conversion and Bazel dependency updates support the tracing test flow and are within the PR's stated objectives.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/observability/grpc

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

@github-actions

Copy link
Copy Markdown
Contributor

🛡️ CodeQL Analysis

🚨 Found 3 issue(s)

Severity Breakdown:

  • 🔴 Errors: 0
  • 🟡 Warnings: 0
  • 🔵 Notes: 0
📋 Top Issues

🔗 View full details in Security tab

🕐 Last updated: 2026-07-29 21:54:39 UTC | Commit: b02acff

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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
`@src/control-plane-services/cloud-tasks/nvct-core/src/test/java/com/nvidia/nvct/actuator/ActuatorTracingIntegrationTest.java`:
- Around line 125-133: Add a per-RPC deadline to the HealthGrpc blocking stub
before invoking check in ActuatorTracingIntegrationTest, using
withDeadlineAfter(...) with an appropriate short timeout and time unit so a
stalled local server fails fast while preserving the existing channel shutdown
behavior.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 91ba64e4-b4db-4211-92e4-6e8aa9778265

📥 Commits

Reviewing files that changed from the base of the PR and between ef6f96c and b02acff.

📒 Files selected for processing (5)
  • src/control-plane-services/cloud-tasks/nvct-core/BUILD.bazel
  • src/control-plane-services/cloud-tasks/nvct-core/src/main/java/com/nvidia/nvct/configuration/GrpcConfiguration.java
  • src/control-plane-services/cloud-tasks/nvct-core/src/test/java/com/nvidia/nvct/actuator/ActuatorTracingIntegrationTest.java
  • src/control-plane-services/cloud-tasks/nvct-core/src/test/java/com/nvidia/nvct/actuator/ActuatorTracingTestConfiguration.java
  • src/control-plane-services/cloud-tasks/nvct-core/src/test/java/com/nvidia/nvct/util/NotaryServiceResponseTransformer.java

@sanjay-saxena
sanjay-saxena force-pushed the fix/observability/grpc branch 2 times, most recently from ec4d4d9 to 208c699 Compare July 29, 2026 22:22
@balajinvda
balajinvda force-pushed the fix/observability/grpc branch from 208c699 to 8b6bd88 Compare July 29, 2026 23:45
Register a global Micrometer observation interceptor so inbound gRPC
requests produce OpenTelemetry server spans. Add integration coverage for
the RPC service, method, status code, and server span kind attributes.

Fixes #547

Signed-off-by: Sanjay Saxena <sasaxena@nvidia.com>
@sanjay-saxena
sanjay-saxena force-pushed the fix/observability/grpc branch from 8b6bd88 to 932c2d5 Compare July 29, 2026 23:49
@balajinvda
balajinvda enabled auto-merge July 29, 2026 23:55
@balajinvda
balajinvda disabled auto-merge July 29, 2026 23:55
@sanjay-saxena
sanjay-saxena added this pull request to the merge queue Jul 29, 2026
Merged via the queue into main with commit 077af5c Jul 30, 2026
18 checks passed
@sanjay-saxena
sanjay-saxena deleted the fix/observability/grpc branch July 30, 2026 00:30
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.

Cloud Tasks gRPC endpoints do not emit server trace spans

2 participants