Skip to content

chore: move otel to experimental flag#4280

Merged
NathanFlurry merged 1 commit intomainfrom
02-23-chore_move_otel_to_experimental_flag
Feb 24, 2026
Merged

chore: move otel to experimental flag#4280
NathanFlurry merged 1 commit intomainfrom
02-23-chore_move_otel_to_experimental_flag

Conversation

@NathanFlurry
Copy link
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4280 February 24, 2026 05:57 Destroyed
@railway-app
Copy link

railway-app bot commented Feb 24, 2026

🚅 Deployed to the rivet-pr-4280 environment in rivet-frontend

Service Status Web Updated (UTC)
website 😴 Sleeping (View Logs) Web Feb 24, 2026 at 6:10 am
frontend-cloud 😴 Sleeping (View Logs) Web Feb 24, 2026 at 6:08 am
frontend-inspector 😴 Sleeping (View Logs) Web Feb 24, 2026 at 6:08 am
mcp-hub ✅ Success (View Logs) Web Feb 24, 2026 at 5:58 am
ladle ❌ Build Failed (View Logs) Web Feb 24, 2026 at 5:57 am

Copy link
Member Author

NathanFlurry commented Feb 24, 2026


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@claude
Copy link

claude bot commented Feb 24, 2026

PR Review: chore: move otel to experimental flag

Overall this is a clean, focused change. Gating OTel trace persistence behind an experimental flag is a sensible approach to avoid unexpected storage consumption in production. A few issues worth addressing:


Functional Issue: NOOP_SPAN.isActive() always returns false

noop.ts returns a singleton NOOP_SPAN from every startSpan call, with isActive: () => false. The actor instance code has several guards checking span.isActive() after starting a span:

// mod.ts:783
if (!spanEnded && actionSpan.isActive()) {
    this.#traces.endSpan(actionSpan, ...);
}

// mod.ts:1325, 1351, 1384
if (runSpan.isActive()) {
    this.#traces.endSpan(runSpan, ...);
}

Since isActive() is always false, endSpan is never invoked through these paths. This is harmless because endSpan is a no-op, but it's semantically surprising: a span returned from startSpan immediately claiming to be inactive. Consider returning a span where isActive returns true, since the no-op endSpan doesn't need the guard to skip anything:

const NOOP_SPAN: SpanHandle = {
    spanId: new Uint8Array(8),
    traceId: new Uint8Array(16),
    isActive: () => true,  // Consistent with real implementation post-startSpan
};

This also avoids an implicit behavior difference: in the noop, withSpan does not set async context (correct for a no-op), so getCurrentSpan() returns null — meaning the !span check at line 1043 fires before isActive() is even reached. So no behavior gap currently, but isActive: () => false on a live span is misleading.


Minor Inconsistency: BigInt() without Math.floor() in readRangeWire

In noop.ts:

startTimeMs: BigInt(options.startMs),  // throws RangeError if float
endTimeMs: BigInt(options.endMs),

The real traces.ts does Math.floor() before converting to BigInt. While the current call sites (parseInt in the HTTP inspector, Number(bigint) in the WebSocket inspector) always produce integers, this diverges from the real implementation's defensive contract. Suggest applying Math.floor() for consistency:

startTimeMs: BigInt(Math.floor(options.startMs)),
endTimeMs: BigInt(Math.floor(options.endMs)),

Test Gap: Trace test doesn't validate span capture

The existing test "GET /inspector/traces returns trace data" in actor-inspector.ts only checks response shape, not actual span content. With the flag now off by default, this test passes even with an empty noop response. The test implicitly validated that spans were being captured, but no longer does. It may be worth noting this in a comment or adjusting the test to either:

  • Assert empty traces when RIVET_EXPERIMENTAL_OTEL is not set, or
  • Run a variant with RIVET_EXPERIMENTAL_OTEL=1 to verify actual span capture

Good Practices

  • The env var is read once at actor construction time (not per-operation), which is efficient
  • createNoopTraces is exported from both the browser stub and main index correctly
  • The comment fix in env-vars.ts (correcting the stale doc path) is a nice catch
  • Documentation in environment-variables.mdx is properly updated
  • Comments in #initializeTraces() clearly explain the rationale

@NathanFlurry NathanFlurry force-pushed the 02-23-chore_move_otel_to_experimental_flag branch from 596fc6a to f5daf97 Compare February 24, 2026 07:14
@NathanFlurry NathanFlurry marked this pull request as ready for review February 24, 2026 07:14
@NathanFlurry NathanFlurry merged commit 961ec65 into main Feb 24, 2026
12 of 22 checks passed
@NathanFlurry NathanFlurry deleted the 02-23-chore_move_otel_to_experimental_flag branch February 24, 2026 07: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.

1 participant