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

add ability to serialize/deserialize b3 to Go map[string]string #145

Merged
merged 2 commits into from
Aug 30, 2019

Conversation

basvanbeek
Copy link
Member

This PR allows proper B3 serialization / deserialization logic on a generic Go map[string]string storage.

This allows for easy B3 plugability when dealing with non natively supported header containers.

func TestMapExtractTraceIDError(t *testing.T) {
m := make(b3.Map)

m[b3.TraceID] = "invalid_data"

Choose a reason for hiding this comment

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

string invalid_data has 4 occurrences, make it a constant (from goconst)

Copy link
Member Author

Choose a reason for hiding this comment

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

I wish this would be squelched for *_test packages

@basvanbeek
Copy link
Member Author

This also allows for keeping B3 logic separated from OpenTracing... a PR for our OpenTracing Go bridge will follow on that repo.

@coveralls
Copy link

coveralls commented Aug 30, 2019

Coverage Status

Coverage decreased (-2.2%) to 60.797% when pulling 67b8e46 on basvanbeek:b3map into b1a3538 on openzipkin:master.

Copy link
Contributor

@jcchavezs jcchavezs left a comment

Choose a reason for hiding this comment

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

Nice work!


if want, have := false, *sc.Sampled; want != have {
t.Errorf("Sampled want %t, have %t", want, have)
}
Copy link
Member

Choose a reason for hiding this comment

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

Just a comment, I'm surprised that go doesn't include matchers in the standard library test utilities

@basvanbeek basvanbeek merged commit f5dcc76 into openzipkin:master Aug 30, 2019
@basvanbeek basvanbeek deleted the b3map branch October 8, 2021 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants