()
| 6 | // Create more metrics |
| 7 | |
| 8 | async function run() { |
| 9 | const labelNames = Array(10).map((_, idx) => `label_${idx}`); |
| 10 | |
| 11 | const getRandomLabels = () => |
| 12 | labelNames.reduce((acc, label) => { |
| 13 | return { ...acc, [label]: `value_${Math.random()}` }; |
| 14 | }, {}); |
| 15 | |
| 16 | for (let i = 0; i < 100000; i++) { |
| 17 | const h = new Histogram({ |
| 18 | name: `test_histogram_${i}`, |
| 19 | help: `Example of a histogram ${i}`, |
| 20 | buckets: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1], |
| 21 | labelNames, |
| 22 | }); |
| 23 | h.observe(getRandomLabels(), Math.random()); |
| 24 | } |
| 25 | |
| 26 | await register.metrics(); |
| 27 | |
| 28 | global.gc(); |
| 29 | |
| 30 | v8.writeHeapSnapshot(); |
| 31 | } |
| 32 | |
| 33 | run(); |
no test coverage detected