Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class Counter extends Metric {
async get() {
if (this.collect) {
const v = this.collect();
if (v instanceof Promise) await v;
if ((v instanceof Promise) || (v.then instanceof Function)) await v;
}

return {
Expand Down
2 changes: 1 addition & 1 deletion lib/gauge.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class Gauge extends Metric {
async get() {
if (this.collect) {
const v = this.collect();
if (v instanceof Promise) await v;
if ((v instanceof Promise) || (v.then instanceof Function)) await v;
}
return {
help: this.help,
Expand Down
2 changes: 1 addition & 1 deletion lib/histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class Histogram extends Metric {
async getForPromString() {
if (this.collect) {
const v = this.collect();
if (v instanceof Promise) await v;
if ((v instanceof Promise) || (v.then instanceof Function)) await v;
}
const data = Object.values(this.hashMap);
const values = data
Expand Down
2 changes: 1 addition & 1 deletion lib/summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Summary extends Metric {
async get() {
if (this.collect) {
const v = this.collect();
if (v instanceof Promise) await v;
if ((v instanceof Promise) || (v.then instanceof Function)) await v;
}
const hashKeys = Object.keys(this.hashMap);
const values = [];
Expand Down