-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add diagnostics channel support
Closes Integrate diagnostic channels #579
- Loading branch information
Showing
8 changed files
with
81 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
'use strict' | ||
|
||
exports.DOC_CHANNEL = 'dnlup.doc.sampler' | ||
exports.DOC_SAMPLES_CHANNEL = 'dnlup.doc.samples' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict' | ||
|
||
const { test } = require('tap') | ||
const diagnosticsChannel = require('diagnostics_channel') | ||
const doc = require('../') | ||
|
||
test('diagnostics channel support', t => { | ||
t.plan(2) | ||
t.teardown(() => { | ||
sampler.stop() | ||
}) | ||
const onInstance = s => { | ||
t.equal(s, sampler) | ||
diagnosticsChannel.unsubscribe(doc.constants.DOC_CHANNEL, onInstance) | ||
} | ||
const onSample = (s) => { | ||
t.equal(s, sampler) | ||
diagnosticsChannel.unsubscribe(doc.constants.DOC_SAMPLES_CHANNEL, onSample) | ||
} | ||
diagnosticsChannel.subscribe(doc.constants.DOC_CHANNEL, onInstance) | ||
diagnosticsChannel.subscribe(doc.constants.DOC_SAMPLES_CHANNEL, onSample) | ||
const sampler = doc({ unref: false }) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const DOC_CHANNEL = 'dnlup.doc.sampler' | ||
export const DOC_SAMPLES_CHANNEL = 'dnlup.doc.samples' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters