You know that’s a really deep question. There are probably several ways to to application exceptions into events depending on the way your application is designed.
Application log monitoring using a check
If this is an application you can’t modify, you can use a Sensu check to monitor the error logs being produced by the application and/or the web server. This will even work with containerized application when using Sensu agent as a sidecar with access to the application logs.
Lightweight APM using Sensu agent events API
If you can modify the application, you can use the Sensu agent’s events api tcp socket as a lightweight customizable APM platform. You can instrument your application to generate Sensu events as json strings and send them to a running Sensu agent using the agent’s event api. The agent will forward the event on to the Sensu backend as if it were an event generated by a check. Using this pattern you can instrument your code to emit Sensu events for any condition you are concerned about and make it appear as if the agent was checking on your application. The trade-off to using the agent’s events api is you are limited to using some of the agent’s settings, such as the entity and I believe the namespace. If you need full control over the events you want to emit from your application you can access the Sensu backend API directly.
For Sensu Classic users who are migrating, the agent events API is essentially a modernized client socket, serving the same functional role but making using Sensu Go’s event data model.
APM using the Sensu backend API
If you need full authentication and RBAC controls, you can instrument your application to authenticate against the Sensu backend API and populate events directly using a dedicated user role that makes sense for your applications. This is more sophisticated pattern than the agent events api, as it gives you full power of the Sensu API model. There’s room here for the community to generate application language specific libraries to help abstract the Sensu Go backend API interactions to streamline the process.
I hope this helps, there’s a lot of room to explore how to best use the Sensu Go apis as a customizable APM platform.