-
Notifications
You must be signed in to change notification settings - Fork 213
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
Consolidate rootLogger and scopedLogger #1878
Consolidate rootLogger and scopedLogger #1878
Conversation
By only allowing the porter application context to create a root span, we can consolidate rootlogger and scoped logger into a single TraceLogger, and simplify logic around setting attributes on the root span. Signed-off-by: Carolyn Van Slyck <[email protected]>
618c73c
to
2d684e0
Compare
Sometimes the stack looks like this when we ask for the calling function name: InstallBundle -> tracing.TraceLogger.StartSpan -> tracing.callerFunc other times it looks like this ExecuteBundle -> tracing.StartSpan -> tracing.TraceLogger.StartSpan -> tracing.callerFunc So I have tweaked how we look up the stack to keep checking until we find a function that isn't in the tracing package Signed-off-by: Carolyn Van Slyck <[email protected]>
I noticed when working on this that callerFunc is returning funny names when the function had a pointer receiver. So for @VinozzZ can you take a look after this PR is merged? (After because I edited the same file in this PR) |
Signed-off-by: Carolyn Van Slyck <[email protected]>
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.
This looks awesome! Thanks you for all the documentation
@VinozzZ Thanks for pushing me to clean up the tracing package! 🙇♀️ |
* Consolidate rootLogger and scopedLogger By only allowing the porter application context to create a root span, we can consolidate rootlogger and scoped logger into a single TraceLogger, and simplify logic around setting attributes on the root span. Signed-off-by: Carolyn Van Slyck <[email protected]> * Allow for a variable stack size when finding the function name Sometimes the stack looks like this when we ask for the calling function name: InstallBundle -> tracing.TraceLogger.StartSpan -> tracing.callerFunc other times it looks like this ExecuteBundle -> tracing.StartSpan -> tracing.TraceLogger.StartSpan -> tracing.callerFunc So I have tweaked how we look up the stack to keep checking until we find a function that isn't in the tracing package Signed-off-by: Carolyn Van Slyck <[email protected]> * Document more of the tracing package Signed-off-by: Carolyn Van Slyck <[email protected]> Signed-off-by: joshuabezaleel <[email protected]>
What does this change
By only allowing the porter application context to create a root span,
we can consolidate rootlogger and scoped logger into a single
TraceLogger, and simplify logic around setting attributes on the root
span.
What issue does it fix
N/A
Notes for the reviewer
N/A
Checklist
Reviewer Checklist