The set_custom_context API attaches contexts only to transactions
Describe the bug:
When using set_custom_context API, as per documentation, the expectation is to be able to attach custom data to a Transaction or to an Error.
From the code, it seems we apply the custom context only to Transactions which are sampled.
Expected behavior
The custom context should be attached to the Error too so that it will not be affected by sampling.
In any case, the request is to have an API to enrich errors without it being affected by sampling.
Potential workaround
If the objective is to enrich exceptions/errors, it is possible to use the custom named argument of capture_exception to enrich it. This information is attached to the Error and it will not be sampled.
Environment
- Python version: Python 2.7
- Framework and version: Django 1.11
- Agent version: 5.10.1
Thanks for the report! We'll take a look when we get a chance.