feat(p9): propagate trace id into emitted events + structured relay/gateway logs
Task O.2: ai/calendar/route/ingest emit sites now stamp traceparent + insignia. correlationId from interaction.traceId ?? currentTraceId() ?? generated (mirroring message.send; inbox/inbound already carried correlationId). toTraceparent is hex-safe (UUID used as-is, other ids hashed). OutboxRelay logs a structured relay.publish per event (eventType/aggregateId/correlationId); MessageGateway logs ws.deliver. Tests: an event's correlationId equals the active request trace, with a generated fallback. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
IngestInteractionRequest,
|
||||
IngestInteractionResponse,
|
||||
} from '@insignia/iios-contracts';
|
||||
import { currentTraceId, newTraceId, toTraceparent } from '../observability/trace-context';
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import { PLATFORM_PORTS } from '../platform/platform-ports';
|
||||
import { decideOrThrow } from '../platform/fail-closed';
|
||||
@@ -188,8 +189,10 @@ export class IngestService {
|
||||
subject: `interaction/${created.id}`,
|
||||
time: new Date().toISOString(),
|
||||
datacontenttype: 'application/json',
|
||||
traceparent: toTraceparent(created.traceId ?? currentTraceId() ?? newTraceId()),
|
||||
insignia: {
|
||||
scopeSnapshotId: scope.id,
|
||||
correlationId: created.traceId ?? currentTraceId() ?? newTraceId(),
|
||||
policyDecisionId: decision.decisionRef,
|
||||
idempotencyKey,
|
||||
dataClass: 'internal',
|
||||
|
||||
Reference in New Issue
Block a user