An argument list object where the name field is required.
The args is an object defined by (in any order):
{
name: string = ""; Required; Not supplying a name will result in no value being recorded.
attributes?: AttrMap = {}; Optional; Attributes for the counter metric.
carrier?: CarrierMap = {}; Optional; Used to create a context for the trace block.
}
reinitializeTelemetry from within a traceBlock will result in an
exception (Error) being thrown!await traceBlock({name: "myTraceBlock", attributes: { key: "value" }}) { aspan =>
aspan.addAttributes({ additional: "attributes" });
// do some async code here with awaits...
aspan.addEvent("eventName", { "attr": "value" });
// do some more code with awaits...
aspan.addException(new Error("An error occurred"));
aspan.setErrorStatus("An error occurred");
// finish the code block
})
Executes a block of code (async) within a tracing context, optionally attaching attributes and a carrier.