Instrument slow git status updates (#158325)

* Instrument slow git status updates

* Add expiration
This commit is contained in:
Harald Kirschner
2022-08-22 22:01:51 +02:00
committed by GitHub
parent 10b464bc93
commit bb70d7ab19

View File

@@ -1896,7 +1896,9 @@ export class Repository implements Disposable {
const limit = scopedConfig.get<number>('statusLimit', 10000);
const start = new Date().getTime();
const { status, statusLength, didHitLimit } = await this.repository.getStatus({ limit, ignoreSubmodules, untrackedChanges });
const totalTime = new Date().getTime() - start;
if (didHitLimit) {
/* __GDPR__
@@ -1904,10 +1906,11 @@ export class Repository implements Disposable {
"owner": "lszomoru",
"ignoreSubmodules": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Setting indicating whether submodules are ignored" },
"limit": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "Setting indicating the limit of status entries" },
"statusLength": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "Total number of status entries" }
"statusLength": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "Total number of status entries" },
"totalTime": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "Total number of ms the operation took" }
}
*/
this.telemetryReporter.sendTelemetryEvent('statusLimit', { ignoreSubmodules: String(ignoreSubmodules) }, { limit, statusLength });
this.telemetryReporter.sendTelemetryEvent('statusLimit', { ignoreSubmodules: String(ignoreSubmodules) }, { limit, statusLength, totalTime });
}
const config = workspace.getConfiguration('git');
@@ -1951,6 +1954,22 @@ export class Repository implements Disposable {
}
}
if (totalTime > 5000) {
/* __GDPR__
"statusSlow" : {
"owner": "digitarald",
"comment": "Reports when git status is slower than 5s",
"expiration": "1.73",
"ignoreSubmodules": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Setting indicating whether submodules are ignored" },
"didHitLimit": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Total number of status entries" },
"didWarnAboutLimit": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "True when the user was warned about slow git status" },
"statusLength": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "Total number of status entries" },
"totalTime": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "Total number of ms the operation took" }
}
*/
this.telemetryReporter.sendTelemetryEvent('statusSlow', { ignoreSubmodules: String(ignoreSubmodules), didHitLimit: String(didHitLimit), didWarnAboutLimit: String(this.didWarnAboutLimit) }, { statusLength, totalTime });
}
let HEAD: Branch | undefined;
try {