File tree Expand file tree Collapse file tree 4 files changed +30
-1
lines changed
src/internal/cli/telemetry/sentry
test/internal/cli/telemetry/sentry Expand file tree Collapse file tree 4 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ export class Anonymizer {
55
55
const result : Event = {
56
56
event_id : event . event_id ,
57
57
platform : event . platform ,
58
+ release : event . release ,
58
59
timestamp : event . timestamp ,
59
60
extra : event . extra ,
60
61
} ;
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import { createGetModuleFromFilename } from "./vendor/utils/module.js";
30
30
interface InitOptions {
31
31
dsn : string ;
32
32
transport : ( transportOptions : BaseTransportOptions ) => Transport ;
33
+ release ?: string ;
33
34
serverName ?: string ;
34
35
integrations ?: ( integrations : Integration [ ] ) => Integration [ ] ;
35
36
}
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ class Reporter {
68
68
"./vendor/integrations/contextlines.js"
69
69
) ;
70
70
71
+ const hardhatVersion = await getHardhatVersion ( ) ;
71
72
const { init } = await import ( "./init.js" ) ;
72
73
73
74
const linkedErrorsIntegrationInstance = linkedErrorsIntegration ( {
@@ -79,14 +80,15 @@ class Reporter {
79
80
await init ( {
80
81
dsn : SENTRY_DSN ,
81
82
transport : makeSubprocessTransport ,
83
+ release : `hardhat@${ hardhatVersion } ` ,
82
84
integrations : ( ) => [
83
85
linkedErrorsIntegrationInstance ,
84
86
contextLinesIntegrationInstance ,
85
87
] ,
86
88
} ) ;
87
89
88
90
setExtra ( "nodeVersion" , process . version ) ;
89
- setExtra ( "hardhatVersion" , await getHardhatVersion ( ) ) ;
91
+ setExtra ( "hardhatVersion" , hardhatVersion ) ;
90
92
91
93
return this . #instance;
92
94
}
Original file line number Diff line number Diff line change
1
+ import type { Event } from "@sentry/core" ;
2
+
1
3
import assert from "node:assert/strict" ;
2
4
import path from "node:path" ;
3
5
import { describe , it } from "node:test" ;
@@ -17,6 +19,29 @@ class MockedAnonymizer extends Anonymizer {
17
19
}
18
20
19
21
describe ( "Anonymizer" , ( ) => {
22
+ it ( "should clone key information from an anonymized event" , async ( ) => {
23
+ const originalEvent : Event = {
24
+ event_id : "my-event" ,
25
+ platform : "platform1" ,
26
+ release : "release1" ,
27
+ timestamp : 1754398906 ,
28
+ extra : {
29
+ another : "example" ,
30
+ } ,
31
+ } ;
32
+
33
+ const anonymizer = new Anonymizer ( ) ;
34
+
35
+ const result = await anonymizer . anonymize ( originalEvent ) ;
36
+
37
+ if ( ! result . success ) {
38
+ assert . fail ( "The event should anonymize without issue" ) ;
39
+ return ;
40
+ }
41
+
42
+ assert . deepEqual ( result . event , originalEvent ) ;
43
+ } ) ;
44
+
20
45
it ( "should anonymize paths of the user's project" , async ( ) => {
21
46
const anonymizer = new Anonymizer ( ) ;
22
47
const anonymizationResult = await anonymizer . anonymizeFilename (
You can’t perform that action at this time.
0 commit comments