Skip to content

fix(webapp): add overridesBySpanId and environmentId filter for self-hosted OTEL spans#16

Open
deepshekhardas wants to merge 1 commit into
mainfrom
fix/2821-selfhosted-otel-spans
Open

fix(webapp): add overridesBySpanId and environmentId filter for self-hosted OTEL spans#16
deepshekhardas wants to merge 1 commit into
mainfrom
fix/2821-selfhosted-otel-spans

Conversation

@deepshekhardas
Copy link
Copy Markdown
Owner

@deepshekhardas deepshekhardas commented Jun 1, 2026

Fixes triggerdotdev#2821

Changes

  • Added \environmentId\ filter to \ indTraceEvents\ queries so self-hosted instances don't mix spans across environments
  • Added \ raceId\ filter to \getSpanEvent\ for precise span lookup
  • Collects \overridesBySpanId\ (cancelled, isError, duration overrides) from ancestor spans and returns them in \getTraceSummary\
  • Imported \SpanOverride\ type

Root cause

Self-hosted instances were not filtering span queries by \environmentId, causing OpenTelemetry spans to not display in timeline.


Summary by cubic

Fixes triggerdotdev#2821. Scopes OTEL trace queries to the current environment and surfaces span overrides so self-hosted timelines show the correct spans.

  • Bug Fixes
    • Filter findTraceEvents by environmentId to stop cross-environment span mixing.
    • Filter getSpanEvent by traceId (when provided) for precise span lookup.
    • Return overridesBySpanId in getTraceSummary (cancelled, isError, duration) derived from ancestor spans.

Written for commit b0a7682. Summary will update on new commits.

Review in cubic

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/webapp/app/v3/eventRepository/eventRepository.server.ts">

<violation number="1" location="apps/webapp/app/v3/eventRepository/eventRepository.server.ts:996">
P1: `traceId` is optional in `#getSpanEvent`, so ancestor traversal still performs unscoped span lookups. This can attach parents from another trace when span IDs collide, producing incorrect span status and duration overrides.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

}: {
storeTable: TaskEventStoreTable;
spanId: string;
traceId?: string;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: traceId is optional in #getSpanEvent, so ancestor traversal still performs unscoped span lookups. This can attach parents from another trace when span IDs collide, producing incorrect span status and duration overrides.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/webapp/app/v3/eventRepository/eventRepository.server.ts, line 996:

<comment>`traceId` is optional in `#getSpanEvent`, so ancestor traversal still performs unscoped span lookups. This can attach parents from another trace when span IDs collide, producing incorrect span status and duration overrides.</comment>

<file context>
@@ -972,22 +985,29 @@ export class EventRepository implements IEventRepository {
   }: {
     storeTable: TaskEventStoreTable;
     spanId: string;
+    traceId?: string;
     environmentId: string;
     startCreatedAt: Date;
</file context>

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.

bug: OpenTelemetry Spans Not Displaying in Self-Hosted Instance Timeline

1 participant