Skip to content

Commit a751b75

Browse files
committed
make options objects private and fix label config
1 parent 87b84b9 commit a751b75

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

lib/counter.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ const Counter = class Counter extends EventEmitter {
1313
`argument 'options' must be provided`,
1414
);
1515

16-
this.options = {
17-
labels: {},
18-
...options,
19-
};
16+
Object.defineProperty(this, 'options', {
17+
value: {
18+
labels: {},
19+
...options,
20+
},
21+
});
2022
}
2123

2224
inc(value, options) {

lib/gauge.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ const Gauge = class Gauge extends EventEmitter {
1313
`argument 'options' must be provided`,
1414
);
1515

16-
this.options = {
17-
labels: [],
18-
...options,
19-
};
16+
Object.defineProperty(this, 'options', {
17+
value: {
18+
labels: {},
19+
...options,
20+
},
21+
});
2022
}
2123

2224
set(value, options = {}) {

lib/histogram.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ const Histogram = class Histogram extends EventEmitter {
1616

1717
// TODO: validate optional buckets option
1818

19-
this.options = {
20-
labels: [],
21-
...options,
22-
};
19+
Object.defineProperty(this, 'options', {
20+
value: {
21+
labels: {},
22+
...options,
23+
},
24+
});
2325
}
2426

2527
observe(value, options = {}) {

lib/summary.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ const Summary = class Summary extends EventEmitter {
1616

1717
// TODO: validate optional quantiles option
1818

19-
this.options = {
20-
labels: [],
21-
...options,
22-
};
19+
Object.defineProperty(this, 'options', {
20+
value: {
21+
labels: {},
22+
...options,
23+
},
24+
});
2325
}
2426

2527
observe(value, options = {}) {

0 commit comments

Comments
 (0)