esbuild-otel-instrumentation
Installation
SKILL.md
esbuild ESM bundle で OTel auto-instrumentation が動かない
症状
Hono / Node TypeScript アプリで:
@opentelemetry/sdk-nodeまたは@opentelemetry/sdk-trace-nodeを register@opentelemetry/instrumentation-http/instrumentation-grpc等をregisterInstrumentations()で追加- アプリ起動 / リクエスト処理は正常
- collector に span が一切届かない (no error, no log)
原因
@opentelemetry/instrumentation-* 系は内部で require-in-the-middle を使って CommonJS の require() を hook して target module (node:http 等) に monkey-patch を仕込む。
esbuild で --format=esm bundle すると、bundle 内の import { createServer } from "node:http" は ESM static import に変換され、require() は呼ばれない → hook が発火しない → patch されない → span が作られない。
エラーは出ない (silent failure)。