Skip to content
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

Merged
merged 12 commits into from
Feb 16, 2021

Conversation

smoorpal
Copy link
Contributor

@smoorpal smoorpal commented Feb 15, 2021

==COMMIT_MSG==
Write trace span tags
==COMMIT_MSG==


This change is Reviewable

@smoorpal
Copy link
Contributor Author

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("}")
}

Copy link
Contributor Author

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}}

Copy link
Contributor

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.

Copy link
Contributor

@tabboud tabboud left a 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.

wlog-glog/internal/marshalers/wtracing_spanmodel.go Outdated Show resolved Hide resolved
wlog-glog/internal/marshalers/wtracing_spanmodel.go Outdated Show resolved Hide resolved
wlog-zap/internal/marshalers/wtracing_spanmodel.go Outdated Show resolved Hide resolved
@@ -68,6 +68,19 @@ func marshalWTracingSpanModel(key string, val interface{}) string {
}
}

if tags := span.Tags; tags != nil && len(tags) > 0 {
Copy link
Contributor

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

wlog-glog/internal/marshalers/wtracing_spanmodel.go Outdated Show resolved Hide resolved
}
_, _ = builder.WriteString("}")
}

Copy link
Contributor

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.

wlog-glog/internal/marshalers/wtracing_spanmodel.go Outdated Show resolved Hide resolved
wlog-glog/internal/marshalers/wtracing_spanmodel.go Outdated Show resolved Hide resolved
wlog-zap/internal/marshalers/wtracing_spanmodel.go Outdated Show resolved Hide resolved
@@ -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)
Copy link
Contributor

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.

Copy link
Contributor

@tabboud tabboud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bulldozer-bot bulldozer-bot bot merged commit 76beace into palantir:develop Feb 16, 2021
advayakrishna pushed a commit that referenced this pull request Mar 10, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants