1- import { Client } from "../client" ;
21import { CpuUsageMetrics } from "./default/cpu-usage" ;
32import { EventLoopMetrics } from "./default/event-loop" ;
43import { HeapMetrics } from "./default/heap" ;
54import { MemoryUsageMetrics } from "./default/memory-usage" ;
6- import { transport , CAPTURE_ENDPOINT , utils , MetricType , InstrumentType , ValueType } from "@traceo-sdk/node-core" ;
5+ import { transport , CAPTURE_ENDPOINT , utils , MetricType , InstrumentType , ValueType , INodeClient } from "@traceo-sdk/node-core" ;
76import * as os from "os" ;
87
98/**
109 * Runner for metrics collecting
1110 */
1211
13- const DEFAULT_INTERVAL = 30 ; //seconds
12+ const DEFAULT_INTERVAL = 15000 ; //ms -> 15s
1413
1514export class MetricsRunner {
16- private client : Client ;
15+ private client : INodeClient ;
1716
1817 private readonly interval : number ;
1918
@@ -28,13 +27,13 @@ export class MetricsRunner {
2827 public clientMeauserementMetrics : Record < string , number [ ] > ;
2928
3029 constructor ( ) {
31- this . client = global [ "__TRACEO__" ] ;
30+ this . client = utils . getGlobalTraceo ( ) ;
3231
3332 if ( ! this . client . options . collectMetrics ) {
3433 return ;
3534 }
3635
37- this . interval = this . client . options . scrapMetricsInterval || DEFAULT_INTERVAL ;
36+ this . interval = this . client . options . exportIntervalMillis || DEFAULT_INTERVAL ;
3837
3938 this . cpuUsage = new CpuUsageMetrics ( ) ;
4039 this . eventLoop = new EventLoopMetrics ( ) ;
0 commit comments