mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-10-09 21:01:58 -04:00
ops: Add prometheus metrics
Adds a /metrics endpoint in serve mode. Can be disabled via --disable-metrics. In fetch, dumps the metrics if --metrics is specified (defaults to false). None of the metrics being collected are on a hot path, so they're just always collected using atomic operations (i.e. no `if (!enabled) return;`). Because the operations are cheap and infrequent enough not to matter. The one place I want to add more metrics is in HttpClient (bytes, status, counts, ...) but after the pending HttpClient-related PR is merged. ./lightpanda fetch --log-level fatal --metrics "https://lightpanda.io/" ``` build_info{version="1.0.0-dev.7837+70493ce35"} 1 cdp_connections_total 0 cdp_connection_limit_total 0 cdp_active_connections 0 cdp_commands_total 0 cdp_unknown_commands_total 0 js_heap_limits_total 0 script_errors_total 0 arena_hit_total{size="tiny"} 908 arena_hit_total{size="small"} 35 arena_hit_total{size="medium"} 0 arena_hit_total{size="large"} 27 arena_miss_total{size="tiny"} 193 arena_miss_total{size="small"} 31 arena_miss_total{size="medium"} 5 arena_miss_total{size="large"} 23 navigate_total{type="page"} 1 navigate_total{type="iframe"} 0 navigate_total{type="popup"} 0 js_heap_size_bytes_bucket{le="4194304"} 0 js_heap_size_bytes_bucket{le="8388608"} 0 js_heap_size_bytes_bucket{le="16777216"} 1 js_heap_size_bytes_bucket{le="33554432"} 1 js_heap_size_bytes_bucket{le="67108864"} 1 js_heap_size_bytes_bucket{le="134217728"} 1 js_heap_size_bytes_bucket{le="268435456"} 1 js_heap_size_bytes_bucket{le="536870912"} 1 js_heap_size_bytes_bucket{le="+Inf"} 1 js_heap_size_bytes_sum 11223040 js_heap_size_bytes_count 1 ```
This commit is contained in:
14 files changed
+377
-24
No files matched your search
@@ -109,11 +109,11 @@ pub const Event = union(enum) {
|
||||
buffer_overflow: BufferOverflow,
|
||||
llm: LLM,
|
||||
|
||||
const Navigate = struct {
|
||||
pub const Navigate = struct {
|
||||
tls: bool,
|
||||
context: Context,
|
||||
|
||||
const Context = enum { page, iframe, popup };
|
||||
pub const Context = enum { page, iframe, popup };
|
||||
};
|
||||
|
||||
const BufferOverflow = struct {
|
||||
|
||||
Reference in new issue
Block a user