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

Use zipkin-go #123

Merged
merged 37 commits into from
Aug 15, 2019
Merged

Use zipkin-go #123

merged 37 commits into from
Aug 15, 2019

Conversation

jcchavezs
Copy link
Contributor

@jcchavezs jcchavezs commented Feb 26, 2019

This PR aims to use zipkin-go library and turn this library into a bridge with opentracing rather than a native implementation. This provides multiple advantages, mostly the fact that v2 reporting will be supported and also that this bridge will be able to obtain all the benefits from the new features of zipkin-go.

Closes #125

Ping @stakhiv @basvanbeek @ONG-YA

@codefromthecrypt
Copy link

what is the status of this? it looks like there is no code on the branch. was that by accident?

Copy link

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

wow so red!

@jcchavezs jcchavezs changed the title [WIP] Use zipkin-go underneath [WIP] Use zipkin-go Apr 12, 2019
@ONG-YA
Copy link

ONG-YA commented Apr 23, 2019

hope to see the release version soon

@jcchavezs jcchavezs changed the title [WIP] Use zipkin-go Use zipkin-go May 19, 2019
@jcchavezs
Copy link
Contributor Author

This is pretty functional. Couple of questions:

  1. What is missing (besides updating the readme)?
  2. Do we want to include the opentracing observers? v1 version did and I think some other ot instrumentation do.
  3. Do we want to launch including the GRPC b3 propagation?
  4. Any other concern?

Ping @adriancole @basvanbeek @stakhiv

@basvanbeek
Copy link
Member

So it seems we have a couple of removed features moving from native to wrapper:

  • we don't support the deprecated logging methods that are still part of the OT interface (nice to have)
  • we don't support baggage (nice to have: could be implemented here instead the Zipkin go plans to support the more sensible white list approach)
  • we don't support observers (this was contributed in Monitoring platform events with zipkin-go and opentracing #50 from outside our org, unsure if still used)

So honestly I'm ok to merge without these items but they could pop up. I do think it would be better to launch with gRPC B3.

@jcchavezs
Copy link
Contributor Author

we don't support the deprecated logging methods that are still part of the OT interface (nice to have)

Since they are deprecated I was thinking on waiting for someone to request for it? unless we see popular opentracing instrumentation using this? Otherwise I could add them.

we don't support baggage (nice to have: could be implemented here instead the Zipkin go plans to support the more sensible white list approach)

True, this one is probably needed.

we don't support observers (this was contributed in #50 from outside our org, unsure if still used)

Worth to ping @hkshaw1990 here (to see if they are still using it). On the other hand, I see an issue here. The optional arguments for the NewTracer are the zipkin-go ones which means that making new arguments will feel weird. One option is to not to have such a NewTracer and only a Wrap method, another option would be to wrap the functional arguments of zipkin-go to have consistency with the additional functional arguments on zipkin-go-opentracing. Any thoughts @basvanbeek ?

@basvanbeek
Copy link
Member

There is quite some legacy code out there using the old log methods. My former company for instance...

Bas

@jcchavezs
Copy link
Contributor Author

jcchavezs commented May 19, 2019 via email

…_ease_migration

chore(zipkin): adds sampler type to ease migration.
@basvanbeek
Copy link
Member

i’ll try to look shortly...

@ONG-YA
Copy link

ONG-YA commented Aug 7, 2019

I think this is ready to be merged so I know @basvanbeek is busy but it would be nice to get some feedback at some point :).

@ONG-YA feel free to try this branch and give us feedback.

i'll give it a try~

go 1.12

require (
github.com/gorilla/mux v1.7.3 // indirect
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this should not be here. It comes from the example.

@jcchavezs
Copy link
Contributor Author

I am glad to say that we have this branch running in a production service.

Copy link

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

thanks for deleting so much. I quickly looked at things and commented on what jumped out.

bench_test.go Outdated
b.Fatalf("missing traces: expected %d, got %d", b.N, r)
}
}
//func BenchmarkSpan_100BaggageItems(b *testing.B) {

Choose a reason for hiding this comment

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

intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, we don't support this yet and I would wait until extra fields take place in zipkin go.

same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2017 The OpenZipkin Authors

Choose a reason for hiding this comment

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

2017-2019?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No idea on this but I copied it from zipkin-go. Should we change it there? https://github.com/openzipkin/zipkin-go/blob/master/LICENSE#L189

bench_test.go Outdated
func BenchmarkInject_Binary_100BaggageItems(b *testing.B) {
benchmarkInject(b, opentracing.Binary, 100)
}
// func BenchmarkInject_Binary_Empty(b *testing.B) {

Choose a reason for hiding this comment

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

intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't support binary yet. Let's reintroduce it when it is supported.

bench_test.go Outdated
func BenchmarkExtract_Binary_100BaggageItems(b *testing.B) {
benchmarkExtract(b, opentracing.Binary, 100)
}
// func BenchmarkExtract_Binary_Empty(b *testing.B) {

Choose a reason for hiding this comment

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

intentional?

examples/cli_with_2_services/svc2/cmd/main.go Outdated Show resolved Hide resolved
"github.com/openzipkin/zipkin-go/reporter/recorder"
)

func TestHTTPExtractFlagsOnly(t *testing.T) {

Choose a reason for hiding this comment

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

a lot of this feels like copy/paste. is there a way to only test what's relevant here (employing the code from zipkin-go and only addressing wrapping concerns)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unfortunately we reuse a very simple thing from zipkin-go in this package but makes sense to revisit the test list.

recorder_test.go Outdated
type CountingRecorder int32

func (c *CountingRecorder) RecordSpan(r RawSpan) {
func (c *CountingRecorder) Send(span model.SpanModel) {

Choose a reason for hiding this comment

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

previous name is less distracting unless somehow the word send is interesting here. the type is recorder right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes and we changed the name to fulfill the interface.

span_test.go Outdated
assert.Equal(t, "x", spans[0].Name)
assert.Equal(t, 3, len(spans[0].Annotations))
assert.Equal(t, map[string]string{"tag": "value"}, spans[0].Tags)
assert.Equal(t, spans[0].Annotations[0].Value, "event:payload")

Choose a reason for hiding this comment

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

event: prefix is probably not helpful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

// to allow deterministic sampling decisions to be made across different nodes.
sampler zipkin.Sampler

// unsampledNoop turns potentially expensive operations on unsampled

Choose a reason for hiding this comment

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

why have this? it seems half of the sampled local thing...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure I understand the question. it is here because of compatibility but also because it is supported in zipkin-go unless you refer to the actual description.

Choose a reason for hiding this comment

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

actually why do we need to copy options from zipkin-go anyway? could you not have a funciton that takes a zipkin-go tracer (with options already applied) plus OT relevant options? It seems less maintenance.. or am I missing something?

Choose a reason for hiding this comment

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

or by compatibility do you mean that this option was here before so that's why. Anyway, I'll leave you to it. I think you know I find this api surprising especially to someone using OT when they can just use zipkin-go directly if worried about perf. I would be surprised if layered instrumentation do smart things routinely, that's all.

Copy link
Contributor Author

@jcchavezs jcchavezs Aug 11, 2019

Choose a reason for hiding this comment

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

Right, now I understand the question :). So, this option was already here: https://github.com/openzipkin-contrib/zipkin-go-opentracing/blob/master/tracer.go#L36 I just made the translation into the respectively part in zipkin-go.

I have removed many options that were here (most of them related to logs) and did not match zipkin-go but those easily having a counter part I kept.

BTW there is a method for wrapping an existing tracer: https://github.com/openzipkin-contrib/zipkin-go-opentracing/pull/123/files#diff-46db78603208f38452c0333bec12ab2cR57

I don't have strong feelings on keeping it or removing it but since we don't add any logic for this but to translate into zipkin option I'd rather keep it for retrocompatibility purposes.

tracer_options.go Show resolved Hide resolved
@codefromthecrypt
Copy link

codefromthecrypt commented Aug 10, 2019 via email

@codefromthecrypt
Copy link

codefromthecrypt commented Aug 10, 2019 via email

@codefromthecrypt
Copy link

codefromthecrypt commented Aug 10, 2019 via email

@jcchavezs
Copy link
Contributor Author

I suppose I meant to say I'm surprised to see checking in of commented out
code. Would it be better to delete it then check it back in when we have
functionality? Or is it typical in go to comment out code?

Right, it was just lazyness to not to need to dig into it when the functionality is back. I will remove it

maybe change CountingRecorder to CountingSender instead?

Makes sense!

@basvanbeek basvanbeek merged commit bff5926 into master Aug 15, 2019
@jcchavezs
Copy link
Contributor Author

@jcchavezs jcchavezs deleted the use_zipkin_go branch September 17, 2019 12:29
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.

when support zipkin v2
4 participants