Skip to content

Commit 9f5b7c4

Browse files
authored
Do not expose internals (#5313)
The timeout and the flush can be handled without any variables. This way nothing is added to the instance.
1 parent 7aae4fc commit 9f5b7c4

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/dd-trace/src/dogstatsd.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,12 @@ class CustomMetrics {
191191
const clientConfig = DogStatsDClient.generateClientConfig(config)
192192
this.dogstatsd = new DogStatsDClient(clientConfig)
193193

194-
this._boundFlush = this.flush.bind(this)
194+
const flush = this.flush.bind(this)
195195

196196
// TODO(bengl) this magic number should be configurable
197-
this._flushInterval = setInterval(this._boundFlush, 10 * 1000)
198-
this._flushInterval.unref()
197+
setInterval(flush, 10 * 1000).unref()
199198

200-
process.once('beforeExit', this._boundFlush)
199+
process.once('beforeExit', flush)
201200
}
202201

203202
increment (stat, value = 1, tags) {

0 commit comments

Comments
 (0)