fix(telemetry): updated telemetry, added nested sanitization, added granular trace spans for logs and updated UI#1627
Merged
waleedlatif1 merged 8 commits intostagingfrom Oct 14, 2025
Merged
Conversation
added 5 commits
October 14, 2025 15:31
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
Greptile Overview
Summary
This PR significantly enhances the telemetry infrastructure by migrating from a basic implementation to a comprehensive OpenTelemetry-based system with proper semantic conventions for GenAI operations.
Key changes:
- Refactored telemetry from
lib/telemetry.tsinto a dedicatedlib/telemetry/tracer.tswith GenAI semantic conventions - Implemented client-side event batching (10s intervals or 50 events) with nested sanitization to reduce overhead
- Added OpenTelemetry trace span generation from workflow execution logs with proper parent-child relationships
- Enhanced trace spans UI with new modular components (
trace-spans.tsx,trace-span-item.tsx) for better visualization - Improved token normalization to handle multiple formats (object with input/output/prompt/completion fields)
- Added platform event tracking for workflow deployment, undeployment, and execution outcomes
- Updated batch processor settings for better performance (2048 queue size, 512 batch size)
Technical improvements:
- Streaming duration calculation now correctly extends to block end time
- Trace span building handles nested workflows and iteration blocks properly
- Client-side telemetry uses
navigator.sendBeaconfor reliable delivery before page unload
Confidence Score: 4/5
- Safe to merge with minor style improvements recommended
- The PR implements a comprehensive telemetry refactoring with proper error handling and privacy considerations. The code is well-structured with good separation of concerns. However, there are several type assertions to
anythat violate the project's custom instruction (c63aedff-69e6-48d8-81cf-9763416ee01c), and the nested sanitization could be more robust by scanning string values for sensitive patterns. These are non-critical style issues that don't affect functionality. - Pay attention to
apps/sim/lib/telemetry/tracer.tsandapps/sim/instrumentation-client.tsfor type safety and sanitization improvements
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/lib/telemetry/tracer.ts | 5/5 | New comprehensive OpenTelemetry tracer implementation with semantic conventions for GenAI operations - well-structured with proper error handling |
| apps/sim/instrumentation-client.ts | 4/5 | Client-side telemetry refactored to use event batching and nested sanitization - improved performance but sanitization could be more robust |
| apps/sim/lib/logs/execution/trace-spans/trace-spans.ts | 5/5 | Enhanced trace span building with improved token normalization and streaming duration fixes |
| apps/sim/app/workspace/[workspaceId]/logs/components/trace-spans/trace-spans.tsx | 5/5 | New comprehensive trace spans UI component with timeline visualization, filtering, and responsive design |
Sequence Diagram
sequenceDiagram
participant Client as Browser Client
participant API as Telemetry API
participant Collector as OTel Collector
participant Executor as Workflow Executor
participant Logger as Logging Session
participant Tracer as OTel Tracer
Note over Client: Client-side Telemetry
Client->>Client: Batch events (10s or 50 events)
Client->>Client: Sanitize events (remove sensitive data)
Client->>API: POST /api/telemetry (batch)
API->>API: Validate & sanitize data
API->>Collector: Forward to OTel endpoint
Note over Executor,Tracer: Server-side Workflow Execution
Executor->>Logger: Start workflow execution
Logger->>Logger: Create execution log entry
Executor->>Executor: Execute workflow blocks
Executor->>Logger: Log block executions
Logger->>Logger: Build trace spans from logs
Executor->>Logger: Complete workflow execution
Logger->>Tracer: createOTelSpansForWorkflowExecution()
Tracer->>Tracer: Convert TraceSpans to OTel spans
Tracer->>Collector: Export spans via BatchSpanProcessor
Logger->>Tracer: trackPlatformEvent('workflow.executed')
Tracer->>Collector: Send platform event span
Additional Comments (1)
-
apps/sim/lib/logs/execution/trace-spans/trace-spans.ts, line 118-150 (link)style: type assertion to
any- consider defining a proper TokenData type interface instead of usinganyContext Used: Context from
dashboard- Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used... (source)
28 files reviewed, 3 comments
Sg312
pushed a commit
that referenced
this pull request
Oct 15, 2025
…ranular trace spans for logs and updated UI (#1627) * feat(logs): updated telemetry, added nested sanitization, added granular trace spans for logs and updated UI * refactor trace spans into separate components * remove any's from tool defs * updated UI and overlayed spans * cleanup * ack PR comments * stricter type safety * clean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
updated telemetry, added nested sanitization, added granular trace spans for logs and updated UI
Type of Change
Testing
Tested manually
Checklist