-
Notifications
You must be signed in to change notification settings - Fork 12
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
improvement: add tags to span #120
improvement: add tags to span #120
Conversation
There are performance improvements to make to this branch. This PR is built off a specific witchcraft-go-tracing branch. It should not be merged or evaluated until that PR is finalized. |
} | ||
_, _ = builder.WriteString("}") | ||
} | ||
|
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.
wlog-glog seems to be completely broken and deserve some double checking of its current state. I wrote this addition to fit what it is currently producing. The biggest problem seems to be that it does not print double quotes. See this example output from its test:
type: trace.1, span: traceId: 13b9ae9acce1c990, id: 7b485c918531979b, name: testOp {parentId: 13b9ae9acce1c990, timestamp: 1613488524158033, duration: 0, tags:{key0:value0}}
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.
Thanks for flagging this. It makes sense to match the current output and then we can address any issues wholesale.
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.
Overall the logic looks good to me. Most comments are for the structure and consistency aspects.
@@ -68,6 +68,19 @@ func marshalWTracingSpanModel(key string, val interface{}) string { | |||
} | |||
} | |||
|
|||
if tags := span.Tags; tags != nil && len(tags) > 0 { |
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.
Same comment as zap -> can replace tags != nil && len(tags) > 0
with len(tags) > 0
} | ||
_, _ = builder.WriteString("}") | ||
} | ||
|
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.
Thanks for flagging this. It makes sense to match the current output and then we can address any issues wholesale.
@@ -44,6 +44,9 @@ func marshalWTracingSpanModel(evt *zerolog.Event, key string, val interface{}) * | |||
encodeSpanModelAnnotations(evt, "cs", "cr", span) | |||
} | |||
} | |||
if tags := span.Tags; tags != nil && len(tags) > 0 { | |||
e.Interface(trc1log.SpanTagsKey, tags) |
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 do something similar to what I recommended on wlog-zap, since I believe c.Interface
also uses reflection.
There is a logObjectMarshalerFn
that we define, which we should be able to use for each tag string.
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.
👍
commit b33a0cf Author: akrishna <akrishna@palantir.com> Date: Wed Mar 10 12:19:33 2021 -0500 CR commit 17133f4 Author: akrishna <akrishna@palantir.com> Date: Tue Mar 9 13:09:15 2021 -0500 add comment commit 925fc37 Author: akrishna <akrishna@palantir.com> Date: Tue Mar 9 17:50:24 2021 +0000 Add generated changelog entries commit f19fe83 Author: akrishna <akrishna@palantir.com> Date: Tue Mar 9 12:50:24 2021 -0500 remove time, level, and message keys in logger provider commit a1d5ca7 Author: Excavator Bot <33266368+svc-excavator-bot@users.noreply.github.com> Date: Thu Mar 4 09:51:25 2021 -0800 Excavator: Render CircleCI file using template specified in .circleci/template.sh (#122) commit 246e74c Author: Tony Abboud <tdabboud@hotmail.com> Date: Tue Feb 16 18:25:05 2021 +0000 Autorelease 1.10.0 commit 76beace Author: smoorpal <56262229+smoorpal@users.noreply.github.com> Date: Tue Feb 16 13:05:05 2021 -0500 improvement: add tags to span (#120) Write trace span tags
==COMMIT_MSG==
Write trace span tags
==COMMIT_MSG==
This change is