Skip to content

Commit 54c19b7

Browse files
Kludexalexmojaki
andauthored
Add System Metrics page (#43)
Co-authored-by: Alex Hall <alex.mojaki@gmail.com>
1 parent c7b2115 commit 54c19b7

File tree

3 files changed

+39
-30
lines changed

3 files changed

+39
-30
lines changed

docs/guides/onboarding_checklist/add_metrics.md

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -221,43 +221,22 @@ logfire.metric_up_down_counter_callback(
221221

222222
You can read more about the Up-Down Counter metric in the [OpenTelemetry documentation][up-down-counter-callback-metric].
223223

224-
225224
## System Metrics
226225

227226
By default, **Logfire** does not collect system metrics.
228227

229-
To enable metrics, you need to install the `logfire[system-metrics]` extra:
228+
To enable metrics, you need just need install the `logfire[system-metrics]` extra:
230229

231-
```bash
232-
pip install 'logfire[system-metrics]'
233-
```
230+
{{ install_logfire(extras=['system-metrics']) }}
231+
232+
**Logfire** will automatically collect system metrics if the `logfire[system-metrics]` extra is installed.
234233

235-
### Available Metrics
236-
237-
Logfire collects the following system metrics:
238-
239-
* `system.cpu.time`: CPU time spent in different modes.
240-
* `system.cpu.utilization`: CPU utilization in different modes.
241-
* `system.memory.usage`: Memory usage.
242-
* `system.memory.utilization`: Memory utilization in different modes.
243-
* `system.swap.usage`: Swap usage.
244-
* `system.swap.utilization`: Swap utilization
245-
* `system.disk.io`: Disk I/O operations (read/write).
246-
* `system.disk.operations`: Disk operations (read/write).
247-
* `system.disk.time`: Disk time (read/write).
248-
* `system.network.dropped.packets`: Dropped packets (transmit/receive).
249-
* `system.network.packets`: Packets (transmit/receive).
250-
* `system.network.errors`: Network errors (transmit/receive).
251-
* `system.network.io`: Network I/O (transmit/receive).
252-
* `system.network.connections`: Network connections (family/type).
253-
* `system.thread_count`: Thread count.
254-
* `process.runtime.memory`: Process memory usage.
255-
* `process.runtime.cpu.time`: Process CPU time.
256-
* `process.runtime.gc_count`: Process garbage collection count.
234+
To know more about which system metrics are collected, check the [System Metrics][system-metrics] documentation.
257235

258236
[counter-metric]: https://opentelemetry.io/docs/specs/otel/metrics/api/#counter
259237
[histogram-metric]: https://opentelemetry.io/docs/specs/otel/metrics/api/#histogram
260238
[up-down-counter-metric]: https://opentelemetry.io/docs/specs/otel/metrics/api/#updowncounter
261239
[counter-callback-metric]: https://opentelemetry.io/docs/specs/otel/metrics/api/#asynchronous-counter
262240
[gauge-callback-metric]: https://opentelemetry.io/docs/specs/otel/metrics/api/#asynchronous-gauge
263241
[up-down-counter-callback-metric]: https://opentelemetry.io/docs/specs/otel/metrics/api/#asynchronous-updowncounter
242+
[system-metrics]: ../../integrations/system_metrics.md
Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,28 @@
1-
!!! warning "🚧 Work in Progress 🚧"
2-
This page is yet to be written, [contact us](../help.md) if you have any questions.
1+
By default, **Logfire** does not collect system metrics.
2+
3+
To enable metrics, you need to install the `logfire[system-metrics]` extra:
4+
5+
{{ install_logfire(extras=['system-metrics']) }}
6+
7+
### Available Metrics
8+
9+
Logfire collects the following system metrics:
10+
11+
* `system.cpu.time`: CPU time spent in different modes.
12+
* `system.cpu.utilization`: CPU utilization in different modes.
13+
* `system.memory.usage`: Memory usage.
14+
* `system.memory.utilization`: Memory utilization in different modes.
15+
* `system.swap.usage`: Swap usage.
16+
* `system.swap.utilization`: Swap utilization
17+
* `system.disk.io`: Disk I/O operations (read/write).
18+
* `system.disk.operations`: Disk operations (read/write).
19+
* `system.disk.time`: Disk time (read/write).
20+
* `system.network.dropped.packets`: Dropped packets (transmit/receive).
21+
* `system.network.packets`: Packets (transmit/receive).
22+
* `system.network.errors`: Network errors (transmit/receive).
23+
* `system.network.io`: Network I/O (transmit/receive).
24+
* `system.network.connections`: Network connections (family/type).
25+
* `system.thread_count`: Thread count.
26+
* `process.runtime.memory`: Process memory usage.
27+
* `process.runtime.cpu.time`: Process CPU time.
28+
* `process.runtime.gc_count`: Process garbage collection count.

docs/plugins/main.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ def build_environment_variables_table(markdown: str, page: Page) -> str:
9393

9494
def install_logfire(markdown: str, page: Page) -> str:
9595
"""Build the installation instructions for each integration."""
96-
if not (page.file.src_uri.startswith('integrations/') or page.file.src_uri.endswith('first_steps/index.md')):
96+
if not (
97+
page.file.src_uri.startswith('integrations/')
98+
or page.file.src_uri.endswith('first_steps/index.md')
99+
or page.file.src_uri.endswith('onboarding_checklist/add_metrics.md')
100+
):
97101
return markdown
98102

99103
# Match instructions like "{{ install_logfire(extras=['fastapi']) }}". Get the extras, if any.

0 commit comments

Comments
 (0)