Skip to content
Draft
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
17 changes: 3 additions & 14 deletions src/metrics/listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export class MetricsListener {

if (this.isAgentRunning) {
logDebug(`Using StatsD client`);
if (this.statsDClient) {
return;
}

this.statsDClient = new StatsD({ host: "127.0.0.1", closingFlushInterval: 1 });
return;
Expand All @@ -99,20 +102,6 @@ export class MetricsListener {

await processor.flush();
}
if (this.statsDClient !== undefined) {
logDebug(`Flushing statsD`);

// Make sure all stats are flushed to extension
await new Promise<void>((resolve, reject) => {
this.statsDClient?.close((error) => {
if (error !== undefined) {
reject(error);
}
resolve();
});
});
this.statsDClient = undefined;
}
} catch (error) {
// This can fail for a variety of reasons, from the API not being reachable,
// to KMS key decryption failing.
Expand Down