Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task time metric buckets entirely reside in +Inf #5

Closed
Lemmmy opened this issue Apr 28, 2023 · 1 comment
Closed

Task time metric buckets entirely reside in +Inf #5

Lemmmy opened this issue Apr 28, 2023 · 1 comment

Comments

@Lemmmy
Copy link
Contributor

Lemmmy commented Apr 28, 2023

The computercraft_server_tasks_s_bucket and computercraft_task_time_s_bucket metrics only ever have data in the +Inf bucket. My suspicion is that the metrics system collects data in nanoseconds, but since the buckets are defined in seconds, all the data always ends up being higher than 0.25. This results in the metrics being unusable for histogram and heatmap visualisations.

For example:

computercraft_server_tasks_s_bucket{computer_id="1439",le="5.0E-4",} 0.0
computercraft_server_tasks_s_bucket{computer_id="1439",le="0.001",} 0.0
computercraft_server_tasks_s_bucket{computer_id="1439",le="0.005",} 0.0
computercraft_server_tasks_s_bucket{computer_id="1439",le="0.01",} 0.0
computercraft_server_tasks_s_bucket{computer_id="1439",le="0.025",} 0.0
computercraft_server_tasks_s_bucket{computer_id="1439",le="0.05",} 0.0
computercraft_server_tasks_s_bucket{computer_id="1439",le="0.1",} 0.0
computercraft_server_tasks_s_bucket{computer_id="1439",le="0.25",} 0.0
computercraft_server_tasks_s_bucket{computer_id="1439",le="+Inf",} 108012.0

serverTime = buildField(Metrics.SERVER_TASKS, Histogram.build())
.unit("s")
.buckets(0.0005, 0.001, 0.005, 0.01, 0.025, 0.05, 0.10, 0.25)
.register(registry);

https://github.com/cc-tweaked/CC-Tweaked/blob/54b7366b2ddbb0ee024e0b06ff3b9d300580e554/projects/core/src/main/java/dan200/computercraft/core/metrics/Metrics.java#L14-L15

chrome_aApzYQ0qRl

This can be tested on the sc3 staff-analytics with queries such as sum by (le) (computercraft_task_time_s_bucket[1m]) and sum by (le) (rate(computercraft_server_tasks_s_bucket[1m])).

This does not affect CC's own commands as the times are always formatted back as seconds:

https://github.com/cc-tweaked/CC-Tweaked/blob/54b7366b2ddbb0ee024e0b06ff3b9d300580e554/projects/core/src/main/java/dan200/computercraft/core/metrics/Metric.java#L108-L110

@Lemmmy
Copy link
Contributor Author

Lemmmy commented May 5, 2023

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant