prometheus/vendor/github.com/prometheus/procfs
yeya24 797e48c1a3 support time range in promtool query labels
Updated prometheus/client_golang and json-iterator/go

Signed-off-by: yeya24 <yb532204897@gmail.com>
2020-07-03 11:29:39 -04:00
..
internal support time range in promtool query labels 2020-07-03 11:29:39 -04:00
.gitignore update tsdb to version v0.3.0 (#4953) 2018-12-04 19:46:31 +03:00
.golangci.yml Updated all deps. 2020-04-23 13:43:59 +01:00
arp.go Merge the 2.13 release branch (#6169) 2019-10-18 02:21:58 +03:00
buddyinfo.go Merge the 2.13 release branch (#6169) 2019-10-18 02:21:58 +03:00
CONTRIBUTING.md Update vendors 2020-02-25 10:33:41 +01:00
cpuinfo.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
cpuinfo_arm.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
cpuinfo_arm64.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
cpuinfo_default.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
cpuinfo_mips.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
cpuinfo_mips64.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
cpuinfo_mips64le.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
cpuinfo_mipsle.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
cpuinfo_ppc64.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
cpuinfo_ppc64le.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
cpuinfo_s390x.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
crypto.go Updated all deps. 2020-04-23 13:43:59 +01:00
doc.go Vendoring via govendor 2015-09-15 15:37:12 +02:00
fixtures.ttar support time range in promtool query labels 2020-07-03 11:29:39 -04:00
fs.go Update prometheus/client_golang to v1.0.0 (#5682) 2019-06-17 19:14:36 +01:00
fscache.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
go.mod Updated all deps. 2020-04-23 13:43:59 +01:00
go.sum Updated all deps. 2020-04-23 13:43:59 +01:00
ipvs.go Update vendors 2020-02-25 10:33:41 +01:00
kernel_random.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
LICENSE Vendoring via govendor 2015-09-15 15:37:12 +02:00
loadavg.go Updated all deps. 2020-04-23 13:43:59 +01:00
MAINTAINERS.md Update prometheus/client_golang and prometheus/tsdb modules 2019-05-17 14:54:49 +02:00
Makefile Update prometheus/client_golang to v1.0.0 (#5682) 2019-06-17 19:14:36 +01:00
Makefile.common support time range in promtool query labels 2020-07-03 11:29:39 -04:00
mdstat.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
meminfo.go Update vendors 2020-02-25 10:33:41 +01:00
mountinfo.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
mountstats.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
net_conntrackstat.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
net_dev.go Update vendors 2020-02-25 10:33:41 +01:00
net_sockstat.go Update vendors 2020-02-25 10:33:41 +01:00
net_softnet.go Updated all deps. 2020-04-23 13:43:59 +01:00
net_udp.go Updated all deps. 2020-04-23 13:43:59 +01:00
net_unix.go Updated all deps. 2020-04-23 13:43:59 +01:00
NOTICE Vendoring via govendor 2015-09-15 15:37:12 +02:00
proc.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
proc_cgroup.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
proc_environ.go Update vendors 2020-02-25 10:33:41 +01:00
proc_fdinfo.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
proc_io.go Update vendors 2020-02-25 10:33:41 +01:00
proc_limits.go Update prometheus/client_golang to v1.0.0 (#5682) 2019-06-17 19:14:36 +01:00
proc_maps.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
proc_ns.go Update prometheus/client_golang to v1.0.0 (#5682) 2019-06-17 19:14:36 +01:00
proc_psi.go Update vendors 2020-02-25 10:33:41 +01:00
proc_smaps.go support time range in promtool query labels 2020-07-03 11:29:39 -04:00
proc_stat.go Update vendors 2020-02-25 10:33:41 +01:00
proc_status.go Updated all deps. 2020-04-23 13:43:59 +01:00
README.md Update vendors 2020-02-25 10:33:41 +01:00
schedstat.go Merge the 2.13 release branch (#6169) 2019-10-18 02:21:58 +03:00
stat.go Update vendors 2020-02-25 10:33:41 +01:00
swaps.go Updated all deps. 2020-04-23 13:43:59 +01:00
ttar Update prometheus/client_golang to v1.0.0 (#5682) 2019-06-17 19:14:36 +01:00
vm.go Merge the 2.13 release branch (#6169) 2019-10-18 02:21:58 +03:00
xfrm.go Update prometheus/client_golang and prometheus/tsdb modules 2019-05-17 14:54:49 +02:00
zoneinfo.go Merge the 2.13 release branch (#6169) 2019-10-18 02:21:58 +03: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.