AttributesBehavior
Defined in: attributes.behavior.ts:58
Collects attributes that describe what the rest of the chain decided, and
adds them to the execution’s attribute bag, which TraceBehavior applies to
its span and MetricsBehavior to its labels when includeContextAttributes
is on.
Behaviors that take no telemetry dependency publish their decisions as
context.items entries and export a factory that reads them, such as
buildCacheAttributes of @nestjs-pipeline/cache. This behavior runs those
factories after the chain unwinds, so every inner behavior has published its
item by then. The application chooses the factories, can wrap one to rename
or drop attributes, and can register the behavior globally or per handler.
Register it inside TraceBehavior and MetricsBehavior and outside the
behaviors it describes. It never changes the outcome: the result or error
of the chain is returned as it was.
Example
Section titled “Example”PipelineModule.forRoot({ globalBehaviors: { before: [ TraceBehavior, [AttributesBehavior, { factories: [buildCacheAttributes, buildIdempotencyAttributes], }], ], },});Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AttributesBehavior():
AttributesBehavior
Returns
Section titled “Returns”AttributesBehavior
Methods
Section titled “Methods”handle()
Section titled “handle()”handle(
context,next):Promise<unknown>
Defined in: attributes.behavior.ts:59
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”Promise<unknown>