rename ProfilingCollector => AsyncProfilerInfo to match nim-metrics naming convention

This commit is contained in:
gmega 2023-11-06 17:16:57 -03:00
parent f16bccfcb6
commit c4adc65823
No known key found for this signature in database
GPG Key ID: FFD8DAF00660270F
2 changed files with 9 additions and 9 deletions

View File

@ -8,7 +8,7 @@ import metrics
when defined(metrics): when defined(metrics):
type type
ProfilingCollector* = ref object of Gauge ProfilerInfo* = ref object of Gauge
perfSampler: PerfSampler perfSampler: PerfSampler
k: int k: int
@ -17,14 +17,14 @@ when defined(metrics):
ProfilerMetric = (SrcLoc, OverallMetrics) ProfilerMetric = (SrcLoc, OverallMetrics)
proc newCollector*( proc newCollector*(
ProfilingCollector: typedesc, ProfilerInfo: typedesc,
name: string, name: string,
help: string, help: string,
perfSampler: PerfSampler, perfSampler: PerfSampler,
k: int = 10, k: int = 10,
registry: Registry = defaultRegistry, registry: Registry = defaultRegistry,
): ProfilingCollector = ): ProfilerInfo =
result = ProfilingCollector.newCollector( result = ProfilerInfo.newCollector(
name = name, help = help, registry = registry) name = name, help = help, registry = registry)
result.perfSampler = perfSampler result.perfSampler = perfSampler
result.k = k result.k = k
@ -33,7 +33,7 @@ when defined(metrics):
float64 = duration.nanoseconds.float64 float64 = duration.nanoseconds.float64
proc collectSlowestProcs( proc collectSlowestProcs(
self: ProfilingCollector, self: ProfilerInfo,
profilerMetrics: seq[ProfilerMetric], profilerMetrics: seq[ProfilerMetric],
prometheusMetrics: var Metrics, prometheusMetrics: var Metrics,
timestampMillis: int64, timestampMillis: int64,
@ -82,7 +82,7 @@ when defined(metrics):
"max_single_exec_time", metrics.maxSingleTime, prometheusMetrics) "max_single_exec_time", metrics.maxSingleTime, prometheusMetrics)
proc collectOutlierMetrics( proc collectOutlierMetrics(
self: ProfilingCollector, self: ProfilerInfo,
profilerMetrics: seq[ProfilerMetric], profilerMetrics: seq[ProfilerMetric],
prometheusMetrics: var Metrics, prometheusMetrics: var Metrics,
timestampMillis: int64, timestampMillis: int64,
@ -112,7 +112,7 @@ when defined(metrics):
timestamp: timestampMillis, timestamp: timestampMillis,
)) ))
method collect*(self: ProfilingCollector): Metrics = method collect*(self: ProfilerInfo): Metrics =
let now = times.getTime().toMilliseconds() let now = times.getTime().toMilliseconds()
var prometheusMetrics = Metrics() var prometheusMetrics = Metrics()

View File

@ -52,7 +52,7 @@ checksuite "asyncprofiler metrics collector":
test "should keep track of basic worst-case exec time stats": test "should keep track of basic worst-case exec time stats":
var registry = newRegistry() var registry = newRegistry()
var collector = ProfilingCollector.newCollector( var collector = ProfilerInfo.newCollector(
name = "profiling_metrics", name = "profiling_metrics",
help = "Metrics from the profiler", help = "Metrics from the profiler",
registry = registry, registry = registry,
@ -64,7 +64,7 @@ checksuite "asyncprofiler metrics collector":
test "should create labeled series for the k slowest procs in terms of totalExecTime": test "should create labeled series for the k slowest procs in terms of totalExecTime":
var registry = newRegistry() var registry = newRegistry()
var collector = ProfilingCollector.newCollector( var collector = ProfilerInfo.newCollector(
name = "profiling_metrics", name = "profiling_metrics",
help = "Metrics from the profiler", help = "Metrics from the profiler",
registry = registry, registry = registry,