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

Support for fastify #41

Closed
PatrickHeneise opened this issue May 29, 2020 · 12 comments
Closed

Support for fastify #41

PatrickHeneise opened this issue May 29, 2020 · 12 comments
Labels
instrumentation-request up-for-grabs Good for taking. Extra help will be provided by maintainers

Comments

@PatrickHeneise
Copy link

Is your plugin request related to a problem? Please describe.

We'd like to use the gcloud trace agent in our software which is runs on fastify. Fastify uses a similar API to express, I was hoping this would work out of the box, but unfortunately that's not the case.

Is it applicable for Node or Browser or both

  • Node

Additional context

Original issue: googleapis/cloud-trace-nodejs#1167 (comment)

@mayurkale22 mayurkale22 added the up-for-grabs Good for taking. Extra help will be provided by maintainers label May 29, 2020
@mayurkale22
Copy link
Member

Thanks for opening this. I marked it as up-for-grabs for now. If you are feeling motivated, maybe you can attempt to write solution and open a PR.

@carolinee21
Copy link
Contributor

@PatrickHeneise Hi - I was wondering if there have been any updates on this. Thanks!

@PatrickHeneise
Copy link
Author

Haven't had a chance yet. @mayurkale22 how would I start on this? And, if I add fastify, how does it make it's way into Google Trace?

@dyladan
Copy link
Member

dyladan commented Jun 22, 2020

@PatrickHeneise I would take a look at some of the node plugins in this repo to get an idea how they work, but generally we use shimmer to wrap functions exported by the module we want to instrument. The plugin uses the SDK to generate spans and other instrumentation data, and the SDK handles exporting it to a backend using the configured tracing exporter. Google cloud trace has a tracing exporter that you would use for that.

@vmarchaud
Copy link
Member

For the plugin, you could refer to the implementation done by datadog here: https://github.com/DataDog/dd-trace-js/tree/master/packages/datadog-plugin-fastify/src
Note that the Tracer API is way different but at least you know which functions to patch :)

@adamegyed
Copy link

It looks like someone has already written a library connecting fastify to OpenTelemetry here: https://github.com/mkinoshi/fastify-opentelemetry
However, this does not conform to the spec of an OpenTelemetry plugin, rather, it is a fastify plugin that interacts with OpenTelemetry. There might still be value in adapting this to the form of an OT plugin.

@dyladan
Copy link
Member

dyladan commented Jul 1, 2020

Both approaches likely have value, but it may be better to spend time elsewhere if there is already a good way to get spans from fastify.

@HW13
Copy link

HW13 commented Aug 24, 2020

We recently published a fastify plugin that utilizes @opentelemetry/api to trace requests. It's lightweight, but provides the tools to add more granular/custom tracing implementations if desired. Cheers 😄 -> https://github.com/autotelic/fastify-opentelemetry

@dyladan
Copy link
Member

dyladan commented Aug 26, 2020

@HW13 You may want to think about listing it on the registry

@HW13
Copy link

HW13 commented Aug 26, 2020

Thanks for the suggestion @dyladan 😎 - just opened a PR -> open-telemetry/opentelemetry.io#241

@vmarchaud
Copy link
Member

@dyladan Do we want to keep this issue open since there are multiple solutions available ?

@rauno56
Copy link
Member

rauno56 commented Dec 29, 2021

Support for fastify is in the contrib now in addition to the one mentioned above: https://github.com/autotelic/fastify-opentelemetry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
instrumentation-request up-for-grabs Good for taking. Extra help will be provided by maintainers
Projects
None yet
Development

No branches or pull requests

8 participants