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

Proposal: add tracing support #160

Open
yuhui-lin opened this issue Dec 6, 2018 · 8 comments
Open

Proposal: add tracing support #160

yuhui-lin opened this issue Dec 6, 2018 · 8 comments
Assignees

Comments

@yuhui-lin
Copy link

Hey, I tried to add tracing for sarama and LevelDB using these two libraries:
https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/contrib/Shopify/sarama
https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/contrib/syndtr/goleveldb/leveldb

but I failed to do so because producer/consumer/leveldb.DB are not exposed directly.
#77 adding header to goka context may be helpful but we still can't get traces of emitter/view/groupTable.

I think it would be good to add opentracing support to the options of Emitter/processor/view:
https://github.com/opentracing/opentracing-go

func WithEmitterTracer(tracer opentracing.Tracer) EmitterOption
func WithProcessorTracer(tracer opentracing.Tracer) EmitterOption
func WithViewTracer(tracer opentracing.Tracer) ViewOption

any suggestion on how to add tracing to goka for now?

@db7
Copy link
Collaborator

db7 commented Dec 9, 2018

The storage is an interface, so you should be able to simply replace it with your extended version of the storage. Take a look in the builders in storage subpackage. The same applies to the Sarama consumer and producer (kafka package).

If possible I'd suggest to introduce the tracing via builders instead of adding another dependency to the main package.

Sami has been working in a rewrite of the storage package. @SamiHiltunen, do you think that the rewrite would help introducing tracing?

@yuhui-lin
Copy link
Author

@db7 thanks for the information. I didn't realize they are all interfaces and I'll look into it. I guess it would still make sense if goka provides open-tracing support out of box.

@yuhui-lin
Copy link
Author

I looked into storage and kafka subpackage. I am able to apply tracing to storage. but I got two concerns:

  • for kafka/consumer, there is a lot of related code: groupConsumer, simpleConsumer, event... these are all unexposed struct. it might be fluky to copy these code for tracing purpose. plus, there is no tracing wrapper for sarama-cluster yet. As you mentioned, builder may be a good way to introduce tracing. I can see adding builders like these may make sense:
func ProducerBuilderWithTracer(config *cluster.Config, tracer opentracing.Tracer) ProducerBuilder
func ConsumerBuilderWithTracer(config *cluster.Config, tracer opentracing.Tracer) ConsumerBuilder
  • the other concern is that we are not able to create a child span when emitting a message in processor callback because goka doesn't propagate kafka headers from consumer to producer. Emit messages with headers #77 issue seems related.

@db7
Copy link
Collaborator

db7 commented Dec 12, 2018

Good points. I'd be more than happy reviewing PRs for this issue and #77. If you'd like to try, please let me know. I can support you via chat if you need help to get started.

@yuhui-lin
Copy link
Author

sounds good. I'll let you know when I get time for working on this issue.

@db7 db7 changed the title add tracing support Proposal: add tracing support Dec 13, 2018
@frairon
Copy link
Contributor

frairon commented Feb 3, 2020

I'll close it for now, reopen or create a new issue if it comes up again.

@frairon frairon closed this as completed Feb 3, 2020
@adw1n
Copy link
Contributor

adw1n commented Sep 21, 2020

I think there is definitely an interest in using tracing with goka. Right now to use https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/contrib/Shopify/sarama with a producer you need to implement a custom ProducerBuiler which involves copy pasting the whole producer.go file and changing just one line

producer: aprod,
to

producer: saramatrace.WrapAsyncProducer(config, aprod),

There is deffinitely an overhead caused by having to maintain copy pasted producer.go file.

@frairon @db7 please could you reopen this issue? Will the goka core team accept a PR that improves the tracing support?

@db7 db7 reopened this Sep 21, 2020
@frairon
Copy link
Contributor

frairon commented Sep 29, 2020

@adw1n sorry for the late response, we're currently all on vacation and I honestly forgot to reply to you before. I'd be happy to review any PRs that would add that. Thanks in advance for the contribution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants