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

[WIP][v2][storage] Create v2 query service to operate on otlp data model #6343

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mahadzaryab1
Copy link
Collaborator

Which problem is this PR solving?

Description of the changes

How was this change tested?

Checklist

Comment on lines +31 to +36
// QueryServiceOptions has optional members of QueryService
type QueryServiceOptionsV2 struct {
ArchiveTraceReader tracestore.Reader
ArchiveTraceWriter tracestore.Writer
Adjuster adjuster.Adjuster
}
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 is there any reason this can't just be part of the QueryServiceV2 struct?

Copy link
Member

Choose a reason for hiding this comment

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

it's a question of now the constructor organized. It has some mandatory arguments and some optional arguments. I don't like the functional option pattern for optional arguments - too much typing overhead with no additional benefits over just passing an Options struct. So the constructor could theoretically be just New(Settings), but that allows required args not to be set. It could be New(...all args...) which creates very long signature with unchecked semantics (you could mistaken main reader and archive reader positions, for example). In v1 case it's New(reader, deps, options) which clearly indicates required / optional args.

Comment on lines +130 to +136
func (opts *QueryServiceOptionsV2) InitArchiveStorage(
archiveReader tracestore.Reader,
archiveWriter tracestore.Writer,
logger *zap.Logger) {
opts.ArchiveTraceReader = archiveReader
opts.ArchiveTraceWriter = archiveWriter
}
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 how should we handle this in the new query service? should we just make it part of the constructor?

Copy link
Member

Choose a reason for hiding this comment

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

yes

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

Attention: Patch coverage is 0% with 50 lines in your changes missing coverage. Please review.

Project coverage is 48.80%. Comparing base (78f5a41) to head (ad0de07).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
cmd/query/app/querysvc/query_service_v2.go 0.00% 50 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (78f5a41) and HEAD (ad0de07). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (78f5a41) HEAD (ad0de07)
elasticsearch-8.x-v2 1 0
unittests 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #6343       +/-   ##
===========================================
- Coverage   96.14%   48.80%   -47.35%     
===========================================
  Files         357      183      -174     
  Lines       20547    11262     -9285     
===========================================
- Hits        19755     5496    -14259     
- Misses        605     5319     +4714     
- Partials      187      447      +260     
Flag Coverage Δ
badger_v1 8.72% <0.00%> (-0.06%) ⬇️
badger_v2 1.60% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v1-manual 14.66% <0.00%> (+0.02%) ⬆️
cassandra-4.x-v2-auto 1.54% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v2-manual 1.54% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v1-manual 14.66% <0.00%> (+0.02%) ⬆️
cassandra-5.x-v2-auto 1.54% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v2-manual 1.54% <0.00%> (-0.01%) ⬇️
elasticsearch-6.x-v1 18.27% <0.00%> (-0.07%) ⬇️
elasticsearch-7.x-v1 18.34% <0.00%> (-0.07%) ⬇️
elasticsearch-8.x-v1 18.51% <0.00%> (-0.08%) ⬇️
elasticsearch-8.x-v2 ?
grpc_v1 10.19% <0.00%> (-0.03%) ⬇️
grpc_v2 7.75% <0.00%> (-0.05%) ⬇️
kafka-v1 9.12% <0.00%> (+0.65%) ⬆️
kafka-v2 1.60% <0.00%> (-0.01%) ⬇️
memory_v2 1.60% <0.00%> (-0.01%) ⬇️
opensearch-1.x-v1 18.39% <0.00%> (-0.08%) ⬇️
opensearch-2.x-v1 18.39% <0.00%> (-0.08%) ⬇️
opensearch-2.x-v2 1.59% <0.00%> (-0.02%) ⬇️
tailsampling-processor 0.44% <0.00%> (-0.01%) ⬇️
unittests ?

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.

@mahadzaryab1 mahadzaryab1 changed the title [WIP][v2][storage] Create v2 query service to operate on otel data model [WIP][v2][storage] Create v2 query service to operate on otlp data model Dec 12, 2024
Comment on lines +122 to +126
// GetCapabilities returns the features supported by the query service.
func (qs QueryServiceV2) GetCapabilities() StorageCapabilities {
return StorageCapabilities{
ArchiveStorage: qs.options.hasArchiveStorage(),
}
Copy link
Collaborator Author

@mahadzaryab1 mahadzaryab1 Dec 12, 2024

Choose a reason for hiding this comment

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

I don't think this is being used - can we remove it?

Copy link
Member

Choose a reason for hiding this comment

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

cmd/query/app/server.go
190: staticHandlerCloser := RegisterStaticHandler(r, telset.Logger, queryOpts, querySvc.GetCapabilities())

qsvc.options.Adjuster = adjuster.Sequence(StandardAdjusters(defaultMaxClockSkewAdjustV2)...)
}
return qsvc
}
Copy link
Member

Choose a reason for hiding this comment

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

try to reuse the existing tests for v1 query service.

}

// InitArchiveStorage tries to initialize archive storage reader/writer if storage factory supports them.
func (opts *QueryServiceOptionsV2) InitArchiveStorage(
Copy link
Member

Choose a reason for hiding this comment

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

this would be weird pattern since we're just passing these directly, so might as well do everything in the constructor.

type QueryServiceV2 struct {
traceReader tracestore.Reader
dependencyReader depstore.Reader
options QueryServiceOptionsV2
Copy link
Member

Choose a reason for hiding this comment

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

the reason why this is a field and not embedded struct is because doing the latter exposes the optional args as public fields on the main struct.

Comment on lines +25 to +29
var errNoArchiveSpanStorageV2 = errors.New("archive span storage was not configured")

const (
defaultMaxClockSkewAdjustV2 = time.Second
)
Copy link
Member

Choose a reason for hiding this comment

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

rather than redefining I would move them here from query_service.go and reuse the names. We don't have to duplicate what we don't need to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants