1 |
import Measurement from './measurement/index.js' |
|
2 |
|
31✔ |
3 |
const bus = global.globalBus || (() => { |
|
4 |
throw new TypeError('Missing GlobalBus() instance on: global.globalBus') |
× |
5 |
})() |
× |
6 |
|
31✔ |
7 |
const metric = name => { |
|
8 |
const record = ({ name, value }) => |
|
9 |
bus.emit(new Measurement({ name, value }))
|
6,206✔ |
10 |
|
6,248✔ |
11 |
return {
|
6,248✔ |
12 |
record: value => record({ name, value }),
|
|
13 |
stop: () => bus.stop()
|
|
14 |
} |
6,248✔ |
15 |
} |
6,248✔ |
16 |
|
31✔ |
17 |
export { metric }
|
31✔ |