Skip to content

Commit

Permalink
set buckets as optional in histogram
Browse files Browse the repository at this point in the history
  • Loading branch information
pur committed Nov 2, 2020
1 parent 39a58ab commit b2a06d5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/common/prom.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,15 @@ export function findOrCreateMetric({
if (metric && metric instanceof client.Histogram) {
return metric;
}
return new client.Histogram({
const histogramConfig = {
name: name,
help: help || `${name} ${type}`,
labelNames,
buckets,
});
};
if (buckets) {
histogramConfig['buckets'] = buckets;
}
return new client.Histogram(histogramConfig);
case "Summary":
if (metric && metric instanceof client.Summary) {
return metric;
Expand Down

0 comments on commit b2a06d5

Please sign in to comment.