mattermost/vendor/github.com/prometheus/procfs
Agniva De Sarker 03a55367d9
MM-24312: Fix Dependency updates (#14391)
Automatic Merge
2020-04-29 14:06:09 -07:00
..
internal Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
.gitignore Depenancy upgrades and movign to dep. (#8630) 2018-04-16 08:37:14 -04:00
.golangci.yml MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
arp.go Upgrading server package dependencies (#12559) 2019-10-02 20:13:38 +02:00
buddyinfo.go Upgrading server package dependencies (#12559) 2019-10-02 20:13:38 +02:00
CONTRIBUTING.md Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
cpuinfo.go Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
crypto.go MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
doc.go PLT-4357 adding performance monitoring (#4622) 2016-11-22 14:05:54 -05:00
fixtures.ttar MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
fs.go Updating dependencies. (#11680) 2019-07-29 07:39:56 -07:00
go.mod MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
go.sum MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
ipvs.go Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
LICENSE PLT-4357 adding performance monitoring (#4622) 2016-11-22 14:05:54 -05:00
loadavg.go MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
MAINTAINERS.md Updating dependencies. (#11680) 2019-07-29 07:39:56 -07:00
Makefile Updating dependencies. (#11680) 2019-07-29 07:39:56 -07:00
Makefile.common MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
mdstat.go Updating dependencies. (#11680) 2019-07-29 07:39:56 -07:00
meminfo.go Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
mountinfo.go MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
mountstats.go Updating dependencies. (#11680) 2019-07-29 07:39:56 -07:00
net_conntrackstat.go MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
net_dev.go Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
net_sockstat.go Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
net_softnet.go MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
net_udp.go MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
net_unix.go MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
NOTICE PLT-4357 adding performance monitoring (#4622) 2016-11-22 14:05:54 -05:00
proc.go Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
proc_environ.go Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
proc_fdinfo.go MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
proc_io.go Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
proc_limits.go Updating dependencies. (#11680) 2019-07-29 07:39:56 -07:00
proc_maps.go MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
proc_ns.go Updating dependencies. (#11680) 2019-07-29 07:39:56 -07:00
proc_psi.go Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
proc_stat.go Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
proc_status.go MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
README.md Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
schedstat.go Upgrading server package dependencies (#12559) 2019-10-02 20:13:38 +02:00
stat.go Update dependencies. (#13778) 2020-02-03 08:19:38 -08:00
swaps.go MM-24312: Fix Dependency updates (#14391) 2020-04-29 14:06:09 -07:00
ttar Updating dependencies. (#11680) 2019-07-29 07:39:56 -07:00
vm.go Upgrading server package dependencies (#12559) 2019-10-02 20:13:38 +02:00
xfrm.go Updating dependencies. (#11680) 2019-07-29 07:39:56 -07:00
zoneinfo.go Upgrading server package dependencies (#12559) 2019-10-02 20:13:38 +02:00

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.