Skip to content

Commit bd999a2

Browse files
Feature/add sentry team tag (#16)
* bump dependencies * add team tag to sentry * add changing to readme
1 parent a6e7293 commit bd999a2

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ At your console, the logs now contain the trace-id identifier:
103103
[info] Some info about processing cool object with id 11 [trace-id: TRACER-ID] { extra: { id: 11, someInfo: 'someInfo' } }, module: 'path/to/my/file.js', timestamp: '2020-06-09T22:46:21.759Z'}
104104
```
105105
106+
### Team
107+
We have added a new concept that allow define a team that own the error.
108+
109+
If you create a custom error that contains a _team_ property, this value will appear as _team_ tag on sentry. It is useful in cross applications, like jaiminho, us-emails, markito, etc, because we can group error by team
110+
106111
## TODO
107112
108113
- Create Express Middleware Request Logger

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "quintoandar-logger",
3-
"version": "3.3.3",
3+
"version": "3.3.4",
44
"description": "Winston logger with custom 5A configuration",
55
"main": "src/main.js",
66
"dependencies": {
7-
"@sentry/node": "^5.27.2",
7+
"@sentry/node": "^5.30.0",
88
"lodash": "^4.17.20",
99
"stack-trace": "0.0.10",
1010
"util": "^0.12.3",

src/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ function formatParams(params, module, funcCallerParam) {
9494
}
9595
}
9696

97+
if (metadata.error && metadata.error.team) {
98+
metadata.team = metadata.error.team
99+
}
100+
97101
if(module) {
98102
metadata.module = module;
99103
}

src/transports.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ class SentryTransport extends Transport {
5454
if (info.traceId) {
5555
scope.setTag("traceId", info.traceId)
5656
}
57+
if (info.team) {
58+
scope.setTag('team', info.team)
59+
}
5760
scope.setContext(info)
5861
scope.setExtras(info);
5962
if (thereIsErrorExtraData) {

0 commit comments

Comments
 (0)