|
2 | 2 |
|
3 | 3 | hyperlight-wasm provides the following observability features:
|
4 | 4 |
|
5 |
| -* [Metrics](#metrics) metrics are provided using Prometheus. |
| 5 | +* [Metrics](#metrics) metrics are provided using `metrics` crate. |
6 | 6 |
|
7 | 7 | ## Metrics
|
8 | 8 |
|
9 |
| -Hyperlight-wasm provides metrics using Prometheus. The metrics are registered using either the [default_registry](https://docs.rs/prometheus/latest/prometheus/fn.default_registry.html) or a registry instance provided by the host application. |
10 | 9 |
|
11 |
| -To provide a registry to hyperlight_wasm, use the `set_metrics_registry` function and pass a reference to a registry with `static` lifetime: |
| 10 | +The following metrics are provided and are enabled by default: |
12 | 11 |
|
13 |
| -```rust |
14 |
| -use hyperlight_wasm::set_metrics_registry; |
15 |
| -use prometheus::Registry; |
16 |
| -use lazy_static::lazy_static; |
| 12 | +* `active_proto_wasm_sandboxes` - A gauge indicating the number of currently active proto wasm sandboxes |
| 13 | +* `active_wasm_sandboxes` - A gauge indicating the number of currently active wasm sandboxes |
| 14 | +* `active_loaded_wasm_sandboxes` - A gauge indicating the number of currently loaded wasm sandboxes |
| 15 | +* `proto_wasm_sandboxes_total` - A counter indicating the total number of proto wasm sandboxes created during the lifetime of the process |
| 16 | +* `wasm_sandboxes_total` - A counter indicating the total number of wasm sandboxes created during the lifetime of the process |
| 17 | +* `loaded_wasm_sandboxes_total` - A counter indicating the total number of loaded wasm sandboxes created during the lifetime of the process |
| 18 | +* `sandbox_loads_total` - A counter indicating how many times a wasm sandbox has been loaded into a loaded wasm sandbox during the lifetime of the process |
| 19 | +* `sandbox_unloads_total` - A counter indicating how many times a loaded wasm sandbox has been unloaded into a wasm sandbox during the lifetime of the process |
17 | 20 |
|
18 |
| -lazy_static! { |
19 |
| - static ref REGISTRY: Registry = Registry::new(); |
20 |
| -} |
21 | 21 |
|
22 |
| -set_metrics_registry(®ISTRY); |
23 |
| -``` |
| 22 | +In addition, regular Hyperlight provides the following metrics: |
24 | 23 |
|
25 |
| -The following metrics are provided and are enabled by default: |
| 24 | +* `guest_errors_total` - A counter indicating how many times a guest error has occured |
| 25 | +* `guest_cancellations_total` - The number of times guest execution has timed out |
| 26 | + |
| 27 | +If cargo feature `function_call_metrics` is enabled: |
26 | 28 |
|
27 |
| -* `hyperlight_guest_error_count` - a vector of counters that tracks the number of guest errors by code and message. |
28 |
| -* `hyperlight_number_of_cancelled_guest_execution` - a counter that tracks the number of guest executions that have been cancelled because the execution time exceeded the time allowed. |
29 |
| -* `current_number_of_wasm_sandboxes` - a gauge that tracks the current number of wasm sandboxes in this process. |
30 |
| -* `current_number_of_loaded_wasm_sandboxes` - a gauge that tracks the current number of loaded wasm sandboxes in this process. |
31 |
| -* `number_of_unloads_of_loaded_wasm_sandboxes` - a counter that tracks the number of times that unload_module has been called on a LoadedWasmSandbox. |
32 |
| -* `number_of_loads_of_wasm_sandboxes` - a counter that tracks the number of times that load_module has been called on a WasmSandbox. |
33 |
| -* `current_number_of_proto_wasm_sandboxes` - a gauge that tracks the current number of proto wasm sandboxes in this process. |
34 |
| -* `total_number_of_wasm_sandboxes` - a counter that tracks the total number of wasm sandboxes that have been created by this process. |
35 |
| -* `total_number_of_loaded_wasm_sandboxes` - a counter that tracks the total number of loaded wasm sandboxes that have been created by this process. |
36 |
| -* `total_number_of_proto_wasm_sandboxes` - a counter that tracks the total number of proto wasm sandboxes that have been created by this process. |
37 |
| - |
38 |
| -The following metrics are provided and are enabled by default using the feature `function_call_metrics` but can be disabled: |
39 |
| - |
40 |
| -* `hyperlight_guest_function_call_duration_microseconds` - a vector of histograms that tracks the execution time of guest functions in microseconds by function name. The histogram also tracks the number of calls to each function. |
41 |
| -* `hyperlight_host_function_calls_duration_microseconds` - a vector of histograms that tracks the execution time of host functions in microseconds by function name. The histogram also tracks the number of calls to each function. |
| 29 | +* `guest_call_duration_seconds` - Histogram for the execution time of guest function calls |
| 30 | +* `host_call_duration_seconds` - Histogram for the execution time of host function calls |
42 | 31 |
|
43 | 32 | There is an example of how to gather metrics in the [examples/metrics](../src/hyperlight_wasm/examples/metrics) directory.
|
0 commit comments