nitro-opentelemetry
v0.3.0
Published
<!-- automd:badges color=yellow -->
Downloads
146
Readme
nitro-opentelemetry
Opentelemetry integration for nitro. Without patching nitro.
This nitro module automatically create spans for request and error happening in your nitro server.
Usage
Install package:
# ✨ Auto-detect
npx nypm install nitro-opentelemetry
# npm
npm install nitro-opentelemetry
# yarn
yarn add nitro-opentelemetry
# pnpm
pnpm install nitro-opentelemetry
# bun
bun install nitro-opentelemetry
Add the module:
//https://nitro.unjs.io/config
export default defineNitroConfig({
modules: [
'nitro-opentelemetry'
]
});
Config
You can configure the module with the otel
property in your nitro.config.ts
- preset:
- Option to configure the preset that will be used with OTEL
Hooks
Here are the available hooks.
interface NitroRuntimeHooks {
'otel:span:name': (context: { event: H3Event, name: undefined|string }) => void
}
- otel:span:name
- Ran when a span is created.
Utils
defineTracedEventHandler
- Wrap your event handler with the span affected to your event
Development
- Clone this repository
- Install latest LTS version of Node.js
- Enable Corepack using
corepack enable
- Install dependencies using
pnpm install
- Run interactive tests using
pnpm dev
License
Published under the MIT license. Made by community 💛
🤖 auto updated with automd