Skip to content

Migrate to @fastify/otel instrumentation #15130

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

Closed
andreiborza opened this issue Jan 22, 2025 · 17 comments · Fixed by #15542
Closed

Migrate to @fastify/otel instrumentation #15130

andreiborza opened this issue Jan 22, 2025 · 17 comments · Fixed by #15542

Comments

@andreiborza
Copy link
Member

andreiborza commented Jan 22, 2025

Description

Fastify has taken ownership over the fastify Otel instrumentation and migrated the integration out of the opentelemetry-js-contrib repo into their own repo.

Once open-telemetry/opentelemetry-js-contrib#2652 lands, the current instrumentation, which we are using, will be disabled by default and removed completely by March 25, 2025.

Solution Brainstorm

Migrating to @fastify/otel is inevitable, but if integration proves difficult we have to specifically enable the integration,

@mydea
Copy link
Member

mydea commented Jan 22, 2025

is there something that speaks against just switching out the instrumentation right now?

@mydea mydea changed the title Replace fastify otel integration Migrate to @fastify/otel instrumentation Jan 22, 2025
@mydea
Copy link
Member

mydea commented Jan 22, 2025

hmm, this only supports fastify 5+ 😬

@mydea
Copy link
Member

mydea commented Jan 22, 2025

See: fastify/otel#10

@mydea
Copy link
Member

mydea commented Jan 22, 2025

After talking about this some more, our idea is to:

  1. Switch to use @fastify/otel instead of @opentelemetry/instrumentation-fastify
  2. Vendor the current state of @opentelemetry/instrumentation-fastify into the node package (note: We'll need to also inline some of the types accordingly). Limiting the range this applies to to >=3<=4.

We can use this blueprint for other similar situations too, in the future! This way, we continue to support fastify 3+, but can stay on the latest version of the official instrumentation and get improvements from there.

@punkpeye
Copy link

@mydea Is there a way to adopt this today without waiting for sentry to adopt it?

I suspect this is the cause of all my issues – errors associated with wrong requests, etc.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 24, 2025
@andreiborza
Copy link
Member Author

@punkpeye not without forking our sdk and building it in.

We're not aware of the current approach not working though, please feel free to file an issue with a reproduction for the problems you're encountering currently and we'll help you.

Copy link
Member

mydea commented Apr 14, 2025

@onur is this ready to go?

@mydea mydea added the Fastify label Apr 14, 2025 — with Linear
Copy link
Collaborator

@mydea, yes it's ready to be merged

@punkpeye
Copy link

I think this is already released

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Apr 20, 2025
Copy link
Member

mydea commented Apr 22, 2025

We should hopefully be able to merge & release this soon!

@punkpeye
Copy link

punkpeye commented May 1, 2025

@mydea has this been released?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 1, 2025
@punkpeye
Copy link

punkpeye commented May 1, 2025

I cannot tell if my code is even being properly instrumented. These are the logs:

Sentry Logger [debug]: @opentelemetry/instrumentation-fastify Applying instrumentation patch for module on require hook {
  module: 'fastify',
  version: '5.3.2',
  baseDir: '/Users/frank/Developer/punkpeye/glama/node_modules/.pnpm/[email protected]/node_modules/fastify'
}
[Sentry] fastify is not instrumented. Please make sure to initialize Sentry in a separate file that you `--import` when running node, see: https://docs.sentry.io/platforms/javascript/guides/fastify/install/esm/.

I do not see anything past that that would mention Fastify.

@onurtemizkan
Copy link
Collaborator

Hi @punkpeye. No, it's not released yet. It's ready to be merged, though, so it'll be out soon.

@punkpeye
Copy link

punkpeye commented May 2, 2025

Created a separate issue #16187

@punkpeye
Copy link

punkpeye commented May 7, 2025

Was this not release v 9.16.0 ?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 7, 2025
@andreiborza
Copy link
Member Author

@punkpeye not yet, still waiting on #15542

Copy link
Contributor

github-actions bot commented May 8, 2025

A PR closing this issue has just been released 🚀

This issue was referenced by PR #15542, which was included in the 9.17.0 release.

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

Successfully merging a pull request may close this issue.

5 participants