Μετάβαση στο περιεχόμενο

buildDeadLetterAttributes

Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.

buildDeadLetterAttributes(context): Record<string, boolean>

Defined in: packages/pipeline-deadletter/src/helpers/build-attributes.ts:39

The dead-letter outcome of one execution as flat attributes: { 'dead_letter.captured': true } when DeadLetterBehavior delivered a record of the failure, {} otherwise — a success, an ignored error, a delivery that failed, or no dead-letter behavior at all.

The result is plain data and needs no telemetry package: put it on a span, a log line, an audit record or a metric label (bounded values only).

IPipelineContext

The pipeline execution, read after DeadLetterBehavior ran.

Record<string, boolean>

The attributes; empty unless a record was delivered.

Span attributes

With AttributesBehavior of @cqrs-ddd/pipeline-opentelemetry:

createPipeline({
globalBehaviors: {
before: [TraceBehavior, [AttributesBehavior, { factories: [buildDeadLetterAttributes] }]],
},
});

A log line from a custom behavior, after the chain ran

async handle(context: IPipelineContext, next: NextDelegate) {
try {
return await next();
} finally {
this.logger.log({ request: context.requestName, ...buildDeadLetterAttributes(context) });
}
}