@benhepburn/adonis-sentry 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/build/src/adonis_event_processor.js +0 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,6 +35,13 @@ SENTRY_DSN=https://<...>.sentry.io/<...>
|
|
|
35
35
|
SENTRY_TRACES_SAMPLE_RATE=1.0 # Set this to a lower value in production
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
To enable enhanced event data, you must enable useAsyncLocalStorage in config/app.ts
|
|
39
|
+
so the current request can be fetched ([see caveats here](https://docs.adonisjs.com/guides/async-local-storage#caveats)):
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
useAsyncLocalStorage: true,
|
|
43
|
+
```
|
|
44
|
+
|
|
38
45
|
## Usage
|
|
39
46
|
|
|
40
47
|
Import the service to use it:
|
|
@@ -3,16 +3,12 @@ export const adonisEventProcessor = (event, _hint) => {
|
|
|
3
3
|
const ctx = HttpContext.get();
|
|
4
4
|
if (!ctx)
|
|
5
5
|
return event;
|
|
6
|
-
let body = ctx.request.body();
|
|
7
|
-
if (JSON.stringify(body).length > 2000)
|
|
8
|
-
body = undefined;
|
|
9
6
|
if (!event.contexts)
|
|
10
7
|
event.contexts = {};
|
|
11
8
|
// Add request data
|
|
12
9
|
event.request = {
|
|
13
10
|
method: ctx.request.method(),
|
|
14
11
|
url: ctx.request.url(true),
|
|
15
|
-
data: body,
|
|
16
12
|
};
|
|
17
13
|
// Add response data
|
|
18
14
|
event.contexts.response = {
|