Skip to content
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

[refactor][storage] Remove metrics factory distinctions from storage factories #6526

Merged
merged 5 commits into from
Jan 11, 2025

Conversation

mahadzaryab1
Copy link
Collaborator

@mahadzaryab1 mahadzaryab1 commented Jan 11, 2025

Which problem is this PR solving?

Description of the changes

  • Some of the storage factories were currently adding the role tag to the metrics factory that it was getting to differentiate between primary and archive. Given that goal in v2 is not have that distinction, the adding of the primary tag was moved to the v1 meta-factory. This tag can then be overriden by the archive specific methods in the storage factories (mainly CreateArchiveSpanReader and CreateArchiveSpanWriter) with role=archive.

How was this change tested?

  • CI

Checklist

Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Comment on lines 141 to 144
role := "primary"
if _, ok := factory.(storage.ArchiveFactory); ok {
role = "archive"
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@yurishkuro I know this isn't correct but just put it here to start the conversation. This will currently set the role archive whenever the factory implements the ArchiveFactory. Is there a way to know at this point whether the storage is actually being used as archive since this is where the metrics factory is passed to the storage factory.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Now that I think more about it, the v1 factory will initialize the CLI flags for both the primary namespace and the archive namespace. Since the factories today hold both the primary and archive configs, we probably need to do one of the following:

  • Each storage factory should only hold 1 config - This would be ideal but it would require creating two storage meta-factories which I think we decided we don't want.
  • Have the meta-factory pass all the metrics factories in with role=primary but override the role in CreateArchiveSpanReader to archive.

Let me know what you think

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Went with option 2 for now - if this looks good, we can make the same change for the other storage factories as well

Copy link

codecov bot commented Jan 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.27%. Comparing base (980dc31) to head (215d9cb).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6526      +/-   ##
==========================================
- Coverage   96.27%   96.27%   -0.01%     
==========================================
  Files         372      372              
  Lines       21283    21278       -5     
==========================================
- Hits        20491    20486       -5     
  Misses        605      605              
  Partials      187      187              
Flag Coverage Δ
badger_v1 10.68% <0.00%> (+<0.01%) ⬆️
badger_v2 2.78% <0.00%> (+<0.01%) ⬆️
cassandra-4.x-v1-manual 16.58% <40.38%> (+<0.01%) ⬆️
cassandra-4.x-v2-auto 2.71% <0.00%> (+<0.01%) ⬆️
cassandra-4.x-v2-manual 2.71% <0.00%> (+<0.01%) ⬆️
cassandra-5.x-v1-manual 16.58% <40.38%> (+<0.01%) ⬆️
cassandra-5.x-v2-auto 2.71% <0.00%> (+<0.01%) ⬆️
cassandra-5.x-v2-manual 2.71% <0.00%> (+<0.01%) ⬆️
elasticsearch-6.x-v1 20.25% <36.53%> (+0.01%) ⬆️
elasticsearch-7.x-v1 20.33% <36.53%> (+0.01%) ⬆️
elasticsearch-8.x-v1 20.48% <36.53%> (+0.01%) ⬆️
elasticsearch-8.x-v2 2.77% <0.00%> (+<0.01%) ⬆️
grpc_v1 12.19% <5.76%> (-0.13%) ⬇️
grpc_v2 9.03% <3.84%> (-0.07%) ⬇️
kafka-3.x-v1 10.36% <0.00%> (+<0.01%) ⬆️
kafka-3.x-v2 2.78% <0.00%> (+<0.01%) ⬆️
memory_v2 2.78% <0.00%> (+<0.01%) ⬆️
opensearch-1.x-v1 20.38% <36.53%> (+0.02%) ⬆️
opensearch-2.x-v1 20.37% <36.53%> (+<0.01%) ⬆️
opensearch-2.x-v2 2.77% <0.00%> (-0.01%) ⬇️
tailsampling-processor 0.51% <0.00%> (+<0.01%) ⬆️
unittests 95.15% <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.

Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
@mahadzaryab1 mahadzaryab1 changed the title [WIP][refactor][storage] Move metrics factory primary/archive distinction for Cassandra to meta-factory [WIP][refactor][storage] Remove metrics factory distinctions from storage factories Jan 11, 2025
@mahadzaryab1 mahadzaryab1 changed the title [WIP][refactor][storage] Remove metrics factory distinctions from storage factories [refactor][storage] Remove metrics factory distinctions from storage factories Jan 11, 2025
@mahadzaryab1 mahadzaryab1 marked this pull request as ready for review January 11, 2025 16:17
@mahadzaryab1 mahadzaryab1 requested a review from a team as a code owner January 11, 2025 16:17
@mahadzaryab1 mahadzaryab1 requested a review from jkowall January 11, 2025 16:17
@dosubot dosubot bot added the area/storage label Jan 11, 2025
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.

lgtm!!!

@mahadzaryab1 mahadzaryab1 merged commit ef4b968 into jaegertracing:main Jan 11, 2025
54 checks passed
@mahadzaryab1 mahadzaryab1 deleted the cassandra-archive branch January 11, 2025 17:18
ekefan pushed a commit to ekefan/jaeger that referenced this pull request Jan 14, 2025
…factories (jaegertracing#6526)

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

## Description of the changes
- Some of the storage factories were currently adding the `role` tag to
the metrics factory that it was getting to differentiate between
`primary` and `archive`. Given that goal in v2 is not have that
distinction, the adding of the `primary` tag was moved to the v1
meta-factory. This tag can then be overriden by the archive specific
methods in the storage factories (mainly `CreateArchiveSpanReader` and
`CreateArchiveSpanWriter`) with `role=archive`.

## How was this change tested?
- CI

## 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>
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