Skip to content

Commit

Permalink
Refactor Metric type to setter
Browse files Browse the repository at this point in the history
  • Loading branch information
doochik committed May 17, 2020
1 parent d29df0b commit f7f0a77
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
5 changes: 2 additions & 3 deletions lib/counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ const { validateLabel } = require('./validation');
const { Metric } = require('./metric');

class Counter extends Metric {
constructor(...args) {
super(...args);
this.type = 'counter';
get type() {
return 'counter';
}

/**
Expand Down
5 changes: 2 additions & 3 deletions lib/gauge.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ const { validateLabel } = require('./validation');
const { Metric } = require('./metric');

class Gauge extends Metric {
constructor(...args) {
super(...args);
this.type = 'gauge';
get type() {
return 'gauge';
}

/**
Expand Down
4 changes: 3 additions & 1 deletion lib/histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ class Histogram extends Metric {
),
};
}
}

this.type = 'histogram';
get type() {
return 'histogram';
}

/**
Expand Down
4 changes: 3 additions & 1 deletion lib/summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ class Summary extends Metric {
},
};
}
}

this.type = 'summary';
get type() {
return 'summary';
}

/**
Expand Down

0 comments on commit f7f0a77

Please sign in to comment.