@runnel/metric-plugin
v0.3.1
Published
A metric plugin for Runnel. It can be used in testing.
Downloads
8
Maintainers
Readme
@runnel/metric-plugin
DEPRECATED
This library only supports runneljs version 0.3.
Description
This library is designed for Runnel. Please visit our documentation and learn more.
Usage
const { register, unregister, subscribe } = createPlugin(deepEqual);
const eventBus = createEventBus({
deepEqual,
payloadValidator,
});
register();
...
// Example with React.useState
const [metrics, setMetrics] = useState();
subscribe(setMetrics);
Output Examples
Case 1
topic1
with schema{ "type": "number" }
.- No subscribers.
- One publishing event with payload
100
.
{
"topic1": {
"onPublishCreated": 1,
"onPublish": 100,
"onSubscribeCreated": 0,
"onSubscribe": null
}
}
Case 2
topic2
with schema{ "type": "string" }
.- One subscriber.
- No publishing events.
{
"topic2": {
"onPublishCreated": 0,
"onPublish": null,
"onSubscribeCreated": 1,
"onSubscribe": null
}
}