Skip to content

feat(vm): export driver traces over OTLP - #2564

Merged
krishicks merged 1 commit into
mainfrom
hicks/push-nkmtsusunlnk
Aug 3, 2026
Merged

feat(vm): export driver traces over OTLP#2564
krishicks merged 1 commit into
mainfrom
hicks/push-nkmtsusunlnk

Conversation

@krishicks

@krishickskrishicks commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Continue distributed traces across the gateway-to-driver process boundary and export VM driver spans to the same OTLP/gRPC collector. The driver reports as the distinct openshell-driver-vm service.

Updated the gateway architecture and configuration reference with a generic external-driver forwarding contract.

image

Related Issue

Refs #2507

Changes

Instrumented:

  • Every RemoteComputeDriver RPC injects the active W3C trace context into tonic metadata. Managed VM readiness and runtime initialization give startup capability probes stable parent operations rather than isolated root spans.
  • A tonic service layer creates fixed, low-cardinality server spans for every ComputeDriver RPC. New handlers inherit tracing automatically; failures record OpenTelemetry error status and the gRPC status code.
  • Background provisioning remains attached to CreateSandbox after the RPC returns without extending the RPC span lifetime.
  • Provisioning records image preparation, bootstrap image resolution, overlay preparation, lifecycle configuration, pre-launch hooks, guest preparation, and launcher spawn as child spans.
  • VM startup reconciliation roots one trace for the persisted-sandbox scan, with per-sandbox restore and provision operations beneath it. The root remains open until all spawned restore tasks finish.
  • Delete cleanup records its own child operation.

Design notes:

  • The gateway forwards its configured OTLP endpoint to managed external drivers. SDK OTEL_* variables continue to own sampling, batching, limits, headers, and transport tuning.
  • The VM driver has its own tracer provider and service resource so trace backends preserve the service boundary.
  • RPC operation names come from an explicit method mapping, keeping cardinality bounded without parsing the protobuf descriptor set at runtime.
  • Propagation uses a remote SpanContext for spawned provisioning. This keeps one trace while allowing the CreateSandbox server span to finish when the RPC response is sent.
  • Startup restoration is independent of gateway requests. It begins at the VM driver reconciliation span rather than attaching to an unrelated RPC.
  • Existing tracing events remain on the logging path. The OpenTelemetry layer exports spans only and excludes the SDK exporter callsites to avoid recursive traces.
  • Export configuration failures do not prevent the driver from serving, and buffered spans are drained during graceful shutdown.
  • Trace fields identify drivers, sandboxes, images, lifecycle phases, and gRPC outcomes without recording credentials, sandbox tokens, or request query parameters.

Testing

  • mise run pre-commit passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

@github-actions

Copy link
Copy Markdown

@krishickskrishicks changed the title feat(vm): export driver traces over OTLPfeat(vm): export vm driver traces over OTLPJul 30, 2026
@krishickskrishicks changed the title feat(vm): export vm driver traces over OTLPfeat(vm): export driver traces over OTLPJul 30, 2026
@krishicks
krishicksforce-pushed the hicks/push-nkmtsusunlnk branch from 498b495 to 32b368bCompareJuly 30, 2026 21:39
@krishicks
krishicks marked this pull request as draft July 30, 2026 22:09
@copy-pr-bot

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@krishicks
krishicksforce-pushed the hicks/push-nkmtsusunlnk branch from 32b368b to 47cd4ebCompareJuly 30, 2026 22:57
@copy-pr-bot

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@krishicks
krishicksforce-pushed the hicks/push-nkmtsusunlnk branch 2 times, most recently from 72dfb6a to 43cce78CompareJuly 31, 2026 20:05
@krishicks
krishicks marked this pull request as ready for review July 31, 2026 20:06
@krishicks
krishicksforce-pushed the hicks/push-nkmtsusunlnk branch 4 times, most recently from 5faf418 to c3de0c8CompareAugust 3, 2026 15:50
Comment threadbazel-bin Outdated
@krishicks
krishicksforce-pushed the hicks/push-nkmtsusunlnk branch 3 times, most recently from 9b888d6 to d4ae496CompareAugust 3, 2026 16:46
Comment threadcrates/openshell-server/src/compute/vm.rs
@krishicks
krishicksforce-pushed the hicks/push-nkmtsusunlnk branch from d4ae496 to 2bad42fCompareAugust 3, 2026 16:54

@matthewgrossmanmatthewgrossman 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.

Generated with help from Codex.

Comment threadcrates/openshell-driver-vm/src/driver.rs Outdated
Comment threadcrates/openshell-driver-vm/src/main.rs

@matthewgrossmanmatthewgrossman 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.

Generated with help from Codex.

Comment threadcrates/openshell-driver-vm/src/otel_tracing.rs
Comment threadcrates/openshell-driver-vm/src/driver.rs
@krishicks
krishicksforce-pushed the hicks/push-nkmtsusunlnk branch from 2bad42f to 98659dbCompareAugust 3, 2026 18:09
Continue distributed traces across the gateway-to-driver process boundary and
export VM driver spans to the same OTLP/gRPC collector. The driver reports as
the distinct openshell-driver-vm service.
Updated the gateway architecture and configuration reference with a generic
external-driver forwarding contract.
Instrumented:
- Every RemoteComputeDriver RPC injects the active W3C trace context into
tonic metadata. Managed VM readiness and runtime initialization give startup
capability probes stable parent operations rather than isolated root spans.
- A tonic service layer creates fixed, low-cardinality server spans for every
ComputeDriver RPC. New handlers inherit tracing automatically; failures record
OpenTelemetry error status and the gRPC status code.
- Background provisioning remains attached to CreateSandbox after the RPC
returns without extending the RPC span lifetime.
- Provisioning records image preparation, bootstrap image resolution, overlay
preparation, lifecycle configuration, pre-launch hooks, guest preparation,
and launcher spawn as child spans.
- VM startup reconciliation roots one trace for the persisted-sandbox scan,
with per-sandbox restore and provision operations beneath it. The root remains
open until all spawned restore tasks finish.
- Delete cleanup records its own child operation.
Design notes:
- The gateway forwards its configured OTLP endpoint to managed external
drivers. SDK `OTEL_*` variables continue to own sampling, batching, limits,
headers, and transport tuning.
- The VM driver has its own tracer provider and service resource so trace
backends preserve the service boundary.
- RPC operation names come from an explicit method mapping, keeping cardinality
bounded without parsing the protobuf descriptor set at runtime.
- Propagation uses a remote SpanContext for spawned provisioning. This keeps
one trace while allowing the CreateSandbox server span to finish when the
RPC response is sent.
- Startup restoration is independent of gateway requests. It begins at the VM
driver reconciliation span rather than attaching to an unrelated RPC.
- Existing tracing events remain on the logging path. The OpenTelemetry layer
exports spans only and excludes the SDK exporter callsites to avoid recursive
traces.
- Export configuration failures do not prevent the driver from serving, and
buffered spans are drained during graceful shutdown.
- Trace fields identify drivers, sandboxes, images, lifecycle phases, and gRPC
outcomes without recording credentials, sandbox tokens, or request query
parameters.
Refs #2507
Signed-off-by: Kris Hicks <khicks@nvidia.com>
@krishicks
krishicksforce-pushed the hicks/push-nkmtsusunlnk branch from 98659db to d50ac12CompareAugust 3, 2026 18:40
@krishicks

Copy link
Copy Markdown
CollaboratorAuthor

I think all the feedback has been addressed.

@matthewgrossmanmatthewgrossman 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.

lgtm1

@krishicks
krishicks enabled auto-merge August 3, 2026 20:52
@krishicks
krishicks added this pull request to the merge queueAug 3, 2026
Merged via the queue into main with commit 8328412Aug 3, 2026
31 checks passed
@krishicks
krishicks deleted the hicks/push-nkmtsusunlnk branch August 3, 2026 21:03
Sign up for freeto 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

@krishicks@matthewgrossman@SDAChess