Skip to content

Commit

Permalink
Merge pull request digikare#46 from purwk/feat/unbucket
Browse files Browse the repository at this point in the history
set buckets as optional in histogram
  • Loading branch information
spike008t authored Nov 2, 2020
2 parents 39a58ab + b2a06d5 commit 3cd3d21
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 3cd3d21

Please sign in to comment.