elastic / elastic/apm-agent-java

Add public API method for customising captured exceptions

Open
#853 0 comments 0 reactions 0 assignees View on GitHub
api enhancement
Dominant language
Java
Stars
594
Forks
338
Avg merge
1d 13h
Merged PRs (30d)
25

Description

**Is your feature request related to a problem? Please describe.**

Some exceptions may include additional information that is not part of the exception's message or type. Users currently have no means of capturing this information.

**Describe the solution you'd like**

The [exception schema](https://www.elastic.co/guide/en/apm/server/current/error-api.html) supports recording an error code (string or number), as well as arbitrary key/value attributes. We should provide an API for users to set these for captured exceptions.

Ideally users could register a callback that will be invoked for exceptions of a given type or type-hierarchy. The callback would have the opportunity to set an error code and/or attributes. For reference, the Go agent provides two top-level functions:

- https://godoc.org/go.elastic.co/apm#RegisterErrorDetailer
- https://godoc.org/go.elastic.co/apm#RegisterTypeErrorDetailer

**Describe alternatives you've considered**

The agent could also (or alternatively) provide an API for capturing an exception without immediately sending it; it would return an object that could be customised, and a have a method for sending it when done.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.