pkg/vendor/github.com/prometheus/procfs
Dave Protasowski 5e2512c712
New observability package (#3188)
* include observability package

* go mod changes

* commit vendor

* PR feedback
2025-06-26 04:05:05 +00:00
..
internal New observability package (#3188) 2025-06-26 04:05:05 +00:00
.gitignore bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
.golangci.yml New observability package (#3188) 2025-06-26 04:05:05 +00:00
CODE_OF_CONDUCT.md bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
CONTRIBUTING.md bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
LICENSE
MAINTAINERS.md Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
Makefile bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
Makefile.common New observability package (#3188) 2025-06-26 04:05:05 +00:00
NOTICE
README.md New observability package (#3188) 2025-06-26 04:05:05 +00:00
SECURITY.md bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
arp.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
buddyinfo.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
cmdline.go Bump to k8s v0.24.4 client packages (#2586) 2022-09-09 15:07:30 +00:00
cpuinfo.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
cpuinfo_armx.go bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
cpuinfo_loong64.go Bump github.com/tsenart/vegeta/v12 from 12.8.4 to 12.11.0 (#2772) 2023-08-02 00:16:47 +00:00
cpuinfo_mipsx.go bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
cpuinfo_others.go Bump github.com/tsenart/vegeta/v12 from 12.8.4 to 12.11.0 (#2772) 2023-08-02 00:16:47 +00:00
cpuinfo_ppcx.go bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
cpuinfo_riscvx.go bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
cpuinfo_s390x.go bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
cpuinfo_x86.go bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
crypto.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
doc.go Bump github.com/tsenart/vegeta/v12 from 12.8.4 to 12.11.0 (#2772) 2023-08-02 00:16:47 +00:00
fs.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
fs_statfs_notype.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
fs_statfs_type.go Bump github.com/prometheus/client_golang from 1.17.0 to 1.18.0 (#2924) 2024-01-03 07:11:02 +00:00
fscache.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
ipvs.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
kernel_random.go bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
loadavg.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
mdstat.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
meminfo.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
mountinfo.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
mountstats.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
net_conntrackstat.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
net_dev.go bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
net_dev_snmp6.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
net_ip_socket.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
net_protocols.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
net_route.go Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (#2846) 2023-10-02 06:41:26 +00:00
net_sockstat.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
net_softnet.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
net_tcp.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
net_tls_stat.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
net_udp.go
net_unix.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
net_wireless.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
net_xfrm.go Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (#2846) 2023-10-02 06:41:26 +00:00
netstat.go Bump github.com/tsenart/vegeta/v12 from 12.8.4 to 12.11.0 (#2772) 2023-08-02 00:16:47 +00:00
proc.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
proc_cgroup.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
proc_cgroups.go Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (#2846) 2023-10-02 06:41:26 +00:00
proc_environ.go bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
proc_fdinfo.go Bump github.com/prometheus/client_golang from 1.17.0 to 1.18.0 (#2924) 2024-01-03 07:11:02 +00:00
proc_interrupts.go Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (#2846) 2023-10-02 06:41:26 +00:00
proc_io.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
proc_limits.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
proc_maps.go Bump github.com/prometheus/client_golang from 1.17.0 to 1.18.0 (#2924) 2024-01-03 07:11:02 +00:00
proc_netstat.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
proc_ns.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
proc_psi.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
proc_smaps.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
proc_snmp.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
proc_snmp6.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
proc_stat.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
proc_status.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
proc_sys.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
schedstat.go bump k8s dependencies and update min version to v1.25 (#2745) 2023-05-23 14:06:11 +00:00
slab.go Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (#2846) 2023-10-02 06:41:26 +00:00
softirqs.go New observability package (#3188) 2025-06-26 04:05:05 +00:00
stat.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
swaps.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
thread.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00
ttar
vm.go Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (#2846) 2023-10-02 06:41:26 +00:00
zoneinfo.go Bump github.com/tsenart/vegeta/v12 from 12.11.1 to 12.11.3 (#3077) 2024-07-30 08:19:39 +00:00

README.md

procfs

This package provides functions to retrieve system, kernel, and process metrics from the pseudo-filesystems /proc and /sys.

WARNING: This package is a work in progress. Its API may still break in backwards-incompatible ways without warnings. Use it at your own risk.

Go Reference CircleCI Go Report Card

Usage

The procfs library is organized by packages based on whether the gathered data is coming from /proc, /sys, or both. Each package contains an FS type which represents the path to either /proc, /sys, or both. For example, cpu statistics are gathered from /proc/stat and are available via the root procfs package. First, the proc filesystem mount point is initialized, and then the stat information is read.

fs, err := procfs.NewFS("/proc")
stats, err := fs.Stat()

Some sub-packages such as blockdevice, require access to both the proc and sys filesystems.

    fs, err := blockdevice.NewFS("/proc", "/sys")
    stats, err := fs.ProcDiskstats()

Package Organization

The packages in this project are organized according to (1) whether the data comes from the /proc or /sys filesystem and (2) the type of information being retrieved. For example, most process information can be gathered from the functions in the root procfs package. Information about block devices such as disk drives is available in the blockdevices sub-package.

Building and Testing

The procfs library is intended to be built as part of another application, so there are no distributable binaries.
However, most of the API includes unit tests which can be run with make test.

Updating Test Fixtures

The procfs library includes a set of test fixtures which include many example files from the /proc and /sys filesystems. These fixtures are included as a ttar file which is extracted automatically during testing. To add/update the test fixtures, first ensure the testdata/fixtures directory is up to date by removing the existing directory and then extracting the ttar file using make testdata/fixtures/.unpacked or just make test.

rm -rf testdata/fixtures
make test

Next, make the required changes to the extracted files in the testdata/fixtures directory. When the changes are complete, run make update_fixtures to create a new fixtures.ttar file based on the updated fixtures directory. And finally, verify the changes using git diff testdata/fixtures.ttar.