Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions test/module_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,45 @@ describe('datadog-metrics', function() {
logger.gauge('test.gauge', 23);
});

it('should let me configure a shared metrics logger instance', function(done) {
it('should let me configure a shared metrics logger instance', async function() {
metrics.init.should.be.a('function');
metrics.init({
flushIntervalSeconds: 0,
reporter: {
report (series, onSuccess, _onError) {
async report (series) {
series.should.have.lengthOf(12); // 3 + 9 for the histogram.
series[0].should.have.nested.property('points[0][1]', 23);
series[0].should.have.property('metric', 'test.gauge');
series[0].tags.should.have.lengthOf(0);
onSuccess && onSuccess();
done();
}
}
});
metrics.gauge('test.gauge', 23);
metrics.increment('test.counter');
metrics.increment('test.counter', 23);
metrics.histogram('test.histogram', 23);
metrics.flush();
await metrics.flush();
});

it('should report gauges with the same name but different tags separately', function(done) {
it('should report gauges with the same name but different tags separately', async function() {
metrics.init.should.be.a('function');
metrics.init({
flushIntervalSeconds: 0,
reporter: {
report (series, onSuccess, _onError) {
async report (series) {
series.should.have.lengthOf(2);
series[0].should.have.nested.property('points[0][1]', 1);
series[0].should.have.property('metric', 'test.gauge');
series[0].should.have.deep.property('tags', ['tag1']);
series[1].should.have.nested.property('points[0][1]', 2);
series[1].should.have.property('metric', 'test.gauge');
series[1].should.have.deep.property('tags', ['tag2']);
onSuccess && onSuccess();
done();
}
}
});
metrics.gauge('test.gauge', 1, ['tag1']);
metrics.gauge('test.gauge', 2, ['tag2']);
metrics.flush();
await metrics.flush();
});

it('should lazily provide a shared metrics logger instance', function() {
Expand Down
Loading