Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 5 additions & 1 deletion server/model/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,11 @@ class Monitor extends BeanModel {
let previousBeat = null;
let retries = 0;

this.prometheus = new Prometheus(this, await this.getTags());
try {
this.prometheus = new Prometheus(this, await this.getTags());
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

It is safe to not initialized.

I have checked all calls, they have syntax like this: this.prometheus?.update(null, tlsInfo);

Image

} catch (e) {
log.error("prometheus", "Please submit an issue to our GitHub repo. Prometheus update error: ", e.message);
Comment thread
louislam marked this conversation as resolved.
Comment thread
louislam marked this conversation as resolved.
}

const beat = async () => {

Expand Down
7 changes: 6 additions & 1 deletion server/routers/api-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ router.all("/api/push/:pushToken", async (request, response) => {
io.to(monitor.user_id).emit("heartbeat", bean.toJSON());

Monitor.sendStats(io, monitor.id, monitor.user_id);
new Prometheus(monitor).update(bean, undefined);

try {
new Prometheus(monitor).update(bean, []);
Comment thread
louislam marked this conversation as resolved.
Outdated
} catch (e) {
log.error("prometheus", "Please submit an issue to our GitHub repo. Prometheus update error: ", e.message);
Comment thread
louislam marked this conversation as resolved.
}

response.json({
ok: true,
Expand Down
Loading