Skip to content

Comments

[cassandra][v2] Refactor FromDbModel and ToDbModel to accept and return dbmodel.Span#7844

Open
Manik2708 wants to merge 23 commits intojaegertracing:mainfrom
Manik2708:cass-convert
Open

[cassandra][v2] Refactor FromDbModel and ToDbModel to accept and return dbmodel.Span#7844
Manik2708 wants to merge 23 commits intojaegertracing:mainfrom
Manik2708:cass-convert

Conversation

@Manik2708
Copy link
Contributor

Which problem is this PR solving?

Description of the changes

  • This PR refactors the converters to directly convert ptrace.Trace to database models of cassandra

How was this change tested?

  • Unit Tests

Checklist

@Manik2708
Copy link
Contributor Author

Mistakenly closed the last one, please review @yurishkuro

@codecov
Copy link

codecov bot commented Jan 8, 2026

Codecov Report

❌ Patch coverage is 98.66071% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.67%. Comparing base (4f2b5d3) to head (bb6e982).

Files with missing lines Patch % Lines
...rnal/storage/v2/cassandra/tracestore/to_dbmodel.go 98.46% 1 Missing and 1 partial ⚠️
...al/storage/v2/cassandra/tracestore/from_dbmodel.go 98.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7844      +/-   ##
==========================================
+ Coverage   95.48%   95.67%   +0.18%     
==========================================
  Files         316      316              
  Lines       16732    16640      -92     
==========================================
- Hits        15977    15920      -57     
+ Misses        590      569      -21     
+ Partials      165      151      -14     
Flag Coverage Δ
badger_v1 9.21% <0.00%> (+0.09%) ⬆️
badger_v2 1.34% <0.00%> (+0.01%) ⬆️
cassandra-4.x-v1-manual 13.44% <4.46%> (+0.13%) ⬆️
cassandra-4.x-v2-auto 1.33% <0.00%> (+0.01%) ⬆️
cassandra-4.x-v2-manual 1.33% <0.00%> (+0.01%) ⬆️
cassandra-5.x-v1-manual 13.44% <4.46%> (+0.13%) ⬆️
cassandra-5.x-v2-auto 1.33% <0.00%> (+0.01%) ⬆️
cassandra-5.x-v2-manual 1.33% <0.00%> (+0.01%) ⬆️
clickhouse 1.42% <0.00%> (+0.01%) ⬆️
elasticsearch-6.x-v1 17.05% <0.00%> (+0.16%) ⬆️
elasticsearch-7.x-v1 17.09% <0.00%> (+0.16%) ⬆️
elasticsearch-8.x-v1 17.24% <0.00%> (+0.16%) ⬆️
elasticsearch-8.x-v2 1.34% <0.00%> (-0.04%) ⬇️
elasticsearch-9.x-v2 1.34% <0.00%> (+0.01%) ⬆️
grpc_v1 8.16% <0.00%> (+0.07%) ⬆️
grpc_v2 1.34% <0.00%> (+0.01%) ⬆️
kafka-3.x-v2 1.34% <0.00%> (+0.01%) ⬆️
memory_v2 1.34% <0.00%> (+0.01%) ⬆️
opensearch-1.x-v1 17.13% <0.00%> (+0.16%) ⬆️
opensearch-2.x-v1 17.13% <0.00%> (+0.16%) ⬆️
opensearch-2.x-v2 1.34% <0.00%> (+0.01%) ⬆️
opensearch-3.x-v2 1.34% <0.00%> (+0.01%) ⬆️
query 1.34% <0.00%> (+0.01%) ⬆️
tailsampling-processor 0.53% <0.00%> (+<0.01%) ⬆️
unittests 94.35% <98.66%> (+0.17%) ⬆️

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.

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

Metrics Comparison Summary

Total changes across all snapshots: 32

Detailed changes per snapshot

summary_metrics_snapshot_badger

📊 Metrics Diff Summary

Total Changes: 32

  • 🆕 Added: 0 metrics
  • ❌ Removed: 32 metrics
  • 🔄 Modified: 0 metrics
  • 🚫 Excluded: 0 metrics

❌ Removed Metrics

  • jaeger_storage_badger_compaction_current_num_lsm (2 variants)
View diff sample
-jaeger_storage_badger_compaction_current_num_lsm{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_compaction_current_num_lsm{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_get_num_memtable` (2 variants)
View diff sample
-jaeger_storage_badger_get_num_memtable{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_get_num_memtable{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_get_num_user` (2 variants)
View diff sample
-jaeger_storage_badger_get_num_user{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_get_num_user{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_get_with_result_num_user` (2 variants)
View diff sample
-jaeger_storage_badger_get_with_result_num_user{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_get_with_result_num_user{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_iterator_num_user` (2 variants)
View diff sample
-jaeger_storage_badger_iterator_num_user{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_iterator_num_user{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_put_num_user` (2 variants)
View diff sample
-jaeger_storage_badger_put_num_user{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_put_num_user{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_read_bytes_lsm` (2 variants)
View diff sample
-jaeger_storage_badger_read_bytes_lsm{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_read_bytes_lsm{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_read_bytes_vlog` (2 variants)
View diff sample
-jaeger_storage_badger_read_bytes_vlog{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_read_bytes_vlog{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_read_num_vlog` (2 variants)
View diff sample
-jaeger_storage_badger_read_num_vlog{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_read_num_vlog{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_size_bytes_lsm` (2 variants)
View diff sample
-jaeger_storage_badger_size_bytes_lsm{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_size_bytes_lsm{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_size_bytes_vlog` (2 variants)
View diff sample
-jaeger_storage_badger_size_bytes_vlog{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_size_bytes_vlog{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_write_bytes_l0` (2 variants)
View diff sample
-jaeger_storage_badger_write_bytes_l0{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_write_bytes_l0{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_write_bytes_user` (2 variants)
View diff sample
-jaeger_storage_badger_write_bytes_user{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_write_bytes_user{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_write_bytes_vlog` (2 variants)
View diff sample
-jaeger_storage_badger_write_bytes_vlog{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_write_bytes_vlog{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_write_num_vlog` (2 variants)
View diff sample
-jaeger_storage_badger_write_num_vlog{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_write_num_vlog{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
- `jaeger_storage_badger_write_pending_num_memtable` (2 variants)
View diff sample
-jaeger_storage_badger_write_pending_num_memtable{name="another_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}
-jaeger_storage_badger_write_pending_num_memtable{name="some_store",otel_scope_name="jaeger-v2",otel_scope_schema_url="",otel_scope_version="",role="tracestore"}

➡️ View full metrics file

@yurishkuro yurishkuro requested a review from Copilot January 9, 2026 23:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Cassandra v2 trace store converters to work directly with dbmodel.Span instead of Jaeger protobuf models. The changes eliminate intermediate conversions and simplify the data flow by having FromDbModel and ToDbModel functions accept and return dbmodel.Span types.

Changes:

  • Refactored converter functions to use dbmodel.Span directly instead of model.Batch
  • Updated type constants in dbmodel from private to public (e.g., stringTypeStringType)
  • Removed intermediate batch grouping logic and process checksumming functionality
  • Updated test fixtures to reflect the new data structure

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/storage/v2/cassandra/tracestore/to_dbmodel.go Refactored conversion from ptrace.Traces to dbmodel.Span with direct field mappings
internal/storage/v2/cassandra/tracestore/to_dbmodel_test.go Updated tests to use dbmodel types and added edge case coverage
internal/storage/v2/cassandra/tracestore/from_dbmodel.go Simplified conversion from dbmodel.Span to ptrace.Traces, removed batch regrouping logic
internal/storage/v2/cassandra/tracestore/from_dbmodel_test.go Updated tests to work with dbmodel.Span instead of model.Batch
internal/storage/v1/cassandra/spanstore/dbmodel/model.go Exported type constants for public API usage
internal/storage/v1/cassandra/spanstore/dbmodel/converter.go Updated references to use exported constant names
internal/storage/v2/cassandra/tracestore/fixtures/cas_01.json Updated fixture to reflect dbmodel.Span structure
internal/storage/v2/cassandra/tracestore/fixtures/otel_traces_01.json Added missing flags and status fields to test data

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Manik2708 Manik2708 requested a review from yurishkuro January 12, 2026 21:13
yurishkuro pushed a commit that referenced this pull request Jan 19, 2026
…rshaller for `TraceID` (#7867)

## Which problem is this PR solving?
- Needed for: #7844

## Description of the changes
- Currently while writing snapshot tests for conversion, `TraceID` is
abruptly formatted because of array representation of it.
Unmarshaller/Marshaller will convert them to hex string.

## 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: Manik Mehta <mehtamanik96@gmail.com>
Manik2708 added a commit to Manik2708/jaeger that referenced this pull request Jan 20, 2026
…rshaller for `TraceID` (jaegertracing#7867)

## Which problem is this PR solving?
- Needed for: jaegertracing#7844

## Description of the changes
- Currently while writing snapshot tests for conversion, `TraceID` is
abruptly formatted because of array representation of it.
Unmarshaller/Marshaller will convert them to hex string.

## 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: Manik Mehta <mehtamanik96@gmail.com>
Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
@Manik2708
Copy link
Contributor Author

@yurishkuro a reminder to review this pr

Signed-off-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 15, 2026 19:14
@yurishkuro yurishkuro added the changelog:experimental Change to an experimental part of the code label Feb 15, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +26
ChildOf = "child-of"
FollowsFrom = "follows-from"

StringType = "string"
BoolType = "bool"
Int64Type = "int64"
Float64Type = "float64"
BinaryType = "binary"
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

These identifiers were made exported (ChildOf, FollowsFrom, StringType, etc.) but they don’t have doc comments. With revive enabled repo-wide, exported constants typically need comments (see e.g. index_filter.go). Please add brief comments for these exported constants (or keep them unexported if they’re not part of the intended API).

Suggested change
ChildOf = "child-of"
FollowsFrom = "follows-from"
StringType = "string"
BoolType = "bool"
Int64Type = "int64"
Float64Type = "float64"
BinaryType = "binary"
// ChildOf is the span reference type for a direct child relationship.
ChildOf = "child-of"
// FollowsFrom is the span reference type for a causal, but not direct child, relationship.
FollowsFrom = "follows-from"
// StringType indicates that a KeyValue holds a string value.
StringType = "string"
// BoolType indicates that a KeyValue holds a boolean value.
BoolType = "bool"
// Int64Type indicates that a KeyValue holds a 64-bit integer value.
Int64Type = "int64"
// Float64Type indicates that a KeyValue holds a 64-bit floating-point value.
Float64Type = "float64"
// BinaryType indicates that a KeyValue holds a binary (byte slice) value.
BinaryType = "binary"

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yurishkuro we need this?

Manik2708 and others added 2 commits February 21, 2026 03:33
Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
Copilot AI review requested due to automatic review settings February 20, 2026 22:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

linkTraceID := dbmodel.TraceID(link.TraceID())
linkSpanID := spanIDToDbSpanId(link.SpanID())
linkRefType := dbRefTypeFromLink(link)
if parentSpanID != 0 && bytes.Equal(linkTraceID[:], traceID[:]) && linkSpanID == parentSpanID {
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

linksToDbSpanRefs compares TraceIDs via bytes.Equal(linkTraceID[:], traceID[:]), but dbmodel.TraceID is an array type and can be compared directly with ==. Using direct comparison avoids slice conversions and lets you drop the bytes import.

Suggested change
if parentSpanID != 0 && bytes.Equal(linkTraceID[:], traceID[:]) && linkSpanID == parentSpanID {
if parentSpanID != 0 && linkTraceID == traceID && linkSpanID == parentSpanID {

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

dbmodel.TraceID is [16]byte and it is best compared by bytes.Equal

Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
Copilot AI review requested due to automatic review settings February 21, 2026 09:28
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
Manik2708 and others added 3 commits February 21, 2026 14:59
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
Copilot AI review requested due to automatic review settings February 21, 2026 09:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Manik2708
Copy link
Contributor Author

@yurishkuro all copilot comments are addressed! please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants