Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make sure startup.resource.perf doesn't contain paths #164812

Merged
merged 2 commits into from
Oct 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,39 @@ import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle
import { Registry } from 'vs/platform/registry/common/platform';
import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { posix } from 'vs/base/common/path';
import { hash } from 'vs/base/common/hash';

class ResourcePerformanceMarks {

constructor(@ITelemetryService telemetryService: ITelemetryService) {

type Entry = { name: string; duration: number };
type Entry = {
hosthash: string;
name: string;
duration: number;
};
type EntryClassifify = {
owner: 'jrieken';
comment: 'Resource performance numbers';
name: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'Resource name' };
hosthash: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'Hash of the hostname' };
name: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'Resource basename' };
duration: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'Resource duration' };
};
for (const item of performance.getEntriesByType('resource')) {
telemetryService.publicLog2<Entry, EntryClassifify>('startup.resource.perf', {
name: item.name,
duration: item.duration
});

try {
const url = new URL(item.name);
const name = posix.basename(url.pathname);

telemetryService.publicLog2<Entry, EntryClassifify>('startup.resource.perf', {
hosthash: `H${hash(url.host).toString(16)}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to allowlist a certain set of hosts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, we don't really want to know the exact host and I also don't want to hardcode a list of hostnames (in the OSS repo)

name,
duration: item.duration
});
} catch {
// ignore
}
}
}
}
Expand Down