@stone-js/telemetry
v0.8.16
Published
Framework-agnostic telemetry for Stone.js: spans, counters and gauges wired through the kernel hooks and middleware, with pluggable exporters (console by default, OpenTelemetry-friendly).
Downloads
1,535
Maintainers
Readme
Stone.js · Telemetry
Framework-agnostic telemetry for Stone.js: spans, counters and gauges wired through the kernel hooks and middleware, with pluggable exporters (console by default, OpenTelemetry-friendly).
Part of Stone.js, the reference implementation of the Continuum Architecture: write your domain once, and the context (runtime, protocol, caller) applies to it at run time.
Install
npm i @stone-js/telemetryEnabling it
Like every Stone.js module, it is enabled in one of two ways, and configured afterwards under
stone.telemetry. It registers the telemetry provider and the kernel middleware that traces every event.
import { Telemetry } from '@stone-js/telemetry'
import { StoneApp } from '@stone-js/core'
@Telemetry({ serviceName: 'tasks-api' })
@StoneApp({ name: 'my-app' })
export class Application {}import { defineStoneApp } from '@stone-js/core'
import { telemetryBlueprint } from '@stone-js/telemetry'
export const Application = defineStoneApp({ name: 'my-app' }, [telemetryBlueprint])Configure it from a @Configuration class or defineConfig:
export const AppConfig = defineConfig((blueprint) => blueprint.set('stone.telemetry', { /* ... */ }))Usage
import { Telemetry } from '@stone-js/telemetry'
import { StoneApp } from '@stone-js/core'
// Spans, counters and gauges wired through the kernel, exporter-agnostic.
@Telemetry()
@StoneApp({ name: 'my-app' })
export class Application {}
// Inject the telemetry service in a handler/service to record spans and metrics.Documentation
Full documentation: stonejs.dev/docs/extensions/telemetry.
License
MIT © Evens Pierre ("Mr. Stone") and the Stone.js contributors.
