Manage Business Transaction Snapshots
The agent automatically creates transaction snapshots when monitoring a Business Transaction. Transaction snapshots are useful for troubleshooting poor performance because they describe instances of the business transaction at certain points in time.
Other than creating the Business Transaction, you do not have to modify anything to create these snapshots, but you can add calls to:
- Determine if a snapshot is being taken
- Provide additional data in a snapshot
- Set the URL for a snapshot
Determine if the Agent is Taking a Snapshot Now
Due to high cost, the agent does not constantly collect snapshots. By default, it collects a snapshot every ten minutes, but this schedule is configurable. See Configure Snapshot Periodic Collection Frequency.
You can determine if a snapshot is happening using IsBTSnapshotting()
,
which returns true
if the agent is collecting a snapshot. This method
avoids wasted overhead in collecting user data for a snapshot or setting the snapshot URL if
no snapshots are being collected.
Add Business Transaction User Data
You can optionally add data to transaction snapshots. For example, you might want to know which users are getting a lot of errors, or from which regions users are experiencing slow response times, or which methods are slow. In the Controller UI, the data appears in the USER DATA tab of the transaction snapshot.
If a snapshot is occurring, use AddUserDataToBT()
passing a key and value
for the data that you want the snapshot to collect.
Add Snapshot URL
If a snapshot is occurring, you can set a URL for the current snapshot using
SetBTURL()
.
Set Snapshot Example
func setSnapshotAttributes(bt appd.BtHandle, key, value string) {
if appd.IsBTSnapshotting(bt) {
appd.AddUserDataToBT(bt, key, value)
appd.SetBTURL(bt, "user/login")
}
}