-
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
Move span.GetSamplerParams out of model/ into sampling/aggregator #6583
Move span.GetSamplerParams out of model/ into sampling/aggregator #6583
Conversation
@@ -150,9 +151,42 @@ func (a *aggregator) HandleRootSpan(span *span_model.Span, logger *zap.Logger) { | |||
if service == "" || span.OperationName == "" { | |||
return | |||
} | |||
samplerType, samplerParam := span.GetSamplerParams(logger) | |||
samplerType, samplerParam := GetSamplerParams(span, logger) |
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.
does not need to be public
samplerType, samplerParam := GetSamplerParams(span, logger) | |
samplerType, samplerParam := getSamplerParams(span, logger) |
The aggregator already has access to logger, no need to pass it, if you make the function have a receiver
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.
you mean by using aggregator.postAggregator.logger
?
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 mean a.getSamplerParams(span)
(a method, not a function)
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 understand this but i mean where is the logger function to use in this method?
the only logger in struct aggregator
is in a.postAggregator.logger
logger
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.
ah, ok. Never mind then. This is a weird design that needs a cleanup externally - there's no reason for the caller of HandleRootSpan to be passing a logger.
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.
let's just make the function private
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.
okay
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 booked #6584
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6583 +/- ##
=======================================
Coverage 96.23% 96.23%
=======================================
Files 375 375
Lines 21389 21389
=======================================
Hits 20583 20583
Misses 614 614
Partials 192 192
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -335,123 +332,3 @@ func BenchmarkBatchSerialization(b *testing.B) { | |||
} | |||
}) | |||
} | |||
|
|||
func TestGetSamplerParams(t *testing.T) { |
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 you move the test to aggregator?
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.
by making it private it can't be tested alone but it's test will be part of HandleRootSpan
test as it already uses it
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.
if the test is in the same package it has access to private functions
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.
okaay you can merge code for this #6584 issue
and I will rebase and push changes
Signed-off-by: nabil salah <nabil.salah203@gmail.com>
Signed-off-by: nabil salah <nabil.salah203@gmail.com>
Signed-off-by: nabil salah <nabil.salah203@gmail.com>
Signed-off-by: nabil salah <nabil.salah203@gmail.com>
c87d24a
to
c8b5cbb
Compare
Which problem is this PR solving?
Part of [jaeger-idl] Copy model/*go to jaeger-idl/model/v1 #6571
Follow-up to Add model/v1 jaeger-idl#118
Description of the changes
How was this change tested?
go test ./model/
go test ./internal/sampling/samplingstrategy/adaptive/
Checklist
jaeger
:make lint test
jaeger-ui
:npm run lint
andnpm run test