You must configure
application_packages. Otherwise, these annotations will be ignored.Example:
Most Java projects define a root package (e.g., com.myproject). You can set the application package using Java system properties:Required Imports
Available Annotations
1. @CaptureTransaction
Creates a transaction for the annotated method. This is only applied when there is no active transaction on the same thread. Attributesvalue: Name of the transaction (default:ClassName#methodName)type: Type of the transaction (default:request)
- Starts and activates a transaction on method entry
- Ends and deactivates the transaction on method exit
2. @CaptureSpan
Creates a span as the child of the currently active span or transaction. If no transaction or span is active, nothing will be created. Attributesvalue: Name of the span (default:ClassName#methodName)type: Type of the span (default:app)subtype: Span subtype (e.g.,mysql)action: Related action (e.g.,query)discardable: Set to false to ensure the span is always reportedexit: Set to true to represent calls to external systems (e.g., DB or third-party APIs)
- Starts and activates a span on method entry
- Ends and deactivates the span on method exit
3. @Traced
Annotating a method with@Traced automatically decides whether to create a transaction or a span based on the context: it creates a child span if a span or transaction is active, otherwise it starts a new transaction.
Use @Traced when a method may act as either an entry point (transaction) or a unit of work within an existing transaction (span).
Attributes
value: Name of the span/transaction (default:ClassName#methodName)type: Type (default:requestfor transactions,appfor spans)subtype: Span subtype (ignored if a transaction is created)action: Span action (ignored if a transaction is created)discardable: Set to false to ensure the span is always reported (ignored for transactions)
- Automatically chooses between transaction or span
- Starts and activates on method entry
- Ends and deactivates on method exit