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

[metrics][storage] Move metrics reader decorator to metrics storage factory #6287

Merged
merged 10 commits into from
Dec 1, 2024

Conversation

mahadzaryab1
Copy link
Collaborator

@mahadzaryab1 mahadzaryab1 commented Dec 1, 2024

Which problem is this PR solving?

Description of the changes

  • This PR moves the decoration of the metrics readers with the metrics factory to inside the storage factory itself rather than handling it a higher level (ex. all-in-one, query server/extension)
  • For v2, the namespacing of the metrics has been moved from the query extension to the storage extension.
  • For v1, the namespacing of the metrics has been moved from the various binaries to the metrics storage meta-factory.
  • 🛑 This PR contains the following breaking changes:
    • In v1, metrics related to the metrics reader that were being published under jaeger_query will now be published under jaeger_storage with the kind and role=metricstore tags.
    • In v2, metrics related to the metrics reader that were being published under jaeger_metricstore will now be published under jaeger_storage with the name, kind, and role=metricstore tags.

How was this change tested?

  • CI

Checklist

@mahadzaryab1 mahadzaryab1 added the changelog:breaking-change Change that is breaking public APIs or established behavior label Dec 1, 2024
Copy link

codecov bot commented Dec 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.21%. Comparing base (beef883) to head (df0de70).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6287      +/-   ##
==========================================
+ Coverage   96.18%   96.21%   +0.02%     
==========================================
  Files         356      356              
  Lines       20416    20432      +16     
==========================================
+ Hits        19637    19658      +21     
+ Misses        589      585       -4     
+ Partials      190      189       -1     
Flag Coverage Δ
badger_v1 8.90% <ø> (ø)
badger_v2 1.62% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v1-manual 14.84% <ø> (ø)
cassandra-4.x-v2-auto 1.56% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v2-manual 1.56% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v1-manual 14.84% <ø> (ø)
cassandra-5.x-v2-auto 1.56% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v2-manual 1.56% <0.00%> (-0.01%) ⬇️
elasticsearch-6.x-v1 18.59% <ø> (-0.01%) ⬇️
elasticsearch-7.x-v1 18.68% <ø> (ø)
elasticsearch-8.x-v1 18.84% <ø> (-0.01%) ⬇️
elasticsearch-8.x-v2 1.62% <0.00%> (-0.01%) ⬇️
grpc_v1 10.37% <ø> (ø)
grpc_v2 7.87% <0.00%> (-0.04%) ⬇️
kafka-v1 8.58% <ø> (ø)
kafka-v2 1.62% <0.00%> (-0.01%) ⬇️
memory_v2 1.62% <0.00%> (+<0.01%) ⬆️
opensearch-1.x-v1 18.72% <ø> (-0.01%) ⬇️
opensearch-2.x-v1 18.72% <ø> (ø)
opensearch-2.x-v2 1.62% <0.00%> (-0.01%) ⬇️
tailsampling-processor 0.45% <0.00%> (-0.01%) ⬇️
unittests 95.12% <100.00%> (+0.02%) ⬆️

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.

@@ -9,6 +9,7 @@ import (
"github.com/spf13/viper"
Copy link
Member

Choose a reason for hiding this comment

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

plugin/metrics is a bad name, we should rename it to plugin/metricstore

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 can do that in a follow-up PR

Copy link
Member

Choose a reason for hiding this comment

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

we can also rename storage/metricsstore to storage/metricstore (single s)

@mahadzaryab1 mahadzaryab1 marked this pull request as ready for review December 1, 2024 18:05
@mahadzaryab1 mahadzaryab1 requested a review from a team as a code owner December 1, 2024 18:05
@mahadzaryab1 mahadzaryab1 requested a review from jkowall December 1, 2024 18:05
@dosubot dosubot bot added the area/storage label Dec 1, 2024
return prometheusstore.NewMetricsReader(f.options.Configuration, f.logger, f.tracer)
mr, err := prometheusstore.NewMetricsReader(f.options.Configuration, f.telset.Logger, f.telset.TracerProvider)
if err != nil {
return mr, err
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return mr, err
return nil, err

Copy link
Member

Choose a reason for hiding this comment

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

can we add a test?

Copy link
Collaborator Author

@mahadzaryab1 mahadzaryab1 Dec 1, 2024

Choose a reason for hiding this comment

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

@yurishkuro We'll need to dip into the implementation of prometheusstore.NewMetricsReader to force an error here. Is that fine? Also, since we're just decorating the reader, do we want to force returning a nil if there is an error? My thinking was that we just pass along whatever it is we get without decorating the reader.

Copy link
Member

Choose a reason for hiding this comment

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

You can simulate the error easily by passing a TLS config with "foobar" for some of the certificates.

It is convention to return nil, err in case of errors. It's probably what you would get from the factory already, but when you return mr, err you are returning a typed nil, so the nil check may actually fail in the caller.

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 sounds good! i'll also go back and do the same for the other factories in a follow-up PR

@yurishkuro yurishkuro merged commit 88777f5 into jaegertracing:main Dec 1, 2024
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/storage changelog:breaking-change Change that is breaking public APIs or established behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants