open-vault/vendor/github.com/prometheus/procfs
Hridoy Roy bd2dc7734c
Backport leader status telemetry [VAULT-672] (#10147)
* backport VAULT-672

* backport VAULT-672

* go mod tidy

* go mod tidy

* add back indirect import

* replace go mod and go sum with master version

* go mod vendor

* more go mod vendor

Co-authored-by: Hridoy Roy <hridoyroy@Hridoys-MBP.hitronhub.home>
Co-authored-by: Hridoy Roy <hridoyroy@Hridoys-MacBook-Pro.local>
2020-10-15 14:15:58 -07:00
..
internal Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
.gitignore Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
.golangci.yml Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
CONTRIBUTING.md Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
LICENSE Bump Deps (#4868) 2018-07-06 12:09:34 -04:00
MAINTAINERS.md Bump etcd client API dep (#8037) 2020-01-29 15:16:38 +01:00
Makefile Bump etcd client API dep (#8037) 2020-01-29 15:16:38 +01:00
Makefile.common Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
NOTICE Bump Deps (#4868) 2018-07-06 12:09:34 -04:00
README.md Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
arp.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
buddyinfo.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
cpuinfo.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
cpuinfo_arm.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
cpuinfo_arm64.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
cpuinfo_default.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
cpuinfo_mips.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
cpuinfo_mips64.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
cpuinfo_mips64le.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
cpuinfo_mipsle.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
cpuinfo_ppc64.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
cpuinfo_ppc64le.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
cpuinfo_s390x.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
crypto.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
doc.go Bump Deps (#4868) 2018-07-06 12:09:34 -04:00
fixtures.ttar Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
fs.go Bump etcd client API dep (#8037) 2020-01-29 15:16:38 +01:00
fscache.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
go.mod Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
go.sum Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
ipvs.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
kernel_random.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
loadavg.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
mdstat.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
meminfo.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
mountinfo.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
mountstats.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
net_conntrackstat.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
net_dev.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
net_sockstat.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
net_softnet.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
net_udp.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
net_unix.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
proc.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
proc_cgroup.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
proc_environ.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
proc_fdinfo.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
proc_io.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
proc_limits.go Bump etcd client API dep (#8037) 2020-01-29 15:16:38 +01:00
proc_maps.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
proc_ns.go Bump etcd client API dep (#8037) 2020-01-29 15:16:38 +01:00
proc_psi.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
proc_smaps.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
proc_stat.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
proc_status.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
schedstat.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
stat.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
swaps.go Backport leader status telemetry [VAULT-672] (#10147) 2020-10-15 14:15:58 -07:00
ttar Bump etcd client API dep (#8037) 2020-01-29 15:16:38 +01:00
vm.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05:00
xfrm.go Bump etcd client API dep (#8037) 2020-01-29 15:16:38 +01:00
zoneinfo.go Update to newest go-metrics, go mod vendor. (#8311) 2020-02-07 09:05:14 -05: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.

GoDoc Build Status 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 fixtures directory is up to date by removing the existing directory and then extracting the ttar file using make fixtures/.unpacked or just make test.

rm -rf fixtures
make test

Next, make the required changes to the extracted files in the 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 fixtures.ttar.