You can include extra information in traces, exceptions and HTTP failures by using the addCustomContext()
function.
Compatibility
Compatible with all Java agent versions.
Syntax
import com.atatus.apm.api.Atatus;
import com.atatus.apm.api.Transaction;
Transaction transaction = Atatus.currentTransaction();
transaction.addCustomContext($key, $value);
Parameter
Parameter | Type | Description |
---|---|---|
$key | String (Required) | Custom data name. |
$value | String or Integer or Boolean (Required) | Custom data value. |
Example
copy
import com.atatus.apm.api.Atatus;
import com.atatus.apm.api.Transaction;
public class ViewController {
public String processRequest(){
Transaction transaction = Atatus.currentTransaction();
transaction.addCustomContext("body", "{ userId: 100, username: 'daniel' }");
}
}