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

Add support to track disk usage #859

Open
rishabhc32 opened this issue Feb 12, 2025 · 2 comments
Open

Add support to track disk usage #859

rishabhc32 opened this issue Feb 12, 2025 · 2 comments
Assignees

Comments

@rishabhc32
Copy link
Contributor

rishabhc32 commented Feb 12, 2025

Description

Currently, there is no support for tracking disk usage. It will help to set up alerts where disk size grows beyond a set threshold.

@alexmojaki
Copy link
Contributor

I think this would be a good feature request for the system metrics instrumentation in https://github.com/open-telemetry/opentelemetry-python-contrib. But this should work:

import psutil
import logfire
from opentelemetry.metrics import CallbackOptions, Observation

logfire.configure()


def disk_usage_callback(_options: CallbackOptions):
    usage = psutil.disk_usage("/")
    yield Observation(usage.percent / 100)


logfire.metric_gauge_callback("system.disk.utilization", [disk_usage_callback])

@Kludex
Copy link
Member

Kludex commented Feb 14, 2025

Shall we, at least, document?

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

No branches or pull requests

3 participants