-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[v2][storage] Implement read path for v2 storage interface #6170
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6170 +/- ##
==========================================
+ Coverage 96.19% 96.21% +0.01%
==========================================
Files 356 356
Lines 20416 20436 +20
==========================================
+ Hits 19640 19662 +22
+ Misses 587 585 -2
Partials 189 189
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
cmd/jaeger/internal/extension/jaegerstorage/factoryadapter/reader.go
Outdated
Show resolved
Hide resolved
377d27f
to
2321c76
Compare
@@ -66,6 +67,7 @@ func (s *server) Start(ctx context.Context, host component.Host) error { | |||
} | |||
|
|||
spanReader = storageMetrics.NewReadMetricsDecorator(spanReader, queryMetricsFactory) | |||
traceReader := factoryadapter.NewTraceReader(spanReader) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yurishkuro should we be getting the trace reader via GetStorageFactoryV2
? I wasn't sure if that was sufficient because we decorate the spanreader above. Do we want to create a v2 version of that decorator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, now it should be calling GetStorageFactoryV2. And yes about the decorator. Also, we may want to use otel.MeterProvider in the decorator instead of metrics.Factory (we need to gradually start deprecating metrics.Factory - let's book a ticket for that)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yurishkuro Changed to call GetStorageFactoryV2
. For the deprecation, this is what metrics.Factory
currently looks like:
// Factory creates new metrics
type Factory interface {
Counter(metric Options) Counter
Timer(metric TimerOptions) Timer
Gauge(metric Options) Gauge
Histogram(metric HistogramOptions) Histogram
// Namespace returns a nested metrics factory.
Namespace(scope NSOptions) Factory
}
Looking at OTEL's meter, I see it has a counter, gauge, and histogram. I don't see a Timer - what would be the alternative for that? Also, how do we handle the nesting of namespaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you trying to implement metrics.Factory on top of OTEL MeterProvider? I think it would be great if we could do that, it would minimize our changes across the code base.
Timer doesn't have to be part of the factory API, it can be a util struct done on top of a Histogram - the only difference of timer from Histogram is that its Record() function is strongly typed to Duration.
Name spacing is generally handled by our implementations as a prefix on the metric name, so it would work just the same for OTEL Meter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yurishkuro Would you able to clarify what you mean by Are you trying to implement metrics.Factory on top of OTEL MeterProvider?
I was trying to see if we could remove metrics.Factory
and just replace it with OTEL's Meter Provider. Is there a different approach you were thinking of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wrong, we already have internal/metrics/otelmetrics/factory.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you were simply asking about v2 version of decorator that wraps Storage V2 API - the decorator can still work off our internal pkg/metrics API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good - so do we need to book any work here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we just need not to drop the metrics for storage - this is related to #6219
if err != nil { | ||
return fmt.Errorf("cannot create span reader: %w", err) | ||
} | ||
|
||
spanReader = storageMetrics.NewReadMetricsDecorator(spanReader, queryMetricsFactory) | ||
// TODO: decorate trace reader with metrics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yurishkuro How should we do this? The decorator implements spanstore.Reader
so if we create a new one that implements spanstore_v2.Reader
, it won't work currently since we only ever call the underlying v1 methods. Let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to defer this if possible - what if we use the existing v1 decorator before creating V2 adapter? I.e. I would wrap the span reader as soon as we get it from the v1 factory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yurishkuro Do we still want to use GetStorageFactoryV2
? If we do, then the tracereader is created from the spanreader there. The other approach would be to just initialize the trace reader here (which is what I was previously doing) using the factoryadapter rather than getting it from the v2 factory. What do you think?
storage_v2/factoryadapter/factory.go
Outdated
@@ -35,8 +35,12 @@ func (f *Factory) Close(_ context.Context) error { | |||
} | |||
|
|||
// CreateTraceReader implements spanstore.Factory. | |||
func (*Factory) CreateTraceReader() (spanstore.Reader, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this change to another PR and merge it first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw this would be a good use case for sapling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…reader (#6221) ## Which problem is this PR solving? - Towards #5079 ## Description of the changes - This PR implements the v2 `spanstore.Reader` interface in the factory adapter through the `TraceReader`, which is currently just a wrapper around the v1 `spanstore.Reader`. The `TraceReader` provides a function `GetV1Reader` that exposes the underlying v1 reader which will be used in #6170. ## How was this change tested? - Added unit tests for new functions ## 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: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
494848c
to
1683007
Compare
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
@@ -74,17 +74,21 @@ func (s *server) Start(ctx context.Context, host component.Host) error { | |||
Namespace(metrics.NSOptions{Name: "jaeger"}). | |||
Namespace(metrics.NSOptions{Name: "query"}) | |||
|
|||
f, err := jaegerstorage.GetStorageFactory(s.config.Storage.TracesPrimary, host) | |||
v1Factory, err := jaegerstorage.GetStorageFactory(s.config.Storage.TracesPrimary, host) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a comment why v1 is still needed (because of dependencies)
} | ||
|
||
depReader, err := f.CreateDependencyReader() | ||
depReader, err := v1Factory.CreateDependencyReader() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make sense to create storage_v2/depstore/
before continuing, so that we don't have to keep this bifurcation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a refactoring suggestion:
- storage_v/spanstore -> storage_v/tracestore
Which problem is this PR solving?
Description of the changes
How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test