Skip to content

[ES][v1] Change the DB Tag value from string to any type #6998

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

Merged
merged 4 commits into from
Apr 10, 2025

Conversation

Manik2708
Copy link
Contributor

Which problem is this PR solving?

Description of the changes

  • We shouldn't be storing values as string in ES rather they should be stored raw but due to some unkown reason they were being stored as string so now backward compatibility should be considered for the old data and new data should be stored as raw

How was this change tested?

  • Unit and E2E Tests

Checklist

@Manik2708 Manik2708 requested a review from a team as a code owner April 7, 2025 22:57
@Manik2708 Manik2708 requested a review from pavolloffay April 7, 2025 22:57
@@ -16,11 +16,12 @@ import (
"github.com/jaegertracing/jaeger/internal/storage/elasticsearch/dbmodel"
)

func CompareJSONSpans(t *testing.T, expected *dbmodel.Span, actual *dbmodel.Span) {
sortJSONSpan(expected)
sortJSONSpan(actual)
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 don't know the reason of testing JSON Spans this way, but this way was leading to a problem that JSON decode treats every number as float64 which was failing the tests. Therefore we shouldn't be decoding and then asserting rather it should be encoding the expected span and then asserting!

Copy link
Member

Choose a reason for hiding this comment

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

I think if you're getting differences there may be something wrong with the translation. Despite the name "JSON" the function CompareJSONSpans was comparing two db spans as Go objects. After your change this function is no different than testJSONEncoding

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 don't think so as the problem lies in unmarshaling, the expected span is unmarshalled from the fixture data, when we change the values from string to any in fixtures (that is change "12345" to 12345) then it change it's type to float64 from int64 so in test the expected span expects float64 everywhere where it should have expected int64. Earlier it was not a problem because every value was a string!

Copy link
Member

Choose a reason for hiding this comment

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

fair, but now this function is no different from testJSONEncoding

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we remove it?

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 Can we remove it? Or should we employ some other strategy like after marshalling converting all the int back to int64 from float64? These 2 PRs are blocker for embedding tagDotReplacement so can you please provide an overview over this?

@Manik2708
Copy link
Contributor Author

Integration tests have been passed and unit tests are passing locally, can we re-run them in CI?

Copy link

codecov bot commented Apr 7, 2025

Codecov Report

Attention: Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.99%. Comparing base (180cdfb) to head (c5e4193).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...al/storage/v1/elasticsearch/spanstore/to_domain.go 97.67% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6998      +/-   ##
==========================================
+ Coverage   95.97%   95.99%   +0.02%     
==========================================
  Files         346      346              
  Lines       20429    20474      +45     
==========================================
+ Hits        19606    19655      +49     
+ Misses        620      618       -2     
+ Partials      203      201       -2     
Flag Coverage Δ
badger_v1 10.48% <0.00%> (-0.05%) ⬇️
badger_v2 2.17% <0.00%> (-0.02%) ⬇️
cassandra-4.x-v1-manual 15.77% <0.00%> (-0.08%) ⬇️
cassandra-4.x-v2-auto 2.16% <0.00%> (-0.02%) ⬇️
cassandra-4.x-v2-manual 2.16% <0.00%> (-0.02%) ⬇️
cassandra-5.x-v1-manual 15.77% <0.00%> (-0.08%) ⬇️
cassandra-5.x-v2-auto 2.16% <0.00%> (-0.02%) ⬇️
cassandra-5.x-v2-manual 2.16% <0.00%> (-0.02%) ⬇️
elasticsearch-6.x-v1 20.87% <63.46%> (+0.11%) ⬆️
elasticsearch-7.x-v1 20.95% <63.46%> (+0.11%) ⬆️
elasticsearch-8.x-v1 21.13% <63.46%> (+0.11%) ⬆️
elasticsearch-8.x-v2 2.17% <0.00%> (-0.02%) ⬇️
grpc_v1 11.56% <0.00%> (-0.06%) ⬇️
grpc_v2 8.43% <0.00%> (-0.05%) ⬇️
kafka-3.x-v1 10.77% <0.00%> (-0.06%) ⬇️
kafka-3.x-v2 2.17% <0.00%> (-0.02%) ⬇️
memory_v2 2.17% <0.00%> (-0.02%) ⬇️
opensearch-1.x-v1 21.00% <63.46%> (+0.11%) ⬆️
opensearch-2.x-v1 21.00% <63.46%> (+0.11%) ⬆️
opensearch-2.x-v2 2.17% <0.00%> (-0.02%) ⬇️
tailsampling-processor 0.59% <0.00%> (-0.01%) ⬇️
unittests 94.79% <98.07%> (+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.

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

there are a lot of untested/uncovered code paths, can we not add table driven tests to capture them?

@Manik2708
Copy link
Contributor Author

there are a lot of untested/uncovered code paths, can we not add table driven tests to capture them?

@yurishkuro Unit Tests have failed due to unknown reason, can you please re-run them in CI to see the real code coverage?

@Manik2708 Manik2708 requested a review from yurishkuro April 8, 2025 17:57
@yurishkuro yurishkuro enabled auto-merge April 10, 2025 02:30
@yurishkuro yurishkuro added this pull request to the merge queue Apr 10, 2025
Merged via the queue into jaegertracing:main with commit 1eac31e Apr 10, 2025
56 of 57 checks passed
amilbcahat pushed a commit to amilbcahat/jaeger that referenced this pull request May 4, 2025
…racing#6998)

## Which problem is this PR solving?
- Discussed in jaegertracing#6994 

## Description of the changes
- We shouldn't be storing values as string in ES rather they should be
stored raw but due to some unkown reason they were being stored as
string so now backward compatibility should be considered for the old
data and new data should be stored as raw

## How was this change tested?
- Unit and E2E 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: Manik2708 <[email protected]>
amilbcahat pushed a commit to amilbcahat/jaeger that referenced this pull request May 4, 2025
…racing#6998)

## Which problem is this PR solving?
- Discussed in jaegertracing#6994

## Description of the changes
- We shouldn't be storing values as string in ES rather they should be
stored raw but due to some unkown reason they were being stored as
string so now backward compatibility should be considered for the old
data and new data should be stored as raw

## How was this change tested?
- Unit and E2E 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: Manik2708 <[email protected]>
Signed-off-by: amol-verma-allen <[email protected]>
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