-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[v2][storage] Move span reader decorator to storage factories #6280
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
Changes from 9 commits
a2ee10e
a156666
3584e8c
b25b893
d7d2bc9
b63af21
294c5d0
f8192a0
6f678c5
6ac1aea
6744399
0fd8360
f7547da
214aac0
e6e8704
83aa823
46ab305
343c90d
b9b5972
a5a673f
6d9e80b
d0319f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
"github.com/jaegertracing/jaeger/storage/dependencystore" | ||
"github.com/jaegertracing/jaeger/storage/samplingstore" | ||
"github.com/jaegertracing/jaeger/storage/spanstore" | ||
"github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" | ||
) | ||
|
||
const ( | ||
|
@@ -50,6 +51,7 @@ | |
type Factory struct { | ||
Options *Options | ||
|
||
metricsFactory metrics.Factory | ||
primaryMetricsFactory metrics.Factory | ||
archiveMetricsFactory metrics.Factory | ||
logger *zap.Logger | ||
|
@@ -133,6 +135,7 @@ | |
|
||
// Initialize implements storage.Factory | ||
func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger) error { | ||
f.metricsFactory = metricsFactory | ||
f.primaryMetricsFactory = metricsFactory.Namespace(metrics.NSOptions{Name: "cassandra", Tags: nil}) | ||
f.archiveMetricsFactory = metricsFactory.Namespace(metrics.NSOptions{Name: "cassandra-archive", Tags: nil}) | ||
f.logger = logger | ||
|
@@ -157,7 +160,11 @@ | |
|
||
// CreateSpanReader implements storage.Factory | ||
func (f *Factory) CreateSpanReader() (spanstore.Reader, error) { | ||
return cSpanStore.NewSpanReader(f.primarySession, f.primaryMetricsFactory, f.logger, f.tracer.Tracer("cSpanStore.SpanReader")) | ||
sr, err := cSpanStore.NewSpanReader(f.primarySession, f.primaryMetricsFactory, f.logger, f.tracer.Tracer("cSpanStore.SpanReader")) | ||
if err != nil { | ||
return sr, err | ||
} | ||
return spanstoremetrics.NewReaderDecorator(sr, f.metricsFactory), nil | ||
|
||
} | ||
|
||
// CreateSpanWriter implements storage.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.
Why not keep these two here? Otherwise you're duplicating namespace assignments twice, which means they can get out of sync.
Uh oh!
There was an error while loading. Please reload this page.
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 Done. However,
CreateSamplingStore
(https://github.com/jaegertracing/jaeger/blob/main/plugin/storage/cassandra/factory.go#L211) andCreateDependencyReader
(https://github.com/jaegertracing/jaeger/blob/main/plugin/storage/cassandra/factory.go#L175) will now have therole=primary
attached to the metrics they emit. Is this fine? or should they just be emitting metrics under the namespace passed into the storage factory without the role tag?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 think sampling store should be
kind=cassandra, role=sampling
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 Done. What about the dependency reader? I'm using the base factory for now.
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.
what would it look like? Dependencies technically were always bundled within the spanstore, not a different "role".
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.
the metrics would be published under
jaeger_storage_***
withkind=cassandra
but norole
tag.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.
that's fine
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.
although since it's using the primary connection / session I would pass it the primary 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.
done