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

Add metrics storage to storage capabilities #5774

Closed
wants to merge 3 commits into from

Conversation

FlamingSaint
Copy link
Member

Which problem is this PR solving?

Description of the changes

  • Added metrics storage to storage capabilities in the query service

How was this change tested?

  • make test

Checklist

Signed-off-by: FlamingSaint <raghuramkannan400@gmail.com>
Copy link

codecov bot commented Jul 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.65%. Comparing base (e437971) to head (d355807).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5774      +/-   ##
==========================================
- Coverage   96.66%   96.65%   -0.02%     
==========================================
  Files         342      342              
  Lines       16515    16519       +4     
==========================================
+ Hits        15964    15966       +2     
- Misses        362      363       +1     
- Partials      189      190       +1     
Flag Coverage Δ
badger_v1 8.04% <0.00%> (-0.01%) ⬇️
badger_v2 1.81% <0.00%> (-0.01%) ⬇️
cassandra-3.x-v1 16.60% <0.00%> (-0.01%) ⬇️
cassandra-3.x-v2 1.74% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v1 16.60% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v2 1.74% <0.00%> (-0.01%) ⬇️
elasticsearch-6.x-v1 18.77% <0.00%> (-0.01%) ⬇️
elasticsearch-7.x-v1 18.82% <0.00%> (-0.02%) ⬇️
elasticsearch-8.x-v1 19.02% <0.00%> (-0.01%) ⬇️
elasticsearch-8.x-v2 1.80% <0.00%> (-0.01%) ⬇️
grpc_v1 9.52% <0.00%> (+<0.01%) ⬆️
grpc_v2 7.14% <0.00%> (+<0.01%) ⬆️
kafka 9.73% <0.00%> (-0.01%) ⬇️
memory_v2 1.81% <0.00%> (-0.01%) ⬇️
opensearch-1.x-v1 18.88% <0.00%> (+<0.01%) ⬆️
opensearch-2.x-v1 18.87% <0.00%> (-0.02%) ⬇️
opensearch-2.x-v2 1.81% <0.00%> (-0.01%) ⬇️
unittests 95.07% <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.

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.

Did you investigate UI code on whether it could actually use this capability? Looks like you're starting with less risky part of the project, which is never a good idea, you want to tackle the unknown part first.

cmd/jaeger/internal/extension/jaegerquery/server.go Outdated Show resolved Hide resolved
@@ -301,6 +302,7 @@ func TestServerAddMetricsStorage(t *testing.T) {
{
name: "Metrics storage unset",
config: &Config{},
qSvcOpts: &querysvc.QueryServiceOptions{},
Copy link
Member

Choose a reason for hiding this comment

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

what's the point of defining these as test case parameter if they don't change across tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

I modelled this based on the archive storage test.

@@ -38,13 +39,14 @@ const (
type QueryServiceOptions struct {
ArchiveSpanReader spanstore.Reader
ArchiveSpanWriter spanstore.Writer
MetricsReader metricsstore.Reader
Copy link
Member

Choose a reason for hiding this comment

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

Query service constructor accepts metric reader as argument. Having it also as a field in these options is redundant and confusing to the callers of the constructor

Copy link
Member 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 the query service constructor accepts metric reader as an argument . It only accepts span reader, dependency reader and options.

Copy link
Member

Choose a reason for hiding this comment

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

Then it's even worse, if QueryService struct is only designed to serve trace queries, there's absolutely no reason to introduce metrics reader into it. Metrics reader is actually a counterpart for QueryService. It's a poor design to couple them in any way.

Notice that QueryService itself does not serve any remote endpoints, it's purely an internal API. The capabilities struct is served via remote endpoint by app.Server (which does have access to move qs and mqs), and this is where the logic should be, ideally.

@@ -134,6 +136,7 @@ func (qs QueryService) GetDependencies(ctx context.Context, endTs time.Time, loo
func (qs QueryService) GetCapabilities() StorageCapabilities {
return StorageCapabilities{
ArchiveStorage: qs.options.hasArchiveStorage(),
MetricStorage: qs.options.hasMetricStorage(),
Copy link
Member

Choose a reason for hiding this comment

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

why does it need to interrogate Options if you have access to qs which likely already stores the reference to metric reader?

Copy link
Member Author

Choose a reason for hiding this comment

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

No qs doesn't store the reference to the metrics reader. The options does.

@FlamingSaint
Copy link
Member Author

Did you investigate UI code on whether it could actually use this capability? Looks like you're starting with less risky part of the project, which is never a good idea, you want to tackle the unknown part first.

Yes, I will investigate if this is needed by the UI.

Signed-off-by: FlamingSaint <raghuramkannan400@gmail.com>
@FlamingSaint FlamingSaint marked this pull request as draft July 25, 2024 02:07
Signed-off-by: FlamingSaint <raghuramkannan400@gmail.com>
@FlamingSaint
Copy link
Member Author

@yurishkuro Closing this PR based on today's discussion.

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