OpenTracing instrumentation for Sanic

Hi there,

I’m building a Sanic service within a microservices architecture that is instrumented with OpenTracing.

Does anyone have any experience instrumenting Sanic to provide request/response metadata according to the OpenTracing spec? Ideally we’d like to use a package that instruments our app for us.


@david-house-harvard Welcome to the Sanic community.

I wish I could help, but I am not familiar with OpenTracing or any projects out there implementing it.

However, if you have some documentation about the sorts of metadata you are talking about I’d be happy to help provide some ideas on how to achieve it.

I have used opentracing-python with aiohttp for an internal project along with our internal framework. But it was a long time ago. Let me see if I have any traces of that work in my disk and write up an example for it using sanic. I will see if I can get something for your over the weekend.


@david-house-harvard I’ve created a Git repo containing a new python package that you an use to easily add opentracing using jaeger client to your sanic application.

Above is an example of Jaeger UI with the spans listed.

GitHub Repo

Please let me know if this helps. If so, I would love to hear your feedback and any specific features that you think can go into this so that I can make this a proper package for the community to use.

Regards, H

1 Like

Thanks @harshanarayana, FWIW, I am also interested to see @david-house-harvard impressions on the opentracing integration.

1 Like

Incredible! thank you @harshanarayana.

I should have some time to experiment with your package next week. Would you prefer feedback to be sent here, or in GitHub issues on the project itself?

1 Like

Whatever is easier for you works for me. Git might be easier to track the work items or collaboration.

Here’s the set of items in my list for now.

  1. Generalize tracing client and enable support for zipkin and other that adhere to opentracing spec
  2. Tests and documentation
  3. Pip install support

It probably should be mentioned, but if any Sanic related projects would like a seperate category here for discussions I think that is perfectly acceptable.

I think that might be a good idea. We can have a dedicated category where sanic supporting tools can be discussed. Be it about helping on using some of those tools/ additional feature requests/quries.

Thanks for the suggestion @ahopkins This is for sure better than GitHub

Regards, H

Agreed. Both have its benefits.