Skip to content

feat(pi): trace Pi Durable with OpenTelemetry - #385

Merged
eersnington merged 1 commit into
mainfrom
feat/pi-otel-traces
Nov 5, 2026
Merged

eersnington merged 1 commit into
mainfrom
feat/pi-otel-traces

Conversation

@eersnington

@eersnington eersnington commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Closes #370. Tracing is built in, so pi() has no telemetry option.

agent/prompt                                 the caller's trace
└── invoke_agent pi

pi.durable.submit                            the run's trace, linked to agent/prompt
├── pi.durable.phase  pi.generation prepare
├── pi.durable.phase  pi.generation request
│   └── pi.durable.phase  pi.tool call
│       └── app.lookup                       an app span
└── pi.durable.phase  pi.generation tools
  • packages/pi/src/tracing.ts implements Pi's TelemetryContext over @opentelemetry/api. Harness.open gets it as telemetry.
  • Each run is its own trace, linked to its caller. Root spans use ROOT_CONTEXT, so a background phase cannot nest under an unrelated action.
  • A run keeps its trace ID across retries and actor sleeps, because Pi stores traceparent with its tasks. With no SDK, nothing is stored.
  • actorSqlite runs Pi's storage through c.run.runOutsideWorkflowSpan. The app's own c.db calls still export rivet.sqlite.* while an action is open.
  • Every OpenTelemetry call is guarded, so a broken tracer cannot break a run.
  • Docs: exporting Pi's spans needs the NodeSDK step. The environment variable alone exports only RivetKit's spans.
  • Security: a failed span records error.type and drops the message, because Pi's diagnostics can contain caller content.

On upgrade

Apps that already run NodeSDK start exporting Pi's spans, about 10 per prompt. Pi's storage no longer exports rivet.sqlite.* spans. There is no switch for Pi's spans alone.


This is part 1 of 2 in a stack:

@railway-app

railway-app Bot commented Nov 5, 2026

Copy link
Copy Markdown

This PR was not deployed automatically as @eersnington does not have access to the Railway project.

In order to get automatic PR deploys, please add @eersnington to your workspace on Railway.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

📟 Pip-Boy · a718407

📦 Packages · fresh npm install resolve, no lockfile · this PR vs base

No notable install size, dependency, or entrypoint changes across 10 packages.

All 10 packages · linux-x64-gnu
package (linux-x64-gnu) @latest base this PR Δ vs base packages
@rivet-dev/pi 372.8 MB 381.9 MB 381.9 MB +17.7 KB (+0.0%) 220 (0)
@rivet-dev/sandbox-adapter 113.8 KB 114.5 KB 114.5 KB 0 1 (0)
@sandbox-agent/cli-shared 27.2 KB 27.2 KB 27.2 KB 0 1 (0)
@sandbox-agent/persist-indexeddb 12.4 KB 12.4 KB 12.4 KB 0 1 (0)
@sandbox-agent/persist-postgres 12.3 KB 12.3 KB 12.3 KB 0 1 (0)
@sandbox-agent/persist-rivet 12.2 KB 12.2 KB 12.2 KB 0 1 (0)
@sandbox-agent/persist-sqlite 12.3 KB 12.3 KB 12.3 KB 0 1 (0)
@sandbox-agent/react 41.6 MB 41.9 MB 41.9 MB 0 15 (0)
acp-http-client 6.7 MB 6.7 MB 6.7 MB 0 3 (0)
sandbox-agent 31.0 MB 31.0 MB 31.0 MB 0 8 (0)

🧹 Rust dependencies

Skipped: this PR doesn't change any Rust code or dependencies.

🦀 Binaries

Skipped: this PR doesn't change any Rust code.

⏱ Timing

job wall time slowest step
changes 21s checkout · 16s
zizmor 16s checkout · 11s
footprint 3m30s Run pnpm --dir sandbox-agent install --frozen-lockfile · 1m39s
⏭ native · ${{ matrix.platform }} — skipped
⏭ hygiene — skipped
⏭ self-test — skipped
report 33s setup-node · 11s
🔭 Full CI trace for this commit

One OpenTelemetry trace of CI and Pip-Boy for a718407: every job and step, with the sizes above attached. Run after CI finishes.

pnpm install --frozen-lockfile --filter 'pipboy...'
pnpm --filter pipboy pipboy trace --sha a71840742a917db24549a68cd79a24a8ca0062c4

Add --otlp <url> to send it to any OTLP/HTTP collector.

Agent instruction: From a rivet-dev/agents checkout, run the commands above, then read the trace file the last command prints. List the slowest jobs and steps and explain where CI time went.

@eersnington
eersnington merged commit bee0161 into main Nov 5, 2026
10 of 11 checks passed
@eersnington
eersnington deleted the feat/pi-otel-traces branch November 5, 2026 14:39
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.

Expose Pi Durable native telemetry through pi()

1 participant