mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-08 13:44:53 +08:00
[*] metrics(Part 4): Make /ingest-metrics use MetricsReporter
Summary: This ensures that the Libhoney instance is a singleton in cloud processes. Test Plan: manual Reviewers: mark, spang Reviewed By: spang Differential Revision: https://phab.nylas.com/D3969
This commit is contained in:
parent
dc2f032325
commit
8afb14c4c6
1 changed files with 10 additions and 3 deletions
|
@ -28,6 +28,13 @@ class MetricsReporter {
|
|||
});
|
||||
}
|
||||
|
||||
sendToHoneycomb(info) {
|
||||
if (!this._honey) {
|
||||
throw new Error('Metrics Reporter: Honeycomb is not available in this environment')
|
||||
}
|
||||
this._honey.sendNow(info);
|
||||
}
|
||||
|
||||
async reportEvent(info) {
|
||||
if (!info.accountId) {
|
||||
throw new Error("Metrics Reporter: You must include an accountId");
|
||||
|
@ -58,11 +65,11 @@ class MetricsReporter {
|
|||
});
|
||||
await req.run()
|
||||
} else {
|
||||
this._honey.sendNow(info);
|
||||
this.sendToHoneycomb(info)
|
||||
}
|
||||
} catch (err) {
|
||||
logger.log(info, "Metrics Collector: Submitted.", info);
|
||||
logger.warn("Metrics Collector: Submission Failed.", {error: err, ...info});
|
||||
logger.log(info, "Metrics Reporter: Submitted.", info);
|
||||
logger.warn("Metrics Reporter: Submission Failed.", {error: err, ...info});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue