feat(core-shared): SentryLogRecordForwarder + wire OtelLogger in OTel pipeline

Adds SentryLogRecordForwarder (LogRecordProcessor impl) to sentry-bridge.ts
that forwards OTel log records to Sentry via captureException/captureMessage.
Wires it as a BatchLogRecordProcessor in init-server-node.ts. Replaces
SentryLogger with OtelLogger in bind-otel-instrumentation.ts. 7 new bridge
tests pass alongside the existing 25 tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-11 11:53:23 +02:00
parent 5e795fd7ab
commit ad64009e86
4 changed files with 230 additions and 20 deletions

View File

@@ -1,7 +1,7 @@
// packages/core-shared/src/instrumentation/di/bind-otel-instrumentation.ts
import type { Container } from "inversify";
import { OtelTracer } from "../otel/otel-tracer";
import { SentryLogger } from "../sentry/sentry-logger";
import { OtelLogger } from "../otel/otel-logger";
import { initOtelServerNode } from "../otel/init-server-node";
import { INSTRUMENTATION_SYMBOLS } from "../symbols";
import type { ITracer, ILogger } from "../index";
@@ -31,7 +31,7 @@ export function bindOtelInstrumentation(
});
const tracer = new OtelTracer();
const logger = new SentryLogger(); // Phase 3 replaces with OtelLogger
const logger = new OtelLogger();
if (container.isBound(INSTRUMENTATION_SYMBOLS.TRACER)) {
container.unbind(INSTRUMENTATION_SYMBOLS.TRACER);