Sentry AOP
sigewine-aop-sentry
extension provides an easy way to integrate Sentry with your application using Sigewine's AOP functionality.
Usage
To use the Sentry AOP functionality, you need to add the sigewine-aop-sentry
module to your project. Please refer to main Sigewine documentation for more information.
Sentry Method Wrapper
sigewine-aop-sentry
comes with pre-defined method wrapper for Sentry, the SentryTransactionMethodWrapper
. You need to register it within the AOP Constellation. For information regarding AOP Constellation, please refer to Sigewine AOP documentation.
Annotating Methods and Classes
To use the Sentry method wrapper in your application, you need to annotate the methods or classes that you want to wrap with the @SentryTransaction
annotation. Annotating a class will wrap all methods in it.
Upon invoking the annotated methods, Sentry will automatically create a transaction and capture any exceptions that occur during the method execution. If there's an existing transaction in the Sentry scope, it will be used as a parent transaction. If not, a new transaction will be created.
Advanced Usage
Sentry Transaction annotation parameters
You may customize the Sentry transactions by providing additional parameters to the `@SentryTransaction` annotation.
Parameter | Description |
---|---|
name | Name of the transaction. If not specified, will use |
operation | Operation of the transaction |
bindToScope | Whether to bind the transaction to the Sentry scope. If not bind, you may access the transaction using |
onlySpan | If true, span will be created only if there is a transaction bind to the current scope. Default is true. |
captureExceptions | Whether to capture exceptions that occur during the method execution. Default is true. |
configurator | A class that implements |
Transaction Configurator
You may create your own transaction configurator that will be used every time a transaction from specific annotation is created.