For instance, if you want to know the response time of the function transactions you have written, you can use this function.
Compatibility
Compatible with Node.js agent version 1.x or higher
Syntax
atatus.startSpan(custom_span_name)
Parameter
Parameter | Type | Description |
---|---|---|
custom_span_name | String (Required) | Custom span name. |
Examples
Example 1:
copy
import atatus from "atatus-nodejs";
var span = atatus.startSpan("Processing data");
processor.execute(data, function(err, result){
if(err) {
console.log("Error processing data :", err);
}
span.end();
// TODO: your code here
});
Example 2:
copy
import atatus from "atatus-nodejs";
atatus.startBackgroundTransaction('Monthly Report Generation');
var span = atatus.startSpan("Processing data");
processor.execute(data, function(err, result){
if(err) {
console.log("Error processing data :", err);
}
span.end();
// TODO: your code here
// End the transaction
atatus.endTransaction();
});