Skip to content

Conversation

@Manik2708
Copy link
Contributor

Which problem is this PR solving?

Description of the changes

  • This marks the first step to upgrade cassandra backend to v2. The v1 CoreSpanWriter is seperated from v1 SpanWriter

How was this change tested?

  • Unit and Integration tests

Checklist

@Manik2708 Manik2708 requested a review from a team as a code owner December 5, 2025 12:10
@Manik2708 Manik2708 requested a review from joe-elliott December 5, 2025 12:10
return s.operationNamesWriter(operation)
}

func epochMicrosecondsAsTime(ts int64) time.Time {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am unsure about this. Should I use the conversion available in model? As then linter is giving an error of overflowing as we need to convert int32 to uint32 and inside that function unit32 is again converted to int32

@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.55%. Comparing base (3003a5c) to head (ee4c5ba).
⚠️ Report is 19 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7699      +/-   ##
==========================================
+ Coverage   96.54%   96.55%   +0.01%     
==========================================
  Files         384      385       +1     
  Lines       19511    19531      +20     
==========================================
+ Hits        18837    18859      +22     
+ Misses        489      487       -2     
  Partials      185      185              
Flag Coverage Δ
badger_v1 8.79% <0.00%> (-0.02%) ⬇️
badger_v2 1.72% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v1-manual 12.68% <75.00%> (+0.14%) ⬆️
cassandra-4.x-v2-auto 1.71% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v2-manual 1.71% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v1-manual 12.68% <75.00%> (+0.14%) ⬆️
cassandra-5.x-v2-auto 1.71% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v2-manual 1.71% <0.00%> (-0.01%) ⬇️
clickhouse 1.65% <0.00%> (-0.01%) ⬇️
elasticsearch-6.x-v1 16.70% <0.00%> (-0.04%) ⬇️
elasticsearch-7.x-v1 16.73% <0.00%> (-0.04%) ⬇️
elasticsearch-8.x-v1 16.88% <0.00%> (-0.04%) ⬇️
elasticsearch-8.x-v2 1.72% <0.00%> (-0.01%) ⬇️
elasticsearch-9.x-v2 1.72% <0.00%> (-0.01%) ⬇️
grpc_v1 10.75% <0.00%> (-0.03%) ⬇️
grpc_v2 1.72% <0.00%> (-0.01%) ⬇️
kafka-3.x-v1 10.22% <0.00%> (-0.03%) ⬇️
kafka-3.x-v2 1.72% <0.00%> (-0.01%) ⬇️
memory_v2 1.72% <0.00%> (-0.01%) ⬇️
opensearch-1.x-v1 16.77% <0.00%> (-0.04%) ⬇️
opensearch-2.x-v1 16.77% <0.00%> (-0.04%) ⬇️
opensearch-2.x-v2 1.72% <0.00%> (-0.01%) ⬇️
opensearch-3.x-v2 1.72% <0.00%> (-0.01%) ⬇️
query 1.72% <0.00%> (-0.01%) ⬇️
tailsampling-processor 0.49% <0.00%> (-0.01%) ⬇️
unittests 95.42% <77.77%> (-0.03%) ⬇️

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 Dec 5, 2025

Metrics Comparison Summary

Total changes across all snapshots: 53

Detailed changes per snapshot

summary_metrics_snapshot_cassandra

📊 Metrics Diff Summary

Total Changes: 53

  • 🆕 Added: 0 metrics
  • ❌ Removed: 53 metrics
  • 🔄 Modified: 0 metrics

❌ Removed Metrics

  • http_server_request_body_size_bytes (18 variants)
View diff sample
-http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="+Inf",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="0",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="10",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="100",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="1000",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="10000",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="25",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
...
- `http_server_request_duration_seconds` (17 variants)
View diff sample
-http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="+Inf",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="0.005",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="0.01",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="0.025",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="0.05",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="0.075",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="0.1",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
...
- `http_server_response_body_size_bytes` (18 variants)
View diff sample
-http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="+Inf",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="0",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="10",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="100",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="1000",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="10000",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
-http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="25",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.63.0",server_address="localhost",server_port="13133",url_scheme="http"}
...

➡️ View full metrics file

@yurishkuro
Copy link
Member

I don't follow why there are business logic changes in this PR if the objective is just refactoring to make it reusable?

@Manik2708
Copy link
Contributor Author

I don't follow why there are business logic changes in this PR if the objective is just refactoring to make it reusable?

There are no business logic changes in this PR. It's just that we implemented CoreSpanWriter which accepts dbmodel.Span (very similar to Elasticsearch approach)

@yurishkuro
Copy link
Member

There are no business logic changes in this PR. I

For example, this is removed. How is that not a business logic change?

tagFilter            dbmodel.TagFilter

@Manik2708
Copy link
Contributor Author

There are no business logic changes in this PR. I

For example, this is removed. How is that not a business logic change?

tagFilter            dbmodel.TagFilter

That is removed from CoreSpanWriter and added to SpanWriterV1. This is done because tagFilter is used for filtering tag from model.Span, which should not be the part of core writer but that of v1 writer

@yurishkuro
Copy link
Member

which should not be the part of core writer but that of v1 writer

why?

@Manik2708
Copy link
Contributor Author

which should not be the part of core writer but that of v1 writer

why

tagFilter is used in this method:

for _, v := range dbmodel.GetAllUniqueTags(span, s.tagFilter) {
which is using model.Span, that means it is used for conversion of Tags to dbmodel.TagInsertion and conversion should be in v1 writer not in core writer

@yurishkuro
Copy link
Member

filtering tags is not about conversion but about indexing or not indexing them in the db

@Manik2708
Copy link
Contributor Author

filtering tags is not about conversion but about indexing or not indexing them in the db

Yes but what we need is dbmodel.TagInsertion from model.Span.Tags. Should I try extracting TagInsertion from dbmodel.Span.Tags rather than from model.Span.Tags?

@Manik2708
Copy link
Contributor Author

filtering tags is not about conversion but about indexing or not indexing them in the db

Yes but what we need is dbmodel.TagInsertion from model.Span.Tags. Should I try extracting TagInsertion from dbmodel.Span.Tags rather than from model.Span.Tags?

As that would need to refactor the whole TagFilter interface. Should we do that?

float64Type = "float64"
binaryType = "binary"
spanKindKey = "span.kind"
FirehoseFlag = int32(8)
Copy link
Member

Choose a reason for hiding this comment

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

this is not the same kind of constant, why group it with others?

Suggested change
FirehoseFlag = int32(8)
FirehoseFlag = int32(8)

}

if span.Flags.IsFirehoseEnabled() {
if dbmodel.IsFirehoseEnabled(ds) {
Copy link
Member

Choose a reason for hiding this comment

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

this logic can be dropped altogether, there is no "firehose" bit in OTLP trace state flags.

@yurishkuro
Copy link
Member

As that would need to refactor the whole TagFilter interface. Should we do that?

We can change that interface to work entirely on the dbmodel input.

@Manik2708
Copy link
Contributor Author

As that would need to refactor the whole TagFilter interface. Should we do that?

We can change that interface to work entirely on the dbmodel input.

@yurishkuro I was trying to refactor the TagFilter. The only problem is that, we have to implement Compare, Equal and AsString for db.KeyValue. This is not very hard but I just want to confirm whether should we implement them (we need them for sorting)

@yurishkuro
Copy link
Member

it's fine

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants