Skip to content

Commit e238b08

Browse files
committed
Use 1e6/9 instead of time for conversion
Signed-off-by: Felix Ehrenpfort <[email protected]>
1 parent 94a027c commit e238b08

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

metrics/prometheus.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ func asFloat64(v uint64) float64 { return float64(v) }
3535

3636
// asMicrosecondsToSeconds converts nanoseconds into a float64 representing seconds.
3737
func asMicrosecondsToSeconds(v uint64) float64 {
38-
return float64(v) / float64(time.Millisecond)
38+
return float64(v) / 1e6
3939
}
4040

4141
// asNanosecondsToSeconds converts nanoseconds into a float64 representing seconds.
4242
func asNanosecondsToSeconds(v uint64) float64 {
43-
return float64(v) / float64(time.Second)
43+
return float64(v) / 1e9
4444
}
4545

4646
// fsValues is a helper method for assembling per-filesystem stats.

metrics/testdata/prometheus_metrics

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,6 @@ container_perf_uncore_events_total{container_env_foo_env="prod",container_label_
381381
# TYPE container_perf_uncore_events_scaling_ratio gauge
382382
container_perf_uncore_events_scaling_ratio{container_env_foo_env="prod",container_label_foo_label="bar",event="cas_count_read",id="testcontainer",image="test",name="testcontaineralias",pmu="uncore_imc_0",socket="0",zone_name="hello"} 1 1395066363000
383383
container_perf_uncore_events_scaling_ratio{container_env_foo_env="prod",container_label_foo_label="bar",event="cas_count_read",id="testcontainer",image="test",name="testcontaineralias",pmu="uncore_imc_0",socket="1",zone_name="hello"} 1 1395066363000
384-
# HELP container_pressure_cpu_stalled_seconds_total Total time duration no tasks in the container could make progress due to CPU congestion.
385-
# TYPE container_pressure_cpu_stalled_seconds_total counter
386-
container_pressure_cpu_stalled_seconds_total{container_env_foo_env="prod",container_label_foo_label="bar",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 0.0001 1395066363000
387384
# HELP container_pressure_cpu_waiting_seconds_total Total time duration tasks in the container have waited due to CPU congestion.
388385
# TYPE container_pressure_cpu_waiting_seconds_total counter
389386
container_pressure_cpu_waiting_seconds_total{container_env_foo_env="prod",container_label_foo_label="bar",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 0.0002 1395066363000

metrics/testdata/prometheus_metrics_whitelist_filtered

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,6 @@ container_perf_uncore_events_total{container_env_foo_env="prod",event="cas_count
381381
# TYPE container_perf_uncore_events_scaling_ratio gauge
382382
container_perf_uncore_events_scaling_ratio{container_env_foo_env="prod",event="cas_count_read",id="testcontainer",image="test",name="testcontaineralias",pmu="uncore_imc_0",socket="0",zone_name="hello"} 1 1395066363000
383383
container_perf_uncore_events_scaling_ratio{container_env_foo_env="prod",event="cas_count_read",id="testcontainer",image="test",name="testcontaineralias",pmu="uncore_imc_0",socket="1",zone_name="hello"} 1 1395066363000
384-
# HELP container_pressure_cpu_stalled_seconds_total Total time duration no tasks in the container could make progress due to CPU congestion.
385-
# TYPE container_pressure_cpu_stalled_seconds_total counter
386-
container_pressure_cpu_stalled_seconds_total{container_env_foo_env="prod",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 0.0001 1395066363000
387384
# HELP container_pressure_cpu_waiting_seconds_total Total time duration tasks in the container have waited due to CPU congestion.
388385
# TYPE container_pressure_cpu_waiting_seconds_total counter
389386
container_pressure_cpu_waiting_seconds_total{container_env_foo_env="prod",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 0.0002 1395066363000

0 commit comments

Comments
 (0)