Skip to main content

grammY plugin to allow instrumentation with open telemetry

This package works with Bun, Cloudflare Workers, Node.js, Deno, Browsers
JSR Score
100%
Published
3 months ago (0.0.2)
variable openTelemetry

Main plugin function. Enables OpenTelemetry for every update and every API call performed via Context helpers (eg: ctx.reply).

Examples

Example 1

import { Bot, Context } from "grammy";
import { openTelemetry } from "grammy-opentelemetry";
import { getHttpTracer } from "grammy-opentelemetry";

const bot = new Bot<Context>("token");
bot.use(openTelemetry(getHttpTracer("my-bot")));
bot.start();

Type

(tracer: otel.Tracer, options?: PluginOptions) => MiddlewareFn<Context & OpenTelemetryContext>

Add Package

deno add @roz/grammy-opentelemetry

Import symbol

import { openTelemetry } from "@roz/grammy-opentelemetry";

Add Package

npx jsr add @roz/grammy-opentelemetry

Import symbol

import { openTelemetry } from "@roz/grammy-opentelemetry";

Add Package

yarn dlx jsr add @roz/grammy-opentelemetry

Import symbol

import { openTelemetry } from "@roz/grammy-opentelemetry";

Add Package

pnpm dlx jsr add @roz/grammy-opentelemetry

Import symbol

import { openTelemetry } from "@roz/grammy-opentelemetry";

Add Package

bunx jsr add @roz/grammy-opentelemetry

Import symbol

import { openTelemetry } from "@roz/grammy-opentelemetry";