@@ -7,23 +7,39 @@ import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle
7
7
import { Registry } from 'vs/platform/registry/common/platform' ;
8
8
import { Extensions , IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions' ;
9
9
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
10
+ import { posix } from 'vs/base/common/path' ;
11
+ import { hash } from 'vs/base/common/hash' ;
10
12
11
13
class ResourcePerformanceMarks {
12
14
13
15
constructor ( @ITelemetryService telemetryService : ITelemetryService ) {
14
16
15
- type Entry = { name : string ; duration : number } ;
17
+ type Entry = {
18
+ hosthash : string ;
19
+ name : string ;
20
+ duration : number ;
21
+ } ;
16
22
type EntryClassifify = {
17
23
owner : 'jrieken' ;
18
24
comment : 'Resource performance numbers' ;
19
- name : { classification : 'SystemMetaData' ; purpose : 'PerformanceAndHealth' ; comment : 'Resource name' } ;
25
+ hosthash : { classification : 'SystemMetaData' ; purpose : 'PerformanceAndHealth' ; comment : 'Hash of the hostname' } ;
26
+ name : { classification : 'SystemMetaData' ; purpose : 'PerformanceAndHealth' ; comment : 'Resource basename' } ;
20
27
duration : { classification : 'SystemMetaData' ; purpose : 'PerformanceAndHealth' ; isMeasurement : true ; comment : 'Resource duration' } ;
21
28
} ;
22
29
for ( const item of performance . getEntriesByType ( 'resource' ) ) {
23
- telemetryService . publicLog2 < Entry , EntryClassifify > ( 'startup.resource.perf' , {
24
- name : item . name ,
25
- duration : item . duration
26
- } ) ;
30
+
31
+ try {
32
+ const url = new URL ( item . name ) ;
33
+ const name = posix . basename ( url . pathname ) ;
34
+
35
+ telemetryService . publicLog2 < Entry , EntryClassifify > ( 'startup.resource.perf' , {
36
+ hosthash : `H${ hash ( url . host ) . toString ( 16 ) } ` ,
37
+ name,
38
+ duration : item . duration
39
+ } ) ;
40
+ } catch {
41
+ // ignore
42
+ }
27
43
}
28
44
}
29
45
}
0 commit comments