Skip to content

[clickhouse] Update FindTraceIDs to populate start and end timestamps#7770

Merged
yurishkuro merged 5 commits intojaegertracing:mainfrom
mahadzaryab1:find-trace-ids-3
Dec 25, 2025
Merged

[clickhouse] Update FindTraceIDs to populate start and end timestamps#7770
yurishkuro merged 5 commits intojaegertracing:mainfrom
mahadzaryab1:find-trace-ids-3

Conversation

@mahadzaryab1
Copy link
Copy Markdown
Collaborator

@mahadzaryab1 mahadzaryab1 commented Dec 25, 2025

Which problem is this PR solving?

Description of the changes

  • This PR updates FindTraceIDs function for ClickHouse storage to populate the start and end timestamps for each trace_id. It does this by add a join clause to the search query to join on the trace_id_timestamps table which is populated by a materialized view.

How was this change tested?

  • Unit tests

Checklist

Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.53%. Comparing base (adcebfa) to head (d4c11c1).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7770   +/-   ##
=======================================
  Coverage   95.52%   95.53%           
=======================================
  Files         308      308           
  Lines       15475    15482    +7     
=======================================
+ Hits        14783    14790    +7     
  Misses        545      545           
  Partials      147      147           
Flag Coverage Δ
badger_v1 9.64% <0.00%> (-0.01%) ⬇️
badger_v2 2.02% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v1-manual 14.26% <0.00%> (-0.02%) ⬇️
cassandra-4.x-v2-auto 2.00% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v2-manual 2.00% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v1-manual 14.26% <0.00%> (-0.02%) ⬇️
cassandra-5.x-v2-auto 2.00% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v2-manual 2.00% <0.00%> (-0.01%) ⬇️
clickhouse 1.93% <0.00%> (-0.01%) ⬇️
elasticsearch-6.x-v1 18.41% <0.00%> (-0.02%) ⬇️
elasticsearch-7.x-v1 18.45% <0.00%> (-0.02%) ⬇️
elasticsearch-8.x-v1 18.61% <0.00%> (-0.02%) ⬇️
elasticsearch-8.x-v2 2.02% <0.00%> (-0.01%) ⬇️
elasticsearch-9.x-v2 2.02% <0.00%> (-0.01%) ⬇️
grpc_v1 9.51% <0.00%> (-0.01%) ⬇️
grpc_v2 2.02% <0.00%> (-0.01%) ⬇️
kafka-3.x-v2 2.02% <0.00%> (-0.01%) ⬇️
memory_v2 2.02% <0.00%> (-0.01%) ⬇️
opensearch-1.x-v1 18.49% <0.00%> (-0.02%) ⬇️
opensearch-2.x-v1 18.49% <0.00%> (-0.02%) ⬇️
opensearch-2.x-v2 2.02% <0.00%> (-0.01%) ⬇️
opensearch-3.x-v2 2.02% <0.00%> (-0.01%) ⬇️
query 2.02% <0.00%> (-0.01%) ⬇️
tailsampling-processor 0.58% <0.00%> (-0.01%) ⬇️
unittests 94.03% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
@mahadzaryab1 mahadzaryab1 added the changelog:experimental Change to an experimental part of the code label Dec 25, 2025
@mahadzaryab1 mahadzaryab1 changed the title [WIP][clickhouse] Update FindTraceIDs to populate start and end timestamps [clickhouse] Update FindTraceIDs to populate start and end timestamps Dec 25, 2025
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
t.start,
t.end
FROM spans s
LEFT JOIN trace_id_timestamps t ON s.trace_id = t.trace_id
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@yurishkuro Thoughts on a LEFT JOIN vs. an INNER JOIN? A LEFT JOIN could return some null timestamps in between updates whereas an INNER JOIN could result in some trace_ids not being returned in between updates.

@mahadzaryab1 mahadzaryab1 marked this pull request as ready for review December 25, 2025 17:40
@mahadzaryab1 mahadzaryab1 requested a review from a team as a code owner December 25, 2025 17:40
t.end
FROM spans s
LEFT JOIN trace_id_timestamps t ON s.trace_id = t.trace_id
WHERE 1=1 AND s.service_name = ? AND s.name = ? AND s.duration >= ? AND s.duration <= ? LIMIT ?`,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How is it that you don't have time bounds on the search? Time range (lookback) is the mandatory query condition

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Going to do this in the next PR

@yurishkuro yurishkuro merged commit 6401a5a into jaegertracing:main Dec 25, 2025
62 checks passed
@mahadzaryab1 mahadzaryab1 deleted the find-trace-ids-3 branch December 25, 2025 22:25
ThatDeparted2061 pushed a commit to ThatDeparted2061/jaeger that referenced this pull request Dec 31, 2025
…jaegertracing#7770)

## Which problem is this PR solving?
- Towards jaegertracing#7134

## Description of the changes
- This PR updates `FindTraceIDs` function for ClickHouse storage to
populate the start and end timestamps for each trace_id. It does this by
add a join clause to the search query to join on the trace_id_timestamps
table which is populated by a materialized view.

## How was this change tested?
- Unit tests

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `npm run lint` and `npm run test`

---------

Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: ThatDeparted2061 <harshraocodesup@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:experimental Change to an experimental part of the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants