-
Notifications
You must be signed in to change notification settings - Fork 715
refactor: extract service graph into independent job and support INTERNAL spans #9420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Failed to generate code suggestions for PR |
Greptile OverviewGreptile SummaryFixed SQL query failure when Key Changes:
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Compactor as Compactor Job
participant Processor as Service Graph Processor
participant DB as Database
participant Search as Search Service
participant Writer as Edge Writer
Compactor->>Processor: process_service_graph()
Processor->>DB: get_trace_streams()
DB-->>Processor: List of (org_id, stream_name)
loop For each stream
Processor->>Processor: Build SQL with COALESCE for peer.service
Note over Processor: Try peer_service, attributes['peer.service'],<br/>attributes_string['peer.service']
Processor->>Search: Execute query with CTE
Note over Search: Filter span_kind IN ('2', '3')<br/>Compute client/server with COALESCE<br/>Aggregate metrics (count, errors, percentiles)
Search-->>Processor: Aggregated edges
alt Has edges
Processor->>Writer: write_sql_aggregated_edges()
Writer->>DB: Write to _o2_service_graph stream
end
end
Processor-->>Compactor: Success/Failure
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, no comments
901242f to
af9c3d8
Compare
fb54589 to
b130daa
Compare
b130daa to
eff0d53
Compare
eff0d53 to
c0b4af5
Compare
The peer.service attribute can be stored in: - peer_service column (flattened) - attributes['peer.service'] map - attributes_string['peer.service'] map Use COALESCE to try all locations. Filter NULL results in WHERE clause.
…RNAL spans
- Move service graph processor from compactor to dedicated job module
- Create `src/job/service_graph.rs` with independent lifecycle
- Remove service graph code from `src/job/compactor.rs`
- Update `src/job/mod.rs` to spawn service_graph job
- Support INTERNAL spans (span_kind='1') in addition to CLIENT/SERVER
- Remove early exit when peer attributes are missing
- Use 'internal' as fallback for peer identification
- Update SQL to include `span_kind IN ('1', '2', '3')`
This enables service graph to work with OpenObserve's internal tracing
data which uses INTERNAL spans without explicit peer.service attributes.
- Check schema for peer attributes before querying - COALESCE priority: peer_service > server_address > db_name > db_system > http_url - Fallback to 'internal' if no peer attributes - Support INTERNAL spans with exclude config - Improved UI empty state with troubleshooting
c0b4af5 to
d19bfaf
Compare
Summary
span_kind='1') in service graph topologyO2_SERVICE_GRAPH_EXCLUDE_INTERNAL_SPANSconfig flagChanges
Job Separation
src/job/service_graph.rswith independent lifecyclesrc/job/compactor.rssrc/job/mod.rsto spawn service_graph job[SERVICE_GRAPH::JOB]prefixINTERNAL Span Support
span_kind IN ('1', '2', '3')(wasIN ('2', '3'))service_nameCOALESCE(peer_expr, 'internal')'internal'as fallback for peer identificationConfiguration
O2_SERVICE_GRAPH_EXCLUDE_INTERNAL_SPANSenv variable (default:false)Motivation
Service graph was conceptually unrelated to file compaction despite living in the compactor module. Extracting it provides better separation of concerns.
OpenObserve's internal tracing produces primarily INTERNAL spans without explicit
peer.serviceattributes. Previous implementation:New implementation enables service graph to visualize internal operation topology while maintaining backward compatibility.
Test Results
With 10,000 INTERNAL spans ingested:
Topology created:
compactor → internal(19,998 requests, p50=640µs, p95=6.6ms)ingester → internal(2 requests, p50=12ms)Related
exclude_internal_spansconfig fieldTest Plan
'internal'fallback