Skip to content

[refractor] Switch to enums for ES mappings #6091

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

Conversation

Saumya40-codes
Copy link
Contributor

@Saumya40-codes Saumya40-codes commented Oct 15, 2024

Which problem is this PR solving?

Description of the changes

  • Currently in plugin/storage/es/mappings/mapping.go we are using bare string inorder to for the file mapping. This PR refractors this approach to use enums instead of string

How was this change tested?

  • running go test in respective files/directories

Checklist

@yurishkuro yurishkuro changed the title refractor: switch to enums for ES mappings [refractor] Switch to enums for ES mappings Oct 15, 2024
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.92%. Comparing base (bec885e) to head (7d1ccdd).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
cmd/es-rollover/app/init/action.go 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6091      +/-   ##
==========================================
- Coverage   96.93%   96.92%   -0.01%     
==========================================
  Files         352      352              
  Lines       16719    16742      +23     
==========================================
+ Hits        16206    16227      +21     
- Misses        329      330       +1     
- Partials      184      185       +1     
Flag Coverage Δ
badger_v1 7.97% <0.00%> (-0.02%) ⬇️
badger_v2 1.84% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v1 15.71% <0.00%> (-0.04%) ⬇️
cassandra-4.x-v2 1.77% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v1 15.71% <0.00%> (-0.04%) ⬇️
cassandra-5.x-v2 1.77% <0.00%> (-0.01%) ⬇️
elasticsearch-6.x-v1 19.10% <51.35%> (+0.03%) ⬆️
elasticsearch-7.x-v1 19.16% <51.35%> (+0.03%) ⬆️
elasticsearch-8.x-v1 19.34% <51.35%> (+0.02%) ⬆️
elasticsearch-8.x-v2 1.83% <0.00%> (-0.02%) ⬇️
grpc_v1 9.35% <0.00%> (-0.03%) ⬇️
grpc_v2 7.10% <0.00%> (-0.02%) ⬇️
kafka-v1 9.66% <0.00%> (-0.03%) ⬇️
kafka-v2 1.84% <0.00%> (-0.01%) ⬇️
memory_v2 1.84% <0.00%> (-0.01%) ⬇️
opensearch-1.x-v1 19.22% <51.35%> (+0.06%) ⬆️
opensearch-2.x-v1 19.21% <51.35%> (+0.03%) ⬆️
opensearch-2.x-v2 1.83% <0.00%> (-0.02%) ⬇️
tailsampling-processor 0.49% <0.00%> (-0.01%) ⬇️
unittests 95.74% <95.74%> (-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.

@yurishkuro
Copy link
Member

Patch coverage is 61.70213% with 18 lines in your changes missing coverage.

Can we improve test coverage for the new code?

@Saumya40-codes
Copy link
Contributor Author

Patch coverage is 61.70213% with 18 lines in your changes missing coverage.

Can we improve test coverage for the new code?

Should we add tests for MappingTypeFromString function? I'm not seeing any other way to make it get into test coverages of mapping_test

@yurishkuro
Copy link
Member

The codecov comment #6091 (comment) shows all missing coverage. Is there any reason not to test all gaps?

@Saumya40-codes
Copy link
Contributor Author

Saumya40-codes commented Oct 15, 2024

The codecov comment #6091 (comment) shows all missing coverage. Is there any reason not to test all gaps?

We were missing out on testing MappingTypeFromString part which is now covered
I think it should be good now!

@yurishkuro yurishkuro enabled auto-merge (squash) October 16, 2024 13:02
auto-merge was automatically disabled October 17, 2024 08:14

Head branch was pushed to by a user without write access

@Saumya40-codes
Copy link
Contributor Author

Anything else I'm missing on @yurishkuro ?

@yurishkuro yurishkuro merged commit a9f9fcb into jaegertracing:main Oct 18, 2024
49 checks passed
@yurishkuro
Copy link
Member

Thanks!

chahatsagarmain pushed a commit to chahatsagarmain/jaeger that referenced this pull request Oct 23, 2024
## Which problem is this PR solving?
- Resolves jaegertracing#6067 
- Follows up jaegertracing#6068 

## Description of the changes
- Currently in `plugin/storage/es/mappings/mapping.go` we are using bare
string inorder to for the file mapping. This PR refractors this approach
to use enums instead of string

## How was this change tested?
- running `go test` in respective files/directories

## 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`: `yarn lint` and `yarn test`

---------

Signed-off-by: Saumya Shah <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
yurishkuro added a commit to yurishkuro/jaeger that referenced this pull request Nov 2, 2024
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.

[hygiene] Use enum instead of a string
2 participants