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)
type alias OpenTelemetryContext

Context property added by the plugin.

Combine this with your own context type to extend it.

import { Context } from "grammy";
import { OpenTelemetryContext } from "grammy-opentelemetry";
type MyContext = Context & OpenTelemetryContext;

const bot = new Bot<MyContext>("token");

Properties

openTelemetry: { tracer: otel.Tracer; context: otel.Context; spanContext: otel.SpanContext; trace: (name: string, attributes: Attributes, fn: (span: otel.Span) => Promise<unknown>) => void; }

Add Package

deno add @roz/grammy-opentelemetry

Import symbol

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

Add Package

npx jsr add @roz/grammy-opentelemetry

Import symbol

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

Add Package

yarn dlx jsr add @roz/grammy-opentelemetry

Import symbol

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

Add Package

pnpm dlx jsr add @roz/grammy-opentelemetry

Import symbol

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

Add Package

bunx jsr add @roz/grammy-opentelemetry

Import symbol

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