-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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] Move span reader decorator to storage factories #6280
[v2][storage] Move span reader decorator to storage factories #6280
Conversation
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]>
@yurishkuro The decorator is also used for the metrics reader (https://github.com/jaegertracing/jaeger/blob/main/cmd/jaeger/internal/extension/jaegerquery/server.go#L165). Do you have any thoughts on how we should handle this? This one is a bit different because the underlying MetricsFactory does not accept |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6280 +/- ##
==========================================
+ Coverage 96.20% 96.22% +0.01%
==========================================
Files 356 356
Lines 20303 20416 +113
==========================================
+ Hits 19533 19645 +112
Misses 583 583
- Partials 187 188 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
plugin/storage/factory.go
Outdated
Name: "storage", | ||
Tags: map[string]string{ | ||
"name": name, | ||
// TODO: how should we get kind? |
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.
for name, factory
is actually for kind, factory
, because in v1 there is notion of storage names. The closest v1 has to names is primary/archive, which you might add to the namespace as a name attribute in CreateReader vs. CreateArchiveReader
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 We're not recording any metrics today for the archive span reader so can we just leave the name tag off?
Signed-off-by: Mahad Zaryab <[email protected]>
@yurishkuro do we need to decorate the span reader in blackhole storage? |
plugin/storage/cassandra/factory.go
Outdated
if err != nil { | ||
return sr, err | ||
} | ||
return spanstoremetrics.NewReaderDecorator(sr, f.metricsFactory), nil |
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.
wrap CreateArchiveSpanReader to? This is where you can apply a label name=primary|archive
before creating 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.
@yurishkuro would we need to namespace the metric factory again? The factory doesn't expose a way to just label an existing namespace.
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 - you can pass just the tags, with empty name
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.
oh okay got it - but the name
label is already provided for v2 and we don't want to override it. Should we give the label a different name? What about type
?
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.
maybe role
then
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.
type
and kind
are kind of the same.
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 Sounds good. One other thing to note about cassandra is that it currently holds two metrics factories that publish metrics under jaeger_cassandra_***
and jaeger_cassandra-archive_***
(https://github.com/jaegertracing/jaeger/blob/main/plugin/storage/cassandra/factory.go#L136-L137). Do we want to change these namespaces to match the same ones we're using for the decorator? So we could publish under jaeger_storage_***
with the role
, kind
, and name
(only for v2) labels instead of jaeger_cassandra_***
and jaeger_cassandra-archive_***
.
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, I was thinking that too, since we're making a breaking change anyway let's make them more consistent.
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 Made this change and updated the PR with a summary of the breaking changes
no, it's not used in prod. |
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]>
@@ -133,8 +133,7 @@ func (f *Factory) configureFromOptions(o *Options) { | |||
|
|||
// Initialize implements storage.Factory | |||
func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger) error { | |||
f.primaryMetricsFactory = metricsFactory.Namespace(metrics.NSOptions{Name: "cassandra", Tags: nil}) | |||
f.archiveMetricsFactory = metricsFactory.Namespace(metrics.NSOptions{Name: "cassandra-archive", Tags: nil}) |
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.
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) and CreateDependencyReader
(https://github.com/jaegertracing/jaeger/blob/main/plugin/storage/cassandra/factory.go#L175) will now have the role=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_***
with kind=cassandra
but no 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.
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
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]>
Which problem is this PR solving?
Description of the changes
jaeger_query
to will now be pushed undderjaeger_storage
jaeger_cassandra
andjaeger_cassandra-archive
will now be pushed underjaeger_storage
with the following tags:kind=cassandra
role=primary
orrole=archive
name
with the name of the storage (in jaeger-v2 only)jaeger_index_create
will now be pushed underjaeger_storage_index_create
with the following tags:kind=elasticsearch
/kind=opensearch
role=primary
orrole=archive
name
with the name of the storage (in jaeger-v2 only)How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test