$ fastify generate myapp --lang=typescript
$ cd myapp
$ npm install
# install otel dependencies
$ npm i @fastify/otel @opentelemetry/auto-instrumentations-node
import { FastifyOtelInstrumentation } from '@fastify/otel'
// ...
const app: FastifyPluginAsync<AppOptions> = async (
fastify,
opts
): Promise<void> => {
// Place here your custom code!
const fastifyOtelInstrumentation = new FastifyOtelInstrumentation();
await fastify.register(fastifyOtelInstrumentation.plugin());
// ...
}
export default app
export { app, options }
# configure @opentelemetry/auto-instrumentations as usual (.env, ENV, etc...)
$ npm run dev -- --node-options="--require @opentelemetry/auto-instrumentations-node/register"