APM Improvements (#11103)
# Checklist for submitter If some of the following don't apply, delete the relevant line. - [ ] Changes file added for user-visible changes in `changes/` or `orbit/changes/`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [ ] Documented any API changes (docs/Using-Fleet/REST-API.md or docs/Contributing/API-for-contributors.md) - [ ] Documented any permissions changes - [ ] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) - [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for new osquery data ingestion features. - [ ] Added/updated tests - [ ] Manual QA for all new/changed functionality - For Orbit and Fleet Desktop changes: - [ ] Manual QA must be performed in the three main OSs, macOS, Windows and Linux. - [ ] Auto-update manual QA, from released version of component to new version (see [tools/tuf/test](../tools/tuf/test/README.md)).
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/fleetdm/fleet/v4/server/contexts/host"
|
||||
"github.com/fleetdm/fleet/v4/server/contexts/viewer"
|
||||
"github.com/fleetdm/fleet/v4/server/fleet"
|
||||
"go.elastic.co/apm/v2"
|
||||
)
|
||||
|
||||
type key int
|
||||
@@ -127,6 +128,10 @@ func wrapError(ctx context.Context, msg string, cause error, data map[string]int
|
||||
}
|
||||
|
||||
edata := encodeData(ctx, data, !isFleetError)
|
||||
|
||||
// As a final step, report error to APM.
|
||||
// This is safe to to even if APM is not enabled.
|
||||
apm.CaptureError(ctx, cause).Send()
|
||||
return &FleetError{msg, stack, cause, edata}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user