mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-30 05:14:54 +00:00 
			
		
		
		
	feat: bump github.com/prometheus/procfs to v0.0.2
This commit is contained in:
		
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							| @@ -380,7 +380,7 @@ replace ( | ||||
| 	github.com/prometheus/client_golang => github.com/prometheus/client_golang v0.9.4 | ||||
| 	github.com/prometheus/client_model => github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 | ||||
| 	github.com/prometheus/common => github.com/prometheus/common v0.4.1 | ||||
| 	github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a | ||||
| 	github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.2 | ||||
| 	github.com/quobyte/api => github.com/quobyte/api v0.1.2 | ||||
| 	github.com/remyoudompheng/bigfft => github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446 | ||||
| 	github.com/robfig/cron => github.com/robfig/cron v1.1.0 | ||||
|   | ||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							| @@ -371,8 +371,8 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx | ||||
| github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | ||||
| github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw= | ||||
| github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs= | ||||
| github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | ||||
| github.com/quobyte/api v0.1.2 h1:lPHLsuvtjFyk8WhC4uHoHRkScijIHcffTWBBP+YpzYo= | ||||
| github.com/quobyte/api v0.1.2/go.mod h1:jL7lIHrmqQ7yh05OJ+eEEdHr0u/kmT1Ff9iHd+4H6VI= | ||||
| github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= | ||||
|   | ||||
| @@ -35,7 +35,6 @@ require ( | ||||
| ) | ||||
|  | ||||
| replace ( | ||||
| 	github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a | ||||
| 	golang.org/x/crypto => golang.org/x/crypto v0.0.0-20181025213731-e84da0312774 | ||||
| 	golang.org/x/lint => golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 | ||||
| 	golang.org/x/oauth2 => golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a | ||||
|   | ||||
| @@ -243,8 +243,9 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx | ||||
| github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | ||||
| github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw= | ||||
| github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs= | ||||
| github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | ||||
| github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= | ||||
| github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= | ||||
| github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | ||||
|   | ||||
| @@ -60,7 +60,6 @@ require ( | ||||
| ) | ||||
|  | ||||
| replace ( | ||||
| 	github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a | ||||
| 	golang.org/x/crypto => golang.org/x/crypto v0.0.0-20181025213731-e84da0312774 | ||||
| 	golang.org/x/lint => golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 | ||||
| 	golang.org/x/oauth2 => golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a | ||||
|   | ||||
							
								
								
									
										5
									
								
								staging/src/k8s.io/apiserver/go.sum
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								staging/src/k8s.io/apiserver/go.sum
									
									
									
										generated
									
									
									
								
							| @@ -187,8 +187,9 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx | ||||
| github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | ||||
| github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw= | ||||
| github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs= | ||||
| github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | ||||
| github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | ||||
| github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= | ||||
| github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= | ||||
|   | ||||
| @@ -19,7 +19,6 @@ require ( | ||||
| ) | ||||
|  | ||||
| replace ( | ||||
| 	github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a | ||||
| 	golang.org/x/crypto => golang.org/x/crypto v0.0.0-20181025213731-e84da0312774 | ||||
| 	golang.org/x/lint => golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 | ||||
| 	golang.org/x/oauth2 => golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a | ||||
|   | ||||
							
								
								
									
										5
									
								
								staging/src/k8s.io/component-base/go.sum
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								staging/src/k8s.io/component-base/go.sum
									
									
									
										generated
									
									
									
								
							| @@ -124,8 +124,9 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx | ||||
| github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | ||||
| github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw= | ||||
| github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs= | ||||
| github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | ||||
| github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | ||||
| github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= | ||||
| github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= | ||||
|   | ||||
| @@ -25,7 +25,6 @@ require ( | ||||
| ) | ||||
|  | ||||
| replace ( | ||||
| 	github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a | ||||
| 	golang.org/x/crypto => golang.org/x/crypto v0.0.0-20181025213731-e84da0312774 | ||||
| 	golang.org/x/lint => golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 | ||||
| 	golang.org/x/oauth2 => golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a | ||||
|   | ||||
							
								
								
									
										5
									
								
								staging/src/k8s.io/kube-aggregator/go.sum
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								staging/src/k8s.io/kube-aggregator/go.sum
									
									
									
										generated
									
									
									
								
							| @@ -199,8 +199,9 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx | ||||
| github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | ||||
| github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw= | ||||
| github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs= | ||||
| github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | ||||
| github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= | ||||
| github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= | ||||
| github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | ||||
|   | ||||
| @@ -10,7 +10,6 @@ require ( | ||||
| ) | ||||
|  | ||||
| replace ( | ||||
| 	github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a | ||||
| 	golang.org/x/crypto => golang.org/x/crypto v0.0.0-20181025213731-e84da0312774 | ||||
| 	golang.org/x/lint => golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 | ||||
| 	golang.org/x/oauth2 => golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a | ||||
|   | ||||
| @@ -107,7 +107,8 @@ github.com/prometheus/client_golang v0.9.4/go.mod h1:oCXIBxdI62A4cR6aTRJCgetEjec | ||||
| github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= | ||||
| github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | ||||
| github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | ||||
| github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | ||||
| github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= | ||||
| github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= | ||||
|   | ||||
| @@ -10,7 +10,6 @@ require ( | ||||
| ) | ||||
|  | ||||
| replace ( | ||||
| 	github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a | ||||
| 	golang.org/x/crypto => golang.org/x/crypto v0.0.0-20181025213731-e84da0312774 | ||||
| 	golang.org/x/lint => golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 | ||||
| 	golang.org/x/oauth2 => golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a | ||||
|   | ||||
							
								
								
									
										3
									
								
								staging/src/k8s.io/kube-proxy/go.sum
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								staging/src/k8s.io/kube-proxy/go.sum
									
									
									
										generated
									
									
									
								
							| @@ -107,7 +107,8 @@ github.com/prometheus/client_golang v0.9.4/go.mod h1:oCXIBxdI62A4cR6aTRJCgetEjec | ||||
| github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= | ||||
| github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | ||||
| github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | ||||
| github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | ||||
| github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= | ||||
| github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= | ||||
|   | ||||
| @@ -10,7 +10,6 @@ require ( | ||||
| ) | ||||
|  | ||||
| replace ( | ||||
| 	github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a | ||||
| 	golang.org/x/crypto => golang.org/x/crypto v0.0.0-20181025213731-e84da0312774 | ||||
| 	golang.org/x/lint => golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 | ||||
| 	golang.org/x/oauth2 => golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a | ||||
|   | ||||
							
								
								
									
										3
									
								
								staging/src/k8s.io/kube-scheduler/go.sum
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								staging/src/k8s.io/kube-scheduler/go.sum
									
									
									
										generated
									
									
									
								
							| @@ -107,7 +107,8 @@ github.com/prometheus/client_golang v0.9.4/go.mod h1:oCXIBxdI62A4cR6aTRJCgetEjec | ||||
| github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= | ||||
| github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | ||||
| github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | ||||
| github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | ||||
| github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= | ||||
| github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= | ||||
|   | ||||
| @@ -49,7 +49,6 @@ require ( | ||||
| ) | ||||
|  | ||||
| replace ( | ||||
| 	github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a | ||||
| 	golang.org/x/crypto => golang.org/x/crypto v0.0.0-20181025213731-e84da0312774 | ||||
| 	golang.org/x/lint => golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 | ||||
| 	golang.org/x/oauth2 => golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a | ||||
|   | ||||
							
								
								
									
										3
									
								
								staging/src/k8s.io/kubectl/go.sum
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								staging/src/k8s.io/kubectl/go.sum
									
									
									
										generated
									
									
									
								
							| @@ -191,7 +191,8 @@ github.com/prometheus/client_golang v0.9.4/go.mod h1:oCXIBxdI62A4cR6aTRJCgetEjec | ||||
| github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= | ||||
| github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | ||||
| github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | ||||
| github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= | ||||
| github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= | ||||
| github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= | ||||
|   | ||||
| @@ -40,7 +40,6 @@ require ( | ||||
| ) | ||||
|  | ||||
| replace ( | ||||
| 	github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a | ||||
| 	golang.org/x/crypto => golang.org/x/crypto v0.0.0-20181025213731-e84da0312774 | ||||
| 	golang.org/x/lint => golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 | ||||
| 	golang.org/x/oauth2 => golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a | ||||
|   | ||||
							
								
								
									
										5
									
								
								staging/src/k8s.io/legacy-cloud-providers/go.sum
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								staging/src/k8s.io/legacy-cloud-providers/go.sum
									
									
									
										generated
									
									
									
								
							| @@ -182,8 +182,9 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx | ||||
| github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | ||||
| github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw= | ||||
| github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs= | ||||
| github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | ||||
| github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c h1:ht7N4d/B7Ezf58nvMNVF3OlvDlz9pp+WHVcRNS0nink= | ||||
| github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto= | ||||
| github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= | ||||
|   | ||||
| @@ -18,7 +18,6 @@ require ( | ||||
| ) | ||||
|  | ||||
| replace ( | ||||
| 	github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a | ||||
| 	golang.org/x/crypto => golang.org/x/crypto v0.0.0-20181025213731-e84da0312774 | ||||
| 	golang.org/x/lint => golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 | ||||
| 	golang.org/x/oauth2 => golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a | ||||
|   | ||||
							
								
								
									
										5
									
								
								staging/src/k8s.io/sample-apiserver/go.sum
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								staging/src/k8s.io/sample-apiserver/go.sum
									
									
									
										generated
									
									
									
								
							| @@ -196,8 +196,9 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx | ||||
| github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= | ||||
| github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw= | ||||
| github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= | ||||
| github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||||
| github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs= | ||||
| github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | ||||
| github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= | ||||
| github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= | ||||
| github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | ||||
|   | ||||
							
								
								
									
										6
									
								
								vendor/github.com/prometheus/procfs/.golangci.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								vendor/github.com/prometheus/procfs/.golangci.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| # Run only staticcheck for now. Additional linters will be enabled one-by-one. | ||||
| linters: | ||||
|   enable: | ||||
|   - staticcheck | ||||
|   - govet | ||||
|   disable-all: true | ||||
							
								
								
									
										12
									
								
								vendor/github.com/prometheus/procfs/BUILD
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/prometheus/procfs/BUILD
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -10,21 +10,21 @@ go_library( | ||||
|         "mdstat.go", | ||||
|         "mountstats.go", | ||||
|         "net_dev.go", | ||||
|         "net_unix.go", | ||||
|         "proc.go", | ||||
|         "proc_io.go", | ||||
|         "proc_limits.go", | ||||
|         "proc_ns.go", | ||||
|         "proc_psi.go", | ||||
|         "proc_stat.go", | ||||
|         "proc_status.go", | ||||
|         "stat.go", | ||||
|         "xfrm.go", | ||||
|     ], | ||||
|     importmap = "k8s.io/kubernetes/vendor/github.com/prometheus/procfs", | ||||
|     importpath = "github.com/prometheus/procfs", | ||||
|     visibility = ["//visibility:public"], | ||||
|     deps = [ | ||||
|         "//vendor/github.com/prometheus/procfs/nfs:go_default_library", | ||||
|         "//vendor/github.com/prometheus/procfs/xfs:go_default_library", | ||||
|     ], | ||||
|     deps = ["//vendor/github.com/prometheus/procfs/internal/fs:go_default_library"], | ||||
| ) | ||||
|  | ||||
| filegroup( | ||||
| @@ -38,9 +38,7 @@ filegroup( | ||||
|     name = "all-srcs", | ||||
|     srcs = [ | ||||
|         ":package-srcs", | ||||
|         "//vendor/github.com/prometheus/procfs/internal/util:all-srcs", | ||||
|         "//vendor/github.com/prometheus/procfs/nfs:all-srcs", | ||||
|         "//vendor/github.com/prometheus/procfs/xfs:all-srcs", | ||||
|         "//vendor/github.com/prometheus/procfs/internal/fs:all-srcs", | ||||
|     ], | ||||
|     tags = ["automanaged"], | ||||
|     visibility = ["//visibility:public"], | ||||
|   | ||||
							
								
								
									
										3
									
								
								vendor/github.com/prometheus/procfs/MAINTAINERS.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/prometheus/procfs/MAINTAINERS.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1 +1,2 @@ | ||||
| * Tobias Schmidt <tobidt@gmail.com> | ||||
| * Johannes 'fish' Ziemke <github@freigeist.org> @discordianfish | ||||
| * Paul Gier <pgier@redhat.com> @pgier | ||||
|   | ||||
							
								
								
									
										11
									
								
								vendor/github.com/prometheus/procfs/Makefile
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								vendor/github.com/prometheus/procfs/Makefile
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -14,17 +14,16 @@ | ||||
| include Makefile.common | ||||
|  | ||||
| %/.unpacked: %.ttar | ||||
| 	@echo ">> extracting fixtures" | ||||
| 	./ttar -C $(dir $*) -x -f $*.ttar | ||||
| 	touch $@ | ||||
|  | ||||
| update_fixtures: fixtures.ttar sysfs/fixtures.ttar | ||||
|  | ||||
| %fixtures.ttar: %/fixtures | ||||
| 	rm -v $(dir $*)fixtures/.unpacked | ||||
| 	./ttar -C $(dir $*) -c -f $*fixtures.ttar fixtures/ | ||||
| update_fixtures: | ||||
| 	rm -vf fixtures/.unpacked | ||||
| 	./ttar -c -f fixtures.ttar fixtures/ | ||||
|  | ||||
| .PHONY: build | ||||
| build: | ||||
|  | ||||
| .PHONY: test | ||||
| test: fixtures/.unpacked sysfs/fixtures/.unpacked common-test | ||||
| test: fixtures/.unpacked common-test | ||||
|   | ||||
							
								
								
									
										137
									
								
								vendor/github.com/prometheus/procfs/Makefile.common
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										137
									
								
								vendor/github.com/prometheus/procfs/Makefile.common
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -29,12 +29,15 @@ GO           ?= go | ||||
| GOFMT        ?= $(GO)fmt | ||||
| FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH))) | ||||
| GOOPTS       ?= | ||||
| GOHOSTOS     ?= $(shell $(GO) env GOHOSTOS) | ||||
| GOHOSTARCH   ?= $(shell $(GO) env GOHOSTARCH) | ||||
|  | ||||
| GO_VERSION        ?= $(shell $(GO) version) | ||||
| GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION)) | ||||
| PRE_GO_111        ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.') | ||||
|  | ||||
| unexport GOVENDOR | ||||
| GOVENDOR := | ||||
| GO111MODULE := | ||||
| ifeq (, $(PRE_GO_111)) | ||||
| 	ifneq (,$(wildcard go.mod)) | ||||
| 		# Enforce Go modules support just in case the directory is inside GOPATH (and for Travis CI). | ||||
| @@ -55,32 +58,57 @@ $(warning Some recipes may not work as expected as the current Go runtime is '$( | ||||
| 		# This repository isn't using Go modules (yet). | ||||
| 		GOVENDOR := $(FIRST_GOPATH)/bin/govendor | ||||
| 	endif | ||||
|  | ||||
| 	unexport GO111MODULE | ||||
| endif | ||||
| PROMU        := $(FIRST_GOPATH)/bin/promu | ||||
| STATICCHECK  := $(FIRST_GOPATH)/bin/staticcheck | ||||
| pkgs          = ./... | ||||
|  | ||||
| GO_VERSION        ?= $(shell $(GO) version) | ||||
| GO_BUILD_PLATFORM ?= $(subst /,-,$(lastword $(GO_VERSION))) | ||||
| ifeq (arm, $(GOHOSTARCH)) | ||||
| 	GOHOSTARM ?= $(shell GOARM= $(GO) env GOARM) | ||||
| 	GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH)v$(GOHOSTARM) | ||||
| else | ||||
| 	GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH) | ||||
| endif | ||||
|  | ||||
| PROMU_VERSION ?= 0.2.0 | ||||
| PROMU_VERSION ?= 0.4.0 | ||||
| PROMU_URL     := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz | ||||
|  | ||||
| GOLANGCI_LINT := | ||||
| GOLANGCI_LINT_OPTS ?= | ||||
| GOLANGCI_LINT_VERSION ?= v1.16.0 | ||||
| # golangci-lint only supports linux, darwin and windows platforms on i386/amd64. | ||||
| # windows isn't included here because of the path separator being different. | ||||
| ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) | ||||
| 	ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386)) | ||||
| 		GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint | ||||
| 	endif | ||||
| endif | ||||
|  | ||||
| PREFIX                  ?= $(shell pwd) | ||||
| BIN_DIR                 ?= $(shell pwd) | ||||
| DOCKER_IMAGE_TAG        ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD)) | ||||
| DOCKER_REPO             ?= prom | ||||
|  | ||||
| .PHONY: all | ||||
| all: precheck style staticcheck unused build test | ||||
| DOCKER_ARCHS            ?= amd64 | ||||
|  | ||||
| BUILD_DOCKER_ARCHS = $(addprefix common-docker-,$(DOCKER_ARCHS)) | ||||
| PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS)) | ||||
| TAG_DOCKER_ARCHS = $(addprefix common-docker-tag-latest-,$(DOCKER_ARCHS)) | ||||
|  | ||||
| ifeq ($(GOHOSTARCH),amd64) | ||||
|         ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux freebsd darwin windows)) | ||||
|                 # Only supported on amd64 | ||||
|                 test-flags := -race | ||||
|         endif | ||||
| endif | ||||
|  | ||||
| # This rule is used to forward a target like "build" to "common-build".  This | ||||
| # allows a new "build" target to be defined in a Makefile which includes this | ||||
| # one and override "common-build" without override warnings. | ||||
| %: common-% ; | ||||
|  | ||||
| .PHONY: common-all | ||||
| common-all: precheck style check_license lint unused build test | ||||
|  | ||||
| .PHONY: common-style | ||||
| common-style: | ||||
| 	@echo ">> checking code style" | ||||
| @@ -102,6 +130,15 @@ common-check_license: | ||||
|                exit 1; \ | ||||
|        fi | ||||
|  | ||||
| .PHONY: common-deps | ||||
| common-deps: | ||||
| 	@echo ">> getting dependencies" | ||||
| ifdef GO111MODULE | ||||
| 	GO111MODULE=$(GO111MODULE) $(GO) mod download | ||||
| else | ||||
| 	$(GO) get $(GOOPTS) -t ./... | ||||
| endif | ||||
|  | ||||
| .PHONY: common-test-short | ||||
| common-test-short: | ||||
| 	@echo ">> running short tests" | ||||
| @@ -110,26 +147,35 @@ common-test-short: | ||||
| .PHONY: common-test | ||||
| common-test: | ||||
| 	@echo ">> running all tests" | ||||
| 	GO111MODULE=$(GO111MODULE) $(GO) test -race $(GOOPTS) $(pkgs) | ||||
| 	GO111MODULE=$(GO111MODULE) $(GO) test $(test-flags) $(GOOPTS) $(pkgs) | ||||
|  | ||||
| .PHONY: common-format | ||||
| common-format: | ||||
| 	@echo ">> formatting code" | ||||
| 	GO111MODULE=$(GO111MODULE) $(GO) fmt $(GOOPTS) $(pkgs) | ||||
| 	GO111MODULE=$(GO111MODULE) $(GO) fmt $(pkgs) | ||||
|  | ||||
| .PHONY: common-vet | ||||
| common-vet: | ||||
| 	@echo ">> vetting code" | ||||
| 	GO111MODULE=$(GO111MODULE) $(GO) vet $(GOOPTS) $(pkgs) | ||||
|  | ||||
| .PHONY: common-staticcheck | ||||
| common-staticcheck: $(STATICCHECK) | ||||
| 	@echo ">> running staticcheck" | ||||
| .PHONY: common-lint | ||||
| common-lint: $(GOLANGCI_LINT) | ||||
| ifdef GOLANGCI_LINT | ||||
| 	@echo ">> running golangci-lint" | ||||
| ifdef GO111MODULE | ||||
| 	GO111MODULE=$(GO111MODULE) $(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" -checks "SA*" $(pkgs) | ||||
| # 'go list' needs to be executed before staticcheck to prepopulate the modules cache. | ||||
| # Otherwise staticcheck might fail randomly for some reason not yet explained. | ||||
| 	GO111MODULE=$(GO111MODULE) $(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null | ||||
| 	GO111MODULE=$(GO111MODULE) $(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs) | ||||
| else | ||||
| 	$(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs) | ||||
| 	$(GOLANGCI_LINT) run $(pkgs) | ||||
| endif | ||||
| endif | ||||
|  | ||||
| # For backward-compatibility. | ||||
| .PHONY: common-staticcheck | ||||
| common-staticcheck: lint | ||||
|  | ||||
| .PHONY: common-unused | ||||
| common-unused: $(GOVENDOR) | ||||
| @@ -140,8 +186,9 @@ else | ||||
| ifdef GO111MODULE | ||||
| 	@echo ">> running check for unused/missing packages in go.mod" | ||||
| 	GO111MODULE=$(GO111MODULE) $(GO) mod tidy | ||||
| ifeq (,$(wildcard vendor)) | ||||
| 	@git diff --exit-code -- go.sum go.mod | ||||
| ifneq (,$(wildcard vendor)) | ||||
| else | ||||
| 	@echo ">> running check for unused packages in vendor/" | ||||
| 	GO111MODULE=$(GO111MODULE) $(GO) mod vendor | ||||
| 	@git diff --exit-code -- go.sum go.mod vendor/ | ||||
| @@ -159,45 +206,48 @@ common-tarball: promu | ||||
| 	@echo ">> building release tarball" | ||||
| 	$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR) | ||||
|  | ||||
| .PHONY: common-docker | ||||
| common-docker: | ||||
| 	docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" . | ||||
| .PHONY: common-docker $(BUILD_DOCKER_ARCHS) | ||||
| common-docker: $(BUILD_DOCKER_ARCHS) | ||||
| $(BUILD_DOCKER_ARCHS): common-docker-%: | ||||
| 	docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \ | ||||
| 		--build-arg ARCH="$*" \ | ||||
| 		--build-arg OS="linux" \ | ||||
| 		. | ||||
|  | ||||
| .PHONY: common-docker-publish | ||||
| common-docker-publish: | ||||
| 	docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)" | ||||
| .PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS) | ||||
| common-docker-publish: $(PUBLISH_DOCKER_ARCHS) | ||||
| $(PUBLISH_DOCKER_ARCHS): common-docker-publish-%: | ||||
| 	docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" | ||||
|  | ||||
| .PHONY: common-docker-tag-latest | ||||
| common-docker-tag-latest: | ||||
| 	docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):latest" | ||||
| .PHONY: common-docker-tag-latest $(TAG_DOCKER_ARCHS) | ||||
| common-docker-tag-latest: $(TAG_DOCKER_ARCHS) | ||||
| $(TAG_DOCKER_ARCHS): common-docker-tag-latest-%: | ||||
| 	docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest" | ||||
|  | ||||
| .PHONY: common-docker-manifest | ||||
| common-docker-manifest: | ||||
| 	DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" $(foreach ARCH,$(DOCKER_ARCHS),$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$(ARCH):$(DOCKER_IMAGE_TAG)) | ||||
| 	DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" | ||||
|  | ||||
| .PHONY: promu | ||||
| promu: $(PROMU) | ||||
|  | ||||
| $(PROMU): | ||||
| 	curl -s -L $(PROMU_URL) | tar -xvz -C /tmp | ||||
| 	mkdir -v -p $(FIRST_GOPATH)/bin | ||||
| 	cp -v /tmp/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(PROMU) | ||||
| 	$(eval PROMU_TMP := $(shell mktemp -d)) | ||||
| 	curl -s -L $(PROMU_URL) | tar -xvzf - -C $(PROMU_TMP) | ||||
| 	mkdir -p $(FIRST_GOPATH)/bin | ||||
| 	cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu | ||||
| 	rm -r $(PROMU_TMP) | ||||
|  | ||||
| .PHONY: proto | ||||
| proto: | ||||
| 	@echo ">> generating code from proto files" | ||||
| 	@./scripts/genproto.sh | ||||
|  | ||||
| .PHONY: $(STATICCHECK) | ||||
| $(STATICCHECK): | ||||
| ifdef GO111MODULE | ||||
| # Get staticcheck from a temporary directory to avoid modifying the local go.{mod,sum}. | ||||
| # See https://github.com/golang/go/issues/27643. | ||||
| # For now, we are using the next branch of staticcheck because master isn't compatible yet with Go modules. | ||||
| 	tmpModule=$$(mktemp -d 2>&1) && \ | ||||
| 	mkdir -p $${tmpModule}/staticcheck && \ | ||||
| 	cd "$${tmpModule}"/staticcheck && \ | ||||
| 	GO111MODULE=on $(GO) mod init example.com/staticcheck && \ | ||||
| 	GO111MODULE=on GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck@next && \ | ||||
| 	rm -rf $${tmpModule}; | ||||
| else | ||||
| 	GOOS= GOARCH= GO111MODULE=off $(GO) get -u honnef.co/go/tools/cmd/staticcheck | ||||
| ifdef GOLANGCI_LINT | ||||
| $(GOLANGCI_LINT): | ||||
| 	mkdir -p $(FIRST_GOPATH)/bin | ||||
| 	curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION) | ||||
| endif | ||||
|  | ||||
| ifdef GOVENDOR | ||||
| @@ -212,7 +262,6 @@ precheck:: | ||||
| define PRECHECK_COMMAND_template = | ||||
| precheck:: $(1)_precheck | ||||
|  | ||||
|  | ||||
| PRECHECK_COMMAND_$(1) ?= $(1) $$(strip $$(PRECHECK_OPTIONS_$(1))) | ||||
| .PHONY: $(1)_precheck | ||||
| $(1)_precheck: | ||||
|   | ||||
							
								
								
									
										44
									
								
								vendor/github.com/prometheus/procfs/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										44
									
								
								vendor/github.com/prometheus/procfs/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,7 +1,7 @@ | ||||
| # procfs | ||||
|  | ||||
| This procfs package provides functions to retrieve system, kernel and process | ||||
| metrics from the pseudo-filesystem proc. | ||||
| 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. | ||||
| @@ -9,3 +9,45 @@ backwards-incompatible ways without warnings. Use it at your own risk. | ||||
| [](https://godoc.org/github.com/prometheus/procfs) | ||||
| [](https://travis-ci.org/prometheus/procfs) | ||||
| [](https://goreportcard.com/report/github.com/prometheus/procfs) | ||||
|  | ||||
| ## 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, current 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. | ||||
|  | ||||
| ```go | ||||
| fs, err := procfs.NewFS("/proc") | ||||
| stats, err := fs.Stat() | ||||
| ``` | ||||
|  | ||||
| Some sub-packages such as `blockdevice`, require access to both the proc and sys filesystems. | ||||
|  | ||||
| ```go | ||||
|     fs, err := blockdevice.NewFS("/proc", "/sys") | ||||
|     stats, err := fs.ProcDiskstats() | ||||
| ``` | ||||
|  | ||||
| ## Building and Testing | ||||
|  | ||||
| The procfs library is normally built as part of another application.  However, when making | ||||
| changes to the library, the `make test` command can be used to run the API test suite. | ||||
|  | ||||
| ### 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](https://github.com/ideaship/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`. | ||||
|  | ||||
| ```bash | ||||
| 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`. | ||||
|   | ||||
							
								
								
									
										14
									
								
								vendor/github.com/prometheus/procfs/buddyinfo.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/prometheus/procfs/buddyinfo.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -31,19 +31,9 @@ type BuddyInfo struct { | ||||
| 	Sizes []float64 | ||||
| } | ||||
|  | ||||
| // NewBuddyInfo reads the buddyinfo statistics. | ||||
| func NewBuddyInfo() ([]BuddyInfo, error) { | ||||
| 	fs, err := NewFS(DefaultMountPoint) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	return fs.NewBuddyInfo() | ||||
| } | ||||
|  | ||||
| // NewBuddyInfo reads the buddyinfo statistics from the specified `proc` filesystem. | ||||
| func (fs FS) NewBuddyInfo() ([]BuddyInfo, error) { | ||||
| 	file, err := os.Open(fs.Path("buddyinfo")) | ||||
| func (fs FS) BuddyInfo() ([]BuddyInfo, error) { | ||||
| 	file, err := os.Open(fs.proc.Path("buddyinfo")) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										1526
									
								
								vendor/github.com/prometheus/procfs/fixtures.ttar
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1526
									
								
								vendor/github.com/prometheus/procfs/fixtures.ttar
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										73
									
								
								vendor/github.com/prometheus/procfs/fs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										73
									
								
								vendor/github.com/prometheus/procfs/fs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -14,69 +14,30 @@ | ||||
| package procfs | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"os" | ||||
| 	"path" | ||||
|  | ||||
| 	"github.com/prometheus/procfs/nfs" | ||||
| 	"github.com/prometheus/procfs/xfs" | ||||
| 	"github.com/prometheus/procfs/internal/fs" | ||||
| ) | ||||
|  | ||||
| // FS represents the pseudo-filesystem proc, which provides an interface to | ||||
| // FS represents the pseudo-filesystem sys, which provides an interface to | ||||
| // kernel data structures. | ||||
| type FS string | ||||
| type FS struct { | ||||
| 	proc fs.FS | ||||
| } | ||||
|  | ||||
| // DefaultMountPoint is the common mount point of the proc filesystem. | ||||
| const DefaultMountPoint = "/proc" | ||||
| const DefaultMountPoint = fs.DefaultProcMountPoint | ||||
|  | ||||
| // NewFS returns a new FS mounted under the given mountPoint. It will error | ||||
| // if the mount point can't be read. | ||||
| // NewDefaultFS returns a new proc FS mounted under the default proc mountPoint. | ||||
| // It will error if the mount point directory can't be read or is a file. | ||||
| func NewDefaultFS() (FS, error) { | ||||
| 	return NewFS(DefaultMountPoint) | ||||
| } | ||||
|  | ||||
| // NewFS returns a new proc FS mounted under the given proc mountPoint. It will error | ||||
| // if the mount point directory can't be read or is a file. | ||||
| func NewFS(mountPoint string) (FS, error) { | ||||
| 	info, err := os.Stat(mountPoint) | ||||
| 	fs, err := fs.NewFS(mountPoint) | ||||
| 	if err != nil { | ||||
| 		return "", fmt.Errorf("could not read %s: %s", mountPoint, err) | ||||
| 		return FS{}, err | ||||
| 	} | ||||
| 	if !info.IsDir() { | ||||
| 		return "", fmt.Errorf("mount point %s is not a directory", mountPoint) | ||||
| 	} | ||||
|  | ||||
| 	return FS(mountPoint), nil | ||||
| } | ||||
|  | ||||
| // Path returns the path of the given subsystem relative to the procfs root. | ||||
| func (fs FS) Path(p ...string) string { | ||||
| 	return path.Join(append([]string{string(fs)}, p...)...) | ||||
| } | ||||
|  | ||||
| // XFSStats retrieves XFS filesystem runtime statistics. | ||||
| func (fs FS) XFSStats() (*xfs.Stats, error) { | ||||
| 	f, err := os.Open(fs.Path("fs/xfs/stat")) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	defer f.Close() | ||||
|  | ||||
| 	return xfs.ParseStats(f) | ||||
| } | ||||
|  | ||||
| // NFSClientRPCStats retrieves NFS client RPC statistics. | ||||
| func (fs FS) NFSClientRPCStats() (*nfs.ClientRPCStats, error) { | ||||
| 	f, err := os.Open(fs.Path("net/rpc/nfs")) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	defer f.Close() | ||||
|  | ||||
| 	return nfs.ParseClientRPCStats(f) | ||||
| } | ||||
|  | ||||
| // NFSdServerRPCStats retrieves NFS daemon RPC statistics. | ||||
| func (fs FS) NFSdServerRPCStats() (*nfs.ServerRPCStats, error) { | ||||
| 	f, err := os.Open(fs.Path("net/rpc/nfsd")) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	defer f.Close() | ||||
|  | ||||
| 	return nfs.ParseServerRPCStats(f) | ||||
| 	return FS{fs}, nil | ||||
| } | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/prometheus/procfs/go.mod
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/prometheus/procfs/go.mod
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1 +1,3 @@ | ||||
| module github.com/prometheus/procfs | ||||
|  | ||||
| require golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/prometheus/procfs/go.sum
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/prometheus/procfs/go.sum
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= | ||||
| golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||
| @@ -2,12 +2,9 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||||
| 
 | ||||
| go_library( | ||||
|     name = "go_default_library", | ||||
|     srcs = [ | ||||
|         "parse.go", | ||||
|         "sysreadfile_linux.go", | ||||
|     ], | ||||
|     importmap = "k8s.io/kubernetes/vendor/github.com/prometheus/procfs/internal/util", | ||||
|     importpath = "github.com/prometheus/procfs/internal/util", | ||||
|     srcs = ["fs.go"], | ||||
|     importmap = "k8s.io/kubernetes/vendor/github.com/prometheus/procfs/internal/fs", | ||||
|     importpath = "github.com/prometheus/procfs/internal/fs", | ||||
|     visibility = ["//vendor/github.com/prometheus/procfs:__subpackages__"], | ||||
| ) | ||||
| 
 | ||||
							
								
								
									
										52
									
								
								vendor/github.com/prometheus/procfs/internal/fs/fs.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								vendor/github.com/prometheus/procfs/internal/fs/fs.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| // Copyright 2019 The Prometheus Authors | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| package fs | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"os" | ||||
| 	"path/filepath" | ||||
| ) | ||||
|  | ||||
| const ( | ||||
| 	// DefaultProcMountPoint is the common mount point of the proc filesystem. | ||||
| 	DefaultProcMountPoint = "/proc" | ||||
|  | ||||
| 	// DefaultSysMountPoint is the common mount point of the sys filesystem. | ||||
| 	DefaultSysMountPoint = "/sys" | ||||
| ) | ||||
|  | ||||
| // FS represents a pseudo-filesystem, normally /proc or /sys, which provides an | ||||
| // interface to kernel data structures. | ||||
| type FS string | ||||
|  | ||||
| // NewFS returns a new FS mounted under the given mountPoint. It will error | ||||
| // if the mount point can't be read. | ||||
| func NewFS(mountPoint string) (FS, error) { | ||||
| 	info, err := os.Stat(mountPoint) | ||||
| 	if err != nil { | ||||
| 		return "", fmt.Errorf("could not read %s: %s", mountPoint, err) | ||||
| 	} | ||||
| 	if !info.IsDir() { | ||||
| 		return "", fmt.Errorf("mount point %s is not a directory", mountPoint) | ||||
| 	} | ||||
|  | ||||
| 	return FS(mountPoint), nil | ||||
| } | ||||
|  | ||||
| // Path appends the given path elements to the filesystem path, adding separators | ||||
| // as necessary. | ||||
| func (fs FS) Path(p ...string) string { | ||||
| 	return filepath.Join(append([]string{string(fs)}, p...)...) | ||||
| } | ||||
							
								
								
									
										59
									
								
								vendor/github.com/prometheus/procfs/internal/util/parse.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										59
									
								
								vendor/github.com/prometheus/procfs/internal/util/parse.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,59 +0,0 @@ | ||||
| // Copyright 2018 The Prometheus Authors | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| package util | ||||
|  | ||||
| import ( | ||||
| 	"io/ioutil" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| ) | ||||
|  | ||||
| // ParseUint32s parses a slice of strings into a slice of uint32s. | ||||
| func ParseUint32s(ss []string) ([]uint32, error) { | ||||
| 	us := make([]uint32, 0, len(ss)) | ||||
| 	for _, s := range ss { | ||||
| 		u, err := strconv.ParseUint(s, 10, 32) | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
| 		} | ||||
|  | ||||
| 		us = append(us, uint32(u)) | ||||
| 	} | ||||
|  | ||||
| 	return us, nil | ||||
| } | ||||
|  | ||||
| // ParseUint64s parses a slice of strings into a slice of uint64s. | ||||
| func ParseUint64s(ss []string) ([]uint64, error) { | ||||
| 	us := make([]uint64, 0, len(ss)) | ||||
| 	for _, s := range ss { | ||||
| 		u, err := strconv.ParseUint(s, 10, 64) | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
| 		} | ||||
|  | ||||
| 		us = append(us, u) | ||||
| 	} | ||||
|  | ||||
| 	return us, nil | ||||
| } | ||||
|  | ||||
| // ReadUintFromFile reads a file and attempts to parse a uint64 from it. | ||||
| func ReadUintFromFile(path string) (uint64, error) { | ||||
| 	data, err := ioutil.ReadFile(path) | ||||
| 	if err != nil { | ||||
| 		return 0, err | ||||
| 	} | ||||
| 	return strconv.ParseUint(strings.TrimSpace(string(data)), 10, 64) | ||||
| } | ||||
							
								
								
									
										45
									
								
								vendor/github.com/prometheus/procfs/internal/util/sysreadfile_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										45
									
								
								vendor/github.com/prometheus/procfs/internal/util/sysreadfile_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,45 +0,0 @@ | ||||
| // Copyright 2018 The Prometheus Authors | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| // +build !windows | ||||
|  | ||||
| package util | ||||
|  | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"os" | ||||
| 	"syscall" | ||||
| ) | ||||
|  | ||||
| // SysReadFile is a simplified ioutil.ReadFile that invokes syscall.Read directly. | ||||
| // https://github.com/prometheus/node_exporter/pull/728/files | ||||
| func SysReadFile(file string) (string, error) { | ||||
| 	f, err := os.Open(file) | ||||
| 	if err != nil { | ||||
| 		return "", err | ||||
| 	} | ||||
| 	defer f.Close() | ||||
|  | ||||
| 	// On some machines, hwmon drivers are broken and return EAGAIN.  This causes | ||||
| 	// Go's ioutil.ReadFile implementation to poll forever. | ||||
| 	// | ||||
| 	// Since we either want to read data or bail immediately, do the simplest | ||||
| 	// possible read using syscall directly. | ||||
| 	b := make([]byte, 128) | ||||
| 	n, err := syscall.Read(int(f.Fd()), b) | ||||
| 	if err != nil { | ||||
| 		return "", err | ||||
| 	} | ||||
|  | ||||
| 	return string(bytes.TrimSpace(b[:n])), nil | ||||
| } | ||||
							
								
								
									
										32
									
								
								vendor/github.com/prometheus/procfs/ipvs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										32
									
								
								vendor/github.com/prometheus/procfs/ipvs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -62,19 +62,9 @@ type IPVSBackendStatus struct { | ||||
| 	Weight uint64 | ||||
| } | ||||
|  | ||||
| // NewIPVSStats reads the IPVS statistics. | ||||
| func NewIPVSStats() (IPVSStats, error) { | ||||
| 	fs, err := NewFS(DefaultMountPoint) | ||||
| 	if err != nil { | ||||
| 		return IPVSStats{}, err | ||||
| 	} | ||||
|  | ||||
| 	return fs.NewIPVSStats() | ||||
| } | ||||
|  | ||||
| // NewIPVSStats reads the IPVS statistics from the specified `proc` filesystem. | ||||
| func (fs FS) NewIPVSStats() (IPVSStats, error) { | ||||
| 	file, err := os.Open(fs.Path("net/ip_vs_stats")) | ||||
| // IPVSStats reads the IPVS statistics from the specified `proc` filesystem. | ||||
| func (fs FS) IPVSStats() (IPVSStats, error) { | ||||
| 	file, err := os.Open(fs.proc.Path("net/ip_vs_stats")) | ||||
| 	if err != nil { | ||||
| 		return IPVSStats{}, err | ||||
| 	} | ||||
| @@ -131,19 +121,9 @@ func parseIPVSStats(file io.Reader) (IPVSStats, error) { | ||||
| 	return stats, nil | ||||
| } | ||||
|  | ||||
| // NewIPVSBackendStatus reads and returns the status of all (virtual,real) server pairs. | ||||
| func NewIPVSBackendStatus() ([]IPVSBackendStatus, error) { | ||||
| 	fs, err := NewFS(DefaultMountPoint) | ||||
| 	if err != nil { | ||||
| 		return []IPVSBackendStatus{}, err | ||||
| 	} | ||||
|  | ||||
| 	return fs.NewIPVSBackendStatus() | ||||
| } | ||||
|  | ||||
| // NewIPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem. | ||||
| func (fs FS) NewIPVSBackendStatus() ([]IPVSBackendStatus, error) { | ||||
| 	file, err := os.Open(fs.Path("net/ip_vs")) | ||||
| // IPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem. | ||||
| func (fs FS) IPVSBackendStatus() ([]IPVSBackendStatus, error) { | ||||
| 	file, err := os.Open(fs.proc.Path("net/ip_vs")) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										74
									
								
								vendor/github.com/prometheus/procfs/mdstat.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										74
									
								
								vendor/github.com/prometheus/procfs/mdstat.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -42,64 +42,64 @@ type MDStat struct { | ||||
| 	BlocksSynced int64 | ||||
| } | ||||
|  | ||||
| // ParseMDStat parses an mdstat-file and returns a struct with the relevant infos. | ||||
| func (fs FS) ParseMDStat() (mdstates []MDStat, err error) { | ||||
| 	mdStatusFilePath := fs.Path("mdstat") | ||||
| 	content, err := ioutil.ReadFile(mdStatusFilePath) | ||||
| // MDStat parses an mdstat-file (/proc/mdstat) and returns a slice of | ||||
| // structs containing the relevant info.  More information available here: | ||||
| // https://raid.wiki.kernel.org/index.php/Mdstat | ||||
| func (fs FS) MDStat() ([]MDStat, error) { | ||||
| 	data, err := ioutil.ReadFile(fs.proc.Path("mdstat")) | ||||
| 	if err != nil { | ||||
| 		return []MDStat{}, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err) | ||||
| 		return nil, fmt.Errorf("error parsing mdstat %s: %s", fs.proc.Path("mdstat"), err) | ||||
| 	} | ||||
| 	mdstat, err := parseMDStat(data) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("error parsing mdstat %s: %s", fs.proc.Path("mdstat"), err) | ||||
| 	} | ||||
| 	return mdstat, nil | ||||
| } | ||||
|  | ||||
| 	mdStates := []MDStat{} | ||||
| 	lines := strings.Split(string(content), "\n") | ||||
| // parseMDStat parses data from mdstat file (/proc/mdstat) and returns a slice of | ||||
| // structs containing the relevant info. | ||||
| func parseMDStat(mdstatData []byte) ([]MDStat, error) { | ||||
| 	mdStats := []MDStat{} | ||||
| 	lines := strings.Split(string(mdstatData), "\n") | ||||
| 	for i, l := range lines { | ||||
| 		if l == "" { | ||||
| 			continue | ||||
| 		} | ||||
| 		if l[0] == ' ' { | ||||
| 			continue | ||||
| 		} | ||||
| 		if strings.HasPrefix(l, "Personalities") || strings.HasPrefix(l, "unused") { | ||||
| 		if strings.TrimSpace(l) == "" || l[0] == ' ' || | ||||
| 			strings.HasPrefix(l, "Personalities") || strings.HasPrefix(l, "unused") { | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		mainLine := strings.Split(l, " ") | ||||
| 		if len(mainLine) < 3 { | ||||
| 			return mdStates, fmt.Errorf("error parsing mdline: %s", l) | ||||
| 		deviceFields := strings.Fields(l) | ||||
| 		if len(deviceFields) < 3 { | ||||
| 			return nil, fmt.Errorf("not enough fields in mdline (expected at least 3): %s", l) | ||||
| 		} | ||||
| 		mdName := mainLine[0] | ||||
| 		activityState := mainLine[2] | ||||
| 		mdName := deviceFields[0] | ||||
| 		activityState := deviceFields[2] | ||||
|  | ||||
| 		if len(lines) <= i+3 { | ||||
| 			return mdStates, fmt.Errorf( | ||||
| 				"error parsing %s: too few lines for md device %s", | ||||
| 				mdStatusFilePath, | ||||
| 				mdName, | ||||
| 			) | ||||
| 			return mdStats, fmt.Errorf("missing lines for md device %s", mdName) | ||||
| 		} | ||||
|  | ||||
| 		active, total, size, err := evalStatusline(lines[i+1]) | ||||
| 		active, total, size, err := evalStatusLine(lines[i+1]) | ||||
| 		if err != nil { | ||||
| 			return mdStates, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err) | ||||
| 			return nil, err | ||||
| 		} | ||||
|  | ||||
| 		// j is the line number of the syncing-line. | ||||
| 		j := i + 2 | ||||
| 		syncLineIdx := i + 2 | ||||
| 		if strings.Contains(lines[i+2], "bitmap") { // skip bitmap line | ||||
| 			j = i + 3 | ||||
| 			syncLineIdx++ | ||||
| 		} | ||||
|  | ||||
| 		// If device is syncing at the moment, get the number of currently | ||||
| 		// If device is recovering/syncing at the moment, get the number of currently | ||||
| 		// synced bytes, otherwise that number equals the size of the device. | ||||
| 		syncedBlocks := size | ||||
| 		if strings.Contains(lines[j], "recovery") || strings.Contains(lines[j], "resync") { | ||||
| 			syncedBlocks, err = evalBuildline(lines[j]) | ||||
| 		if strings.Contains(lines[syncLineIdx], "recovery") || strings.Contains(lines[syncLineIdx], "resync") { | ||||
| 			syncedBlocks, err = evalRecoveryLine(lines[syncLineIdx]) | ||||
| 			if err != nil { | ||||
| 				return mdStates, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err) | ||||
| 				return nil, err | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		mdStates = append(mdStates, MDStat{ | ||||
| 		mdStats = append(mdStats, MDStat{ | ||||
| 			Name:          mdName, | ||||
| 			ActivityState: activityState, | ||||
| 			DisksActive:   active, | ||||
| @@ -109,10 +109,10 @@ func (fs FS) ParseMDStat() (mdstates []MDStat, err error) { | ||||
| 		}) | ||||
| 	} | ||||
|  | ||||
| 	return mdStates, nil | ||||
| 	return mdStats, nil | ||||
| } | ||||
|  | ||||
| func evalStatusline(statusline string) (active, total, size int64, err error) { | ||||
| func evalStatusLine(statusline string) (active, total, size int64, err error) { | ||||
| 	matches := statuslineRE.FindStringSubmatch(statusline) | ||||
| 	if len(matches) != 4 { | ||||
| 		return 0, 0, 0, fmt.Errorf("unexpected statusline: %s", statusline) | ||||
| @@ -136,7 +136,7 @@ func evalStatusline(statusline string) (active, total, size int64, err error) { | ||||
| 	return active, total, size, nil | ||||
| } | ||||
|  | ||||
| func evalBuildline(buildline string) (syncedBlocks int64, err error) { | ||||
| func evalRecoveryLine(buildline string) (syncedBlocks int64, err error) { | ||||
| 	matches := buildlineRE.FindStringSubmatch(buildline) | ||||
| 	if len(matches) != 2 { | ||||
| 		return 0, fmt.Errorf("unexpected buildline: %s", buildline) | ||||
|   | ||||
							
								
								
									
										31
									
								
								vendor/github.com/prometheus/procfs/mountstats.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										31
									
								
								vendor/github.com/prometheus/procfs/mountstats.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -69,6 +69,8 @@ type MountStats interface { | ||||
| type MountStatsNFS struct { | ||||
| 	// The version of statistics provided. | ||||
| 	StatVersion string | ||||
| 	// The mount options of the NFS mount. | ||||
| 	Opts map[string]string | ||||
| 	// The age of the NFS mount. | ||||
| 	Age time.Duration | ||||
| 	// Statistics related to byte counters for various operations. | ||||
| @@ -179,11 +181,11 @@ type NFSOperationStats struct { | ||||
| 	// Number of bytes received for this operation, including RPC headers and payload. | ||||
| 	BytesReceived uint64 | ||||
| 	// Duration all requests spent queued for transmission before they were sent. | ||||
| 	CumulativeQueueTime time.Duration | ||||
| 	CumulativeQueueMilliseconds uint64 | ||||
| 	// Duration it took to get a reply back after the request was transmitted. | ||||
| 	CumulativeTotalResponseTime time.Duration | ||||
| 	CumulativeTotalResponseMilliseconds uint64 | ||||
| 	// Duration from when a request was enqueued to when it was completely handled. | ||||
| 	CumulativeTotalRequestTime time.Duration | ||||
| 	CumulativeTotalRequestMilliseconds uint64 | ||||
| } | ||||
|  | ||||
| // A NFSTransportStats contains statistics for the NFS mount RPC requests and | ||||
| @@ -202,7 +204,7 @@ type NFSTransportStats struct { | ||||
| 	// spent waiting for connections to the server to be established. | ||||
| 	ConnectIdleTime uint64 | ||||
| 	// Duration since the NFS mount last saw any RPC traffic. | ||||
| 	IdleTime time.Duration | ||||
| 	IdleTimeSeconds uint64 | ||||
| 	// Number of RPC requests for this mount sent to the NFS server. | ||||
| 	Sends uint64 | ||||
| 	// Number of RPC responses for this mount received from the NFS server. | ||||
| @@ -317,6 +319,7 @@ func parseMount(ss []string) (*Mount, error) { | ||||
| func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, error) { | ||||
| 	// Field indicators for parsing specific types of data | ||||
| 	const ( | ||||
| 		fieldOpts       = "opts:" | ||||
| 		fieldAge        = "age:" | ||||
| 		fieldBytes      = "bytes:" | ||||
| 		fieldEvents     = "events:" | ||||
| @@ -338,6 +341,18 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e | ||||
| 		} | ||||
|  | ||||
| 		switch ss[0] { | ||||
| 		case fieldOpts: | ||||
| 			if stats.Opts == nil { | ||||
| 				stats.Opts = map[string]string{} | ||||
| 			} | ||||
| 			for _, opt := range strings.Split(ss[1], ",") { | ||||
| 				split := strings.Split(opt, "=") | ||||
| 				if len(split) == 2 { | ||||
| 					stats.Opts[split[0]] = split[1] | ||||
| 				} else { | ||||
| 					stats.Opts[opt] = "" | ||||
| 				} | ||||
| 			} | ||||
| 		case fieldAge: | ||||
| 			// Age integer is in seconds | ||||
| 			d, err := time.ParseDuration(ss[1] + "s") | ||||
| @@ -515,9 +530,9 @@ func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) { | ||||
| 			MajorTimeouts:                       ns[2], | ||||
| 			BytesSent:                           ns[3], | ||||
| 			BytesReceived:                       ns[4], | ||||
| 			CumulativeQueueTime:         time.Duration(ns[5]) * time.Millisecond, | ||||
| 			CumulativeTotalResponseTime: time.Duration(ns[6]) * time.Millisecond, | ||||
| 			CumulativeTotalRequestTime:  time.Duration(ns[7]) * time.Millisecond, | ||||
| 			CumulativeQueueMilliseconds:         ns[5], | ||||
| 			CumulativeTotalResponseMilliseconds: ns[6], | ||||
| 			CumulativeTotalRequestMilliseconds:  ns[7], | ||||
| 		}) | ||||
| 	} | ||||
|  | ||||
| @@ -593,7 +608,7 @@ func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats | ||||
| 		Bind:                     ns[1], | ||||
| 		Connect:                  ns[2], | ||||
| 		ConnectIdleTime:          ns[3], | ||||
| 		IdleTime:                 time.Duration(ns[4]) * time.Second, | ||||
| 		IdleTimeSeconds:          ns[4], | ||||
| 		Sends:                    ns[5], | ||||
| 		Receives:                 ns[6], | ||||
| 		BadTransactionIDs:        ns[7], | ||||
|   | ||||
							
								
								
									
										38
									
								
								vendor/github.com/prometheus/procfs/net_dev.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										38
									
								
								vendor/github.com/prometheus/procfs/net_dev.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -47,23 +47,13 @@ type NetDevLine struct { | ||||
| // are interface names. | ||||
| type NetDev map[string]NetDevLine | ||||
|  | ||||
| // NewNetDev returns kernel/system statistics read from /proc/net/dev. | ||||
| func NewNetDev() (NetDev, error) { | ||||
| 	fs, err := NewFS(DefaultMountPoint) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| // NetDev returns kernel/system statistics read from /proc/net/dev. | ||||
| func (fs FS) NetDev() (NetDev, error) { | ||||
| 	return newNetDev(fs.proc.Path("net/dev")) | ||||
| } | ||||
|  | ||||
| 	return fs.NewNetDev() | ||||
| } | ||||
|  | ||||
| // NewNetDev returns kernel/system statistics read from /proc/net/dev. | ||||
| func (fs FS) NewNetDev() (NetDev, error) { | ||||
| 	return newNetDev(fs.Path("net/dev")) | ||||
| } | ||||
|  | ||||
| // NewNetDev returns kernel/system statistics read from /proc/[pid]/net/dev. | ||||
| func (p Proc) NewNetDev() (NetDev, error) { | ||||
| // NetDev returns kernel/system statistics read from /proc/[pid]/net/dev. | ||||
| func (p Proc) NetDev() (NetDev, error) { | ||||
| 	return newNetDev(p.path("net/dev")) | ||||
| } | ||||
|  | ||||
| @@ -75,7 +65,7 @@ func newNetDev(file string) (NetDev, error) { | ||||
| 	} | ||||
| 	defer f.Close() | ||||
|  | ||||
| 	nd := NetDev{} | ||||
| 	netDev := NetDev{} | ||||
| 	s := bufio.NewScanner(f) | ||||
| 	for n := 0; s.Scan(); n++ { | ||||
| 		// Skip the 2 header lines. | ||||
| @@ -83,20 +73,20 @@ func newNetDev(file string) (NetDev, error) { | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		line, err := nd.parseLine(s.Text()) | ||||
| 		line, err := netDev.parseLine(s.Text()) | ||||
| 		if err != nil { | ||||
| 			return nd, err | ||||
| 			return netDev, err | ||||
| 		} | ||||
|  | ||||
| 		nd[line.Name] = *line | ||||
| 		netDev[line.Name] = *line | ||||
| 	} | ||||
|  | ||||
| 	return nd, s.Err() | ||||
| 	return netDev, s.Err() | ||||
| } | ||||
|  | ||||
| // parseLine parses a single line from the /proc/net/dev file. Header lines | ||||
| // must be filtered prior to calling this method. | ||||
| func (nd NetDev) parseLine(rawLine string) (*NetDevLine, error) { | ||||
| func (netDev NetDev) parseLine(rawLine string) (*NetDevLine, error) { | ||||
| 	parts := strings.SplitN(rawLine, ":", 2) | ||||
| 	if len(parts) != 2 { | ||||
| 		return nil, errors.New("invalid net/dev line, missing colon") | ||||
| @@ -185,11 +175,11 @@ func (nd NetDev) parseLine(rawLine string) (*NetDevLine, error) { | ||||
|  | ||||
| // Total aggregates the values across interfaces and returns a new NetDevLine. | ||||
| // The Name field will be a sorted comma separated list of interface names. | ||||
| func (nd NetDev) Total() NetDevLine { | ||||
| func (netDev NetDev) Total() NetDevLine { | ||||
| 	total := NetDevLine{} | ||||
|  | ||||
| 	names := make([]string, 0, len(nd)) | ||||
| 	for _, ifc := range nd { | ||||
| 	names := make([]string, 0, len(netDev)) | ||||
| 	for _, ifc := range netDev { | ||||
| 		names = append(names, ifc.Name) | ||||
| 		total.RxBytes += ifc.RxBytes | ||||
| 		total.RxPackets += ifc.RxPackets | ||||
|   | ||||
							
								
								
									
										275
									
								
								vendor/github.com/prometheus/procfs/net_unix.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										275
									
								
								vendor/github.com/prometheus/procfs/net_unix.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,275 @@ | ||||
| // Copyright 2018 The Prometheus Authors | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| package procfs | ||||
|  | ||||
| import ( | ||||
| 	"bufio" | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"os" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| ) | ||||
|  | ||||
| // For the proc file format details, | ||||
| // see https://elixir.bootlin.com/linux/v4.17/source/net/unix/af_unix.c#L2815 | ||||
| // and https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/net.h#L48. | ||||
|  | ||||
| const ( | ||||
| 	netUnixKernelPtrIdx = iota | ||||
| 	netUnixRefCountIdx | ||||
| 	_ | ||||
| 	netUnixFlagsIdx | ||||
| 	netUnixTypeIdx | ||||
| 	netUnixStateIdx | ||||
| 	netUnixInodeIdx | ||||
|  | ||||
| 	// Inode and Path are optional. | ||||
| 	netUnixStaticFieldsCnt = 6 | ||||
| ) | ||||
|  | ||||
| const ( | ||||
| 	netUnixTypeStream    = 1 | ||||
| 	netUnixTypeDgram     = 2 | ||||
| 	netUnixTypeSeqpacket = 5 | ||||
|  | ||||
| 	netUnixFlagListen = 1 << 16 | ||||
|  | ||||
| 	netUnixStateUnconnected  = 1 | ||||
| 	netUnixStateConnecting   = 2 | ||||
| 	netUnixStateConnected    = 3 | ||||
| 	netUnixStateDisconnected = 4 | ||||
| ) | ||||
|  | ||||
| var errInvalidKernelPtrFmt = errors.New("Invalid Num(the kernel table slot number) format") | ||||
|  | ||||
| // NetUnixType is the type of the type field. | ||||
| type NetUnixType uint64 | ||||
|  | ||||
| // NetUnixFlags is the type of the flags field. | ||||
| type NetUnixFlags uint64 | ||||
|  | ||||
| // NetUnixState is the type of the state field. | ||||
| type NetUnixState uint64 | ||||
|  | ||||
| // NetUnixLine represents a line of /proc/net/unix. | ||||
| type NetUnixLine struct { | ||||
| 	KernelPtr string | ||||
| 	RefCount  uint64 | ||||
| 	Protocol  uint64 | ||||
| 	Flags     NetUnixFlags | ||||
| 	Type      NetUnixType | ||||
| 	State     NetUnixState | ||||
| 	Inode     uint64 | ||||
| 	Path      string | ||||
| } | ||||
|  | ||||
| // NetUnix holds the data read from /proc/net/unix. | ||||
| type NetUnix struct { | ||||
| 	Rows []*NetUnixLine | ||||
| } | ||||
|  | ||||
| // NewNetUnix returns data read from /proc/net/unix. | ||||
| func NewNetUnix() (*NetUnix, error) { | ||||
| 	fs, err := NewFS(DefaultMountPoint) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	return fs.NewNetUnix() | ||||
| } | ||||
|  | ||||
| // NewNetUnix returns data read from /proc/net/unix. | ||||
| func (fs FS) NewNetUnix() (*NetUnix, error) { | ||||
| 	return NewNetUnixByPath(fs.proc.Path("net/unix")) | ||||
| } | ||||
|  | ||||
| // NewNetUnixByPath returns data read from /proc/net/unix by file path. | ||||
| // It might returns an error with partial parsed data, if an error occur after some data parsed. | ||||
| func NewNetUnixByPath(path string) (*NetUnix, error) { | ||||
| 	f, err := os.Open(path) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	defer f.Close() | ||||
| 	return NewNetUnixByReader(f) | ||||
| } | ||||
|  | ||||
| // NewNetUnixByReader returns data read from /proc/net/unix by a reader. | ||||
| // It might returns an error with partial parsed data, if an error occur after some data parsed. | ||||
| func NewNetUnixByReader(reader io.Reader) (*NetUnix, error) { | ||||
| 	nu := &NetUnix{ | ||||
| 		Rows: make([]*NetUnixLine, 0, 32), | ||||
| 	} | ||||
| 	scanner := bufio.NewScanner(reader) | ||||
| 	// Omit the header line. | ||||
| 	scanner.Scan() | ||||
| 	header := scanner.Text() | ||||
| 	// From the man page of proc(5), it does not contain an Inode field, | ||||
| 	// but in actually it exists. | ||||
| 	// This code works for both cases. | ||||
| 	hasInode := strings.Contains(header, "Inode") | ||||
|  | ||||
| 	minFieldsCnt := netUnixStaticFieldsCnt | ||||
| 	if hasInode { | ||||
| 		minFieldsCnt++ | ||||
| 	} | ||||
| 	for scanner.Scan() { | ||||
| 		line := scanner.Text() | ||||
| 		item, err := nu.parseLine(line, hasInode, minFieldsCnt) | ||||
| 		if err != nil { | ||||
| 			return nu, err | ||||
| 		} | ||||
| 		nu.Rows = append(nu.Rows, item) | ||||
| 	} | ||||
|  | ||||
| 	return nu, scanner.Err() | ||||
| } | ||||
|  | ||||
| func (u *NetUnix) parseLine(line string, hasInode bool, minFieldsCnt int) (*NetUnixLine, error) { | ||||
| 	fields := strings.Fields(line) | ||||
| 	fieldsLen := len(fields) | ||||
| 	if fieldsLen < minFieldsCnt { | ||||
| 		return nil, fmt.Errorf( | ||||
| 			"Parse Unix domain failed: expect at least %d fields but got %d", | ||||
| 			minFieldsCnt, fieldsLen) | ||||
| 	} | ||||
| 	kernelPtr, err := u.parseKernelPtr(fields[netUnixKernelPtrIdx]) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("Parse Unix domain num(%s) failed: %s", fields[netUnixKernelPtrIdx], err) | ||||
| 	} | ||||
| 	users, err := u.parseUsers(fields[netUnixRefCountIdx]) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("Parse Unix domain ref count(%s) failed: %s", fields[netUnixRefCountIdx], err) | ||||
| 	} | ||||
| 	flags, err := u.parseFlags(fields[netUnixFlagsIdx]) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("Parse Unix domain flags(%s) failed: %s", fields[netUnixFlagsIdx], err) | ||||
| 	} | ||||
| 	typ, err := u.parseType(fields[netUnixTypeIdx]) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("Parse Unix domain type(%s) failed: %s", fields[netUnixTypeIdx], err) | ||||
| 	} | ||||
| 	state, err := u.parseState(fields[netUnixStateIdx]) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("Parse Unix domain state(%s) failed: %s", fields[netUnixStateIdx], err) | ||||
| 	} | ||||
| 	var inode uint64 | ||||
| 	if hasInode { | ||||
| 		inodeStr := fields[netUnixInodeIdx] | ||||
| 		inode, err = u.parseInode(inodeStr) | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("Parse Unix domain inode(%s) failed: %s", inodeStr, err) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	nuLine := &NetUnixLine{ | ||||
| 		KernelPtr: kernelPtr, | ||||
| 		RefCount:  users, | ||||
| 		Type:      typ, | ||||
| 		Flags:     flags, | ||||
| 		State:     state, | ||||
| 		Inode:     inode, | ||||
| 	} | ||||
|  | ||||
| 	// Path field is optional. | ||||
| 	if fieldsLen > minFieldsCnt { | ||||
| 		pathIdx := netUnixInodeIdx + 1 | ||||
| 		if !hasInode { | ||||
| 			pathIdx-- | ||||
| 		} | ||||
| 		nuLine.Path = fields[pathIdx] | ||||
| 	} | ||||
|  | ||||
| 	return nuLine, nil | ||||
| } | ||||
|  | ||||
| func (u NetUnix) parseKernelPtr(str string) (string, error) { | ||||
| 	if !strings.HasSuffix(str, ":") { | ||||
| 		return "", errInvalidKernelPtrFmt | ||||
| 	} | ||||
| 	return str[:len(str)-1], nil | ||||
| } | ||||
|  | ||||
| func (u NetUnix) parseUsers(hexStr string) (uint64, error) { | ||||
| 	return strconv.ParseUint(hexStr, 16, 32) | ||||
| } | ||||
|  | ||||
| func (u NetUnix) parseProtocol(hexStr string) (uint64, error) { | ||||
| 	return strconv.ParseUint(hexStr, 16, 32) | ||||
| } | ||||
|  | ||||
| func (u NetUnix) parseType(hexStr string) (NetUnixType, error) { | ||||
| 	typ, err := strconv.ParseUint(hexStr, 16, 16) | ||||
| 	if err != nil { | ||||
| 		return 0, err | ||||
| 	} | ||||
| 	return NetUnixType(typ), nil | ||||
| } | ||||
|  | ||||
| func (u NetUnix) parseFlags(hexStr string) (NetUnixFlags, error) { | ||||
| 	flags, err := strconv.ParseUint(hexStr, 16, 32) | ||||
| 	if err != nil { | ||||
| 		return 0, err | ||||
| 	} | ||||
| 	return NetUnixFlags(flags), nil | ||||
| } | ||||
|  | ||||
| func (u NetUnix) parseState(hexStr string) (NetUnixState, error) { | ||||
| 	st, err := strconv.ParseInt(hexStr, 16, 8) | ||||
| 	if err != nil { | ||||
| 		return 0, err | ||||
| 	} | ||||
| 	return NetUnixState(st), nil | ||||
| } | ||||
|  | ||||
| func (u NetUnix) parseInode(inodeStr string) (uint64, error) { | ||||
| 	return strconv.ParseUint(inodeStr, 10, 64) | ||||
| } | ||||
|  | ||||
| func (t NetUnixType) String() string { | ||||
| 	switch t { | ||||
| 	case netUnixTypeStream: | ||||
| 		return "stream" | ||||
| 	case netUnixTypeDgram: | ||||
| 		return "dgram" | ||||
| 	case netUnixTypeSeqpacket: | ||||
| 		return "seqpacket" | ||||
| 	} | ||||
| 	return "unknown" | ||||
| } | ||||
|  | ||||
| func (f NetUnixFlags) String() string { | ||||
| 	switch f { | ||||
| 	case netUnixFlagListen: | ||||
| 		return "listen" | ||||
| 	default: | ||||
| 		return "default" | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (s NetUnixState) String() string { | ||||
| 	switch s { | ||||
| 	case netUnixStateUnconnected: | ||||
| 		return "unconnected" | ||||
| 	case netUnixStateConnecting: | ||||
| 		return "connecting" | ||||
| 	case netUnixStateConnected: | ||||
| 		return "connected" | ||||
| 	case netUnixStateDisconnected: | ||||
| 		return "disconnected" | ||||
| 	} | ||||
| 	return "unknown" | ||||
| } | ||||
							
								
								
									
										29
									
								
								vendor/github.com/prometheus/procfs/nfs/BUILD
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										29
									
								
								vendor/github.com/prometheus/procfs/nfs/BUILD
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,29 +0,0 @@ | ||||
| load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||||
|  | ||||
| go_library( | ||||
|     name = "go_default_library", | ||||
|     srcs = [ | ||||
|         "nfs.go", | ||||
|         "parse.go", | ||||
|         "parse_nfs.go", | ||||
|         "parse_nfsd.go", | ||||
|     ], | ||||
|     importmap = "k8s.io/kubernetes/vendor/github.com/prometheus/procfs/nfs", | ||||
|     importpath = "github.com/prometheus/procfs/nfs", | ||||
|     visibility = ["//visibility:public"], | ||||
|     deps = ["//vendor/github.com/prometheus/procfs/internal/util:go_default_library"], | ||||
| ) | ||||
|  | ||||
| filegroup( | ||||
|     name = "package-srcs", | ||||
|     srcs = glob(["**"]), | ||||
|     tags = ["automanaged"], | ||||
|     visibility = ["//visibility:private"], | ||||
| ) | ||||
|  | ||||
| filegroup( | ||||
|     name = "all-srcs", | ||||
|     srcs = [":package-srcs"], | ||||
|     tags = ["automanaged"], | ||||
|     visibility = ["//visibility:public"], | ||||
| ) | ||||
							
								
								
									
										263
									
								
								vendor/github.com/prometheus/procfs/nfs/nfs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										263
									
								
								vendor/github.com/prometheus/procfs/nfs/nfs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,263 +0,0 @@ | ||||
| // Copyright 2018 The Prometheus Authors | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| // Package nfs implements parsing of /proc/net/rpc/nfsd. | ||||
| // Fields are documented in https://www.svennd.be/nfsd-stats-explained-procnetrpcnfsd/ | ||||
| package nfs | ||||
|  | ||||
| // ReplyCache models the "rc" line. | ||||
| type ReplyCache struct { | ||||
| 	Hits    uint64 | ||||
| 	Misses  uint64 | ||||
| 	NoCache uint64 | ||||
| } | ||||
|  | ||||
| // FileHandles models the "fh" line. | ||||
| type FileHandles struct { | ||||
| 	Stale        uint64 | ||||
| 	TotalLookups uint64 | ||||
| 	AnonLookups  uint64 | ||||
| 	DirNoCache   uint64 | ||||
| 	NoDirNoCache uint64 | ||||
| } | ||||
|  | ||||
| // InputOutput models the "io" line. | ||||
| type InputOutput struct { | ||||
| 	Read  uint64 | ||||
| 	Write uint64 | ||||
| } | ||||
|  | ||||
| // Threads models the "th" line. | ||||
| type Threads struct { | ||||
| 	Threads uint64 | ||||
| 	FullCnt uint64 | ||||
| } | ||||
|  | ||||
| // ReadAheadCache models the "ra" line. | ||||
| type ReadAheadCache struct { | ||||
| 	CacheSize      uint64 | ||||
| 	CacheHistogram []uint64 | ||||
| 	NotFound       uint64 | ||||
| } | ||||
|  | ||||
| // Network models the "net" line. | ||||
| type Network struct { | ||||
| 	NetCount   uint64 | ||||
| 	UDPCount   uint64 | ||||
| 	TCPCount   uint64 | ||||
| 	TCPConnect uint64 | ||||
| } | ||||
|  | ||||
| // ClientRPC models the nfs "rpc" line. | ||||
| type ClientRPC struct { | ||||
| 	RPCCount        uint64 | ||||
| 	Retransmissions uint64 | ||||
| 	AuthRefreshes   uint64 | ||||
| } | ||||
|  | ||||
| // ServerRPC models the nfsd "rpc" line. | ||||
| type ServerRPC struct { | ||||
| 	RPCCount uint64 | ||||
| 	BadCnt   uint64 | ||||
| 	BadFmt   uint64 | ||||
| 	BadAuth  uint64 | ||||
| 	BadcInt  uint64 | ||||
| } | ||||
|  | ||||
| // V2Stats models the "proc2" line. | ||||
| type V2Stats struct { | ||||
| 	Null     uint64 | ||||
| 	GetAttr  uint64 | ||||
| 	SetAttr  uint64 | ||||
| 	Root     uint64 | ||||
| 	Lookup   uint64 | ||||
| 	ReadLink uint64 | ||||
| 	Read     uint64 | ||||
| 	WrCache  uint64 | ||||
| 	Write    uint64 | ||||
| 	Create   uint64 | ||||
| 	Remove   uint64 | ||||
| 	Rename   uint64 | ||||
| 	Link     uint64 | ||||
| 	SymLink  uint64 | ||||
| 	MkDir    uint64 | ||||
| 	RmDir    uint64 | ||||
| 	ReadDir  uint64 | ||||
| 	FsStat   uint64 | ||||
| } | ||||
|  | ||||
| // V3Stats models the "proc3" line. | ||||
| type V3Stats struct { | ||||
| 	Null        uint64 | ||||
| 	GetAttr     uint64 | ||||
| 	SetAttr     uint64 | ||||
| 	Lookup      uint64 | ||||
| 	Access      uint64 | ||||
| 	ReadLink    uint64 | ||||
| 	Read        uint64 | ||||
| 	Write       uint64 | ||||
| 	Create      uint64 | ||||
| 	MkDir       uint64 | ||||
| 	SymLink     uint64 | ||||
| 	MkNod       uint64 | ||||
| 	Remove      uint64 | ||||
| 	RmDir       uint64 | ||||
| 	Rename      uint64 | ||||
| 	Link        uint64 | ||||
| 	ReadDir     uint64 | ||||
| 	ReadDirPlus uint64 | ||||
| 	FsStat      uint64 | ||||
| 	FsInfo      uint64 | ||||
| 	PathConf    uint64 | ||||
| 	Commit      uint64 | ||||
| } | ||||
|  | ||||
| // ClientV4Stats models the nfs "proc4" line. | ||||
| type ClientV4Stats struct { | ||||
| 	Null               uint64 | ||||
| 	Read               uint64 | ||||
| 	Write              uint64 | ||||
| 	Commit             uint64 | ||||
| 	Open               uint64 | ||||
| 	OpenConfirm        uint64 | ||||
| 	OpenNoattr         uint64 | ||||
| 	OpenDowngrade      uint64 | ||||
| 	Close              uint64 | ||||
| 	Setattr            uint64 | ||||
| 	FsInfo             uint64 | ||||
| 	Renew              uint64 | ||||
| 	SetClientID        uint64 | ||||
| 	SetClientIDConfirm uint64 | ||||
| 	Lock               uint64 | ||||
| 	Lockt              uint64 | ||||
| 	Locku              uint64 | ||||
| 	Access             uint64 | ||||
| 	Getattr            uint64 | ||||
| 	Lookup             uint64 | ||||
| 	LookupRoot         uint64 | ||||
| 	Remove             uint64 | ||||
| 	Rename             uint64 | ||||
| 	Link               uint64 | ||||
| 	Symlink            uint64 | ||||
| 	Create             uint64 | ||||
| 	Pathconf           uint64 | ||||
| 	StatFs             uint64 | ||||
| 	ReadLink           uint64 | ||||
| 	ReadDir            uint64 | ||||
| 	ServerCaps         uint64 | ||||
| 	DelegReturn        uint64 | ||||
| 	GetACL             uint64 | ||||
| 	SetACL             uint64 | ||||
| 	FsLocations        uint64 | ||||
| 	ReleaseLockowner   uint64 | ||||
| 	Secinfo            uint64 | ||||
| 	FsidPresent        uint64 | ||||
| 	ExchangeID         uint64 | ||||
| 	CreateSession      uint64 | ||||
| 	DestroySession     uint64 | ||||
| 	Sequence           uint64 | ||||
| 	GetLeaseTime       uint64 | ||||
| 	ReclaimComplete    uint64 | ||||
| 	LayoutGet          uint64 | ||||
| 	GetDeviceInfo      uint64 | ||||
| 	LayoutCommit       uint64 | ||||
| 	LayoutReturn       uint64 | ||||
| 	SecinfoNoName      uint64 | ||||
| 	TestStateID        uint64 | ||||
| 	FreeStateID        uint64 | ||||
| 	GetDeviceList      uint64 | ||||
| 	BindConnToSession  uint64 | ||||
| 	DestroyClientID    uint64 | ||||
| 	Seek               uint64 | ||||
| 	Allocate           uint64 | ||||
| 	DeAllocate         uint64 | ||||
| 	LayoutStats        uint64 | ||||
| 	Clone              uint64 | ||||
| } | ||||
|  | ||||
| // ServerV4Stats models the nfsd "proc4" line. | ||||
| type ServerV4Stats struct { | ||||
| 	Null     uint64 | ||||
| 	Compound uint64 | ||||
| } | ||||
|  | ||||
| // V4Ops models the "proc4ops" line: NFSv4 operations | ||||
| // Variable list, see: | ||||
| // v4.0 https://tools.ietf.org/html/rfc3010 (38 operations) | ||||
| // v4.1 https://tools.ietf.org/html/rfc5661 (58 operations) | ||||
| // v4.2 https://tools.ietf.org/html/draft-ietf-nfsv4-minorversion2-41 (71 operations) | ||||
| type V4Ops struct { | ||||
| 	//Values       uint64 // Variable depending on v4.x sub-version. TODO: Will this always at least include the fields in this struct? | ||||
| 	Op0Unused    uint64 | ||||
| 	Op1Unused    uint64 | ||||
| 	Op2Future    uint64 | ||||
| 	Access       uint64 | ||||
| 	Close        uint64 | ||||
| 	Commit       uint64 | ||||
| 	Create       uint64 | ||||
| 	DelegPurge   uint64 | ||||
| 	DelegReturn  uint64 | ||||
| 	GetAttr      uint64 | ||||
| 	GetFH        uint64 | ||||
| 	Link         uint64 | ||||
| 	Lock         uint64 | ||||
| 	Lockt        uint64 | ||||
| 	Locku        uint64 | ||||
| 	Lookup       uint64 | ||||
| 	LookupRoot   uint64 | ||||
| 	Nverify      uint64 | ||||
| 	Open         uint64 | ||||
| 	OpenAttr     uint64 | ||||
| 	OpenConfirm  uint64 | ||||
| 	OpenDgrd     uint64 | ||||
| 	PutFH        uint64 | ||||
| 	PutPubFH     uint64 | ||||
| 	PutRootFH    uint64 | ||||
| 	Read         uint64 | ||||
| 	ReadDir      uint64 | ||||
| 	ReadLink     uint64 | ||||
| 	Remove       uint64 | ||||
| 	Rename       uint64 | ||||
| 	Renew        uint64 | ||||
| 	RestoreFH    uint64 | ||||
| 	SaveFH       uint64 | ||||
| 	SecInfo      uint64 | ||||
| 	SetAttr      uint64 | ||||
| 	Verify       uint64 | ||||
| 	Write        uint64 | ||||
| 	RelLockOwner uint64 | ||||
| } | ||||
|  | ||||
| // ClientRPCStats models all stats from /proc/net/rpc/nfs. | ||||
| type ClientRPCStats struct { | ||||
| 	Network       Network | ||||
| 	ClientRPC     ClientRPC | ||||
| 	V2Stats       V2Stats | ||||
| 	V3Stats       V3Stats | ||||
| 	ClientV4Stats ClientV4Stats | ||||
| } | ||||
|  | ||||
| // ServerRPCStats models all stats from /proc/net/rpc/nfsd. | ||||
| type ServerRPCStats struct { | ||||
| 	ReplyCache     ReplyCache | ||||
| 	FileHandles    FileHandles | ||||
| 	InputOutput    InputOutput | ||||
| 	Threads        Threads | ||||
| 	ReadAheadCache ReadAheadCache | ||||
| 	Network        Network | ||||
| 	ServerRPC      ServerRPC | ||||
| 	V2Stats        V2Stats | ||||
| 	V3Stats        V3Stats | ||||
| 	ServerV4Stats  ServerV4Stats | ||||
| 	V4Ops          V4Ops | ||||
| } | ||||
							
								
								
									
										317
									
								
								vendor/github.com/prometheus/procfs/nfs/parse.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										317
									
								
								vendor/github.com/prometheus/procfs/nfs/parse.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,317 +0,0 @@ | ||||
| // Copyright 2018 The Prometheus Authors | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| package nfs | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| ) | ||||
|  | ||||
| func parseReplyCache(v []uint64) (ReplyCache, error) { | ||||
| 	if len(v) != 3 { | ||||
| 		return ReplyCache{}, fmt.Errorf("invalid ReplyCache line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	return ReplyCache{ | ||||
| 		Hits:    v[0], | ||||
| 		Misses:  v[1], | ||||
| 		NoCache: v[2], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func parseFileHandles(v []uint64) (FileHandles, error) { | ||||
| 	if len(v) != 5 { | ||||
| 		return FileHandles{}, fmt.Errorf("invalid FileHandles, line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	return FileHandles{ | ||||
| 		Stale:        v[0], | ||||
| 		TotalLookups: v[1], | ||||
| 		AnonLookups:  v[2], | ||||
| 		DirNoCache:   v[3], | ||||
| 		NoDirNoCache: v[4], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func parseInputOutput(v []uint64) (InputOutput, error) { | ||||
| 	if len(v) != 2 { | ||||
| 		return InputOutput{}, fmt.Errorf("invalid InputOutput line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	return InputOutput{ | ||||
| 		Read:  v[0], | ||||
| 		Write: v[1], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func parseThreads(v []uint64) (Threads, error) { | ||||
| 	if len(v) != 2 { | ||||
| 		return Threads{}, fmt.Errorf("invalid Threads line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	return Threads{ | ||||
| 		Threads: v[0], | ||||
| 		FullCnt: v[1], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func parseReadAheadCache(v []uint64) (ReadAheadCache, error) { | ||||
| 	if len(v) != 12 { | ||||
| 		return ReadAheadCache{}, fmt.Errorf("invalid ReadAheadCache line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	return ReadAheadCache{ | ||||
| 		CacheSize:      v[0], | ||||
| 		CacheHistogram: v[1:11], | ||||
| 		NotFound:       v[11], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func parseNetwork(v []uint64) (Network, error) { | ||||
| 	if len(v) != 4 { | ||||
| 		return Network{}, fmt.Errorf("invalid Network line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	return Network{ | ||||
| 		NetCount:   v[0], | ||||
| 		UDPCount:   v[1], | ||||
| 		TCPCount:   v[2], | ||||
| 		TCPConnect: v[3], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func parseServerRPC(v []uint64) (ServerRPC, error) { | ||||
| 	if len(v) != 5 { | ||||
| 		return ServerRPC{}, fmt.Errorf("invalid RPC line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	return ServerRPC{ | ||||
| 		RPCCount: v[0], | ||||
| 		BadCnt:   v[1], | ||||
| 		BadFmt:   v[2], | ||||
| 		BadAuth:  v[3], | ||||
| 		BadcInt:  v[4], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func parseClientRPC(v []uint64) (ClientRPC, error) { | ||||
| 	if len(v) != 3 { | ||||
| 		return ClientRPC{}, fmt.Errorf("invalid RPC line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	return ClientRPC{ | ||||
| 		RPCCount:        v[0], | ||||
| 		Retransmissions: v[1], | ||||
| 		AuthRefreshes:   v[2], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func parseV2Stats(v []uint64) (V2Stats, error) { | ||||
| 	values := int(v[0]) | ||||
| 	if len(v[1:]) != values || values != 18 { | ||||
| 		return V2Stats{}, fmt.Errorf("invalid V2Stats line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	return V2Stats{ | ||||
| 		Null:     v[1], | ||||
| 		GetAttr:  v[2], | ||||
| 		SetAttr:  v[3], | ||||
| 		Root:     v[4], | ||||
| 		Lookup:   v[5], | ||||
| 		ReadLink: v[6], | ||||
| 		Read:     v[7], | ||||
| 		WrCache:  v[8], | ||||
| 		Write:    v[9], | ||||
| 		Create:   v[10], | ||||
| 		Remove:   v[11], | ||||
| 		Rename:   v[12], | ||||
| 		Link:     v[13], | ||||
| 		SymLink:  v[14], | ||||
| 		MkDir:    v[15], | ||||
| 		RmDir:    v[16], | ||||
| 		ReadDir:  v[17], | ||||
| 		FsStat:   v[18], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func parseV3Stats(v []uint64) (V3Stats, error) { | ||||
| 	values := int(v[0]) | ||||
| 	if len(v[1:]) != values || values != 22 { | ||||
| 		return V3Stats{}, fmt.Errorf("invalid V3Stats line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	return V3Stats{ | ||||
| 		Null:        v[1], | ||||
| 		GetAttr:     v[2], | ||||
| 		SetAttr:     v[3], | ||||
| 		Lookup:      v[4], | ||||
| 		Access:      v[5], | ||||
| 		ReadLink:    v[6], | ||||
| 		Read:        v[7], | ||||
| 		Write:       v[8], | ||||
| 		Create:      v[9], | ||||
| 		MkDir:       v[10], | ||||
| 		SymLink:     v[11], | ||||
| 		MkNod:       v[12], | ||||
| 		Remove:      v[13], | ||||
| 		RmDir:       v[14], | ||||
| 		Rename:      v[15], | ||||
| 		Link:        v[16], | ||||
| 		ReadDir:     v[17], | ||||
| 		ReadDirPlus: v[18], | ||||
| 		FsStat:      v[19], | ||||
| 		FsInfo:      v[20], | ||||
| 		PathConf:    v[21], | ||||
| 		Commit:      v[22], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func parseClientV4Stats(v []uint64) (ClientV4Stats, error) { | ||||
| 	values := int(v[0]) | ||||
| 	if len(v[1:]) != values { | ||||
| 		return ClientV4Stats{}, fmt.Errorf("invalid ClientV4Stats line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	// This function currently supports mapping 59 NFS v4 client stats.  Older | ||||
| 	// kernels may emit fewer stats, so we must detect this and pad out the | ||||
| 	// values to match the expected slice size. | ||||
| 	if values < 59 { | ||||
| 		newValues := make([]uint64, 60) | ||||
| 		copy(newValues, v) | ||||
| 		v = newValues | ||||
| 	} | ||||
|  | ||||
| 	return ClientV4Stats{ | ||||
| 		Null:               v[1], | ||||
| 		Read:               v[2], | ||||
| 		Write:              v[3], | ||||
| 		Commit:             v[4], | ||||
| 		Open:               v[5], | ||||
| 		OpenConfirm:        v[6], | ||||
| 		OpenNoattr:         v[7], | ||||
| 		OpenDowngrade:      v[8], | ||||
| 		Close:              v[9], | ||||
| 		Setattr:            v[10], | ||||
| 		FsInfo:             v[11], | ||||
| 		Renew:              v[12], | ||||
| 		SetClientID:        v[13], | ||||
| 		SetClientIDConfirm: v[14], | ||||
| 		Lock:               v[15], | ||||
| 		Lockt:              v[16], | ||||
| 		Locku:              v[17], | ||||
| 		Access:             v[18], | ||||
| 		Getattr:            v[19], | ||||
| 		Lookup:             v[20], | ||||
| 		LookupRoot:         v[21], | ||||
| 		Remove:             v[22], | ||||
| 		Rename:             v[23], | ||||
| 		Link:               v[24], | ||||
| 		Symlink:            v[25], | ||||
| 		Create:             v[26], | ||||
| 		Pathconf:           v[27], | ||||
| 		StatFs:             v[28], | ||||
| 		ReadLink:           v[29], | ||||
| 		ReadDir:            v[30], | ||||
| 		ServerCaps:         v[31], | ||||
| 		DelegReturn:        v[32], | ||||
| 		GetACL:             v[33], | ||||
| 		SetACL:             v[34], | ||||
| 		FsLocations:        v[35], | ||||
| 		ReleaseLockowner:   v[36], | ||||
| 		Secinfo:            v[37], | ||||
| 		FsidPresent:        v[38], | ||||
| 		ExchangeID:         v[39], | ||||
| 		CreateSession:      v[40], | ||||
| 		DestroySession:     v[41], | ||||
| 		Sequence:           v[42], | ||||
| 		GetLeaseTime:       v[43], | ||||
| 		ReclaimComplete:    v[44], | ||||
| 		LayoutGet:          v[45], | ||||
| 		GetDeviceInfo:      v[46], | ||||
| 		LayoutCommit:       v[47], | ||||
| 		LayoutReturn:       v[48], | ||||
| 		SecinfoNoName:      v[49], | ||||
| 		TestStateID:        v[50], | ||||
| 		FreeStateID:        v[51], | ||||
| 		GetDeviceList:      v[52], | ||||
| 		BindConnToSession:  v[53], | ||||
| 		DestroyClientID:    v[54], | ||||
| 		Seek:               v[55], | ||||
| 		Allocate:           v[56], | ||||
| 		DeAllocate:         v[57], | ||||
| 		LayoutStats:        v[58], | ||||
| 		Clone:              v[59], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func parseServerV4Stats(v []uint64) (ServerV4Stats, error) { | ||||
| 	values := int(v[0]) | ||||
| 	if len(v[1:]) != values || values != 2 { | ||||
| 		return ServerV4Stats{}, fmt.Errorf("invalid V4Stats line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	return ServerV4Stats{ | ||||
| 		Null:     v[1], | ||||
| 		Compound: v[2], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func parseV4Ops(v []uint64) (V4Ops, error) { | ||||
| 	values := int(v[0]) | ||||
| 	if len(v[1:]) != values || values < 39 { | ||||
| 		return V4Ops{}, fmt.Errorf("invalid V4Ops line %q", v) | ||||
| 	} | ||||
|  | ||||
| 	stats := V4Ops{ | ||||
| 		Op0Unused:    v[1], | ||||
| 		Op1Unused:    v[2], | ||||
| 		Op2Future:    v[3], | ||||
| 		Access:       v[4], | ||||
| 		Close:        v[5], | ||||
| 		Commit:       v[6], | ||||
| 		Create:       v[7], | ||||
| 		DelegPurge:   v[8], | ||||
| 		DelegReturn:  v[9], | ||||
| 		GetAttr:      v[10], | ||||
| 		GetFH:        v[11], | ||||
| 		Link:         v[12], | ||||
| 		Lock:         v[13], | ||||
| 		Lockt:        v[14], | ||||
| 		Locku:        v[15], | ||||
| 		Lookup:       v[16], | ||||
| 		LookupRoot:   v[17], | ||||
| 		Nverify:      v[18], | ||||
| 		Open:         v[19], | ||||
| 		OpenAttr:     v[20], | ||||
| 		OpenConfirm:  v[21], | ||||
| 		OpenDgrd:     v[22], | ||||
| 		PutFH:        v[23], | ||||
| 		PutPubFH:     v[24], | ||||
| 		PutRootFH:    v[25], | ||||
| 		Read:         v[26], | ||||
| 		ReadDir:      v[27], | ||||
| 		ReadLink:     v[28], | ||||
| 		Remove:       v[29], | ||||
| 		Rename:       v[30], | ||||
| 		Renew:        v[31], | ||||
| 		RestoreFH:    v[32], | ||||
| 		SaveFH:       v[33], | ||||
| 		SecInfo:      v[34], | ||||
| 		SetAttr:      v[35], | ||||
| 		Verify:       v[36], | ||||
| 		Write:        v[37], | ||||
| 		RelLockOwner: v[38], | ||||
| 	} | ||||
|  | ||||
| 	return stats, nil | ||||
| } | ||||
							
								
								
									
										67
									
								
								vendor/github.com/prometheus/procfs/nfs/parse_nfs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										67
									
								
								vendor/github.com/prometheus/procfs/nfs/parse_nfs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,67 +0,0 @@ | ||||
| // Copyright 2018 The Prometheus Authors | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| package nfs | ||||
|  | ||||
| import ( | ||||
| 	"bufio" | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/prometheus/procfs/internal/util" | ||||
| ) | ||||
|  | ||||
| // ParseClientRPCStats returns stats read from /proc/net/rpc/nfs | ||||
| func ParseClientRPCStats(r io.Reader) (*ClientRPCStats, error) { | ||||
| 	stats := &ClientRPCStats{} | ||||
|  | ||||
| 	scanner := bufio.NewScanner(r) | ||||
| 	for scanner.Scan() { | ||||
| 		line := scanner.Text() | ||||
| 		parts := strings.Fields(scanner.Text()) | ||||
| 		// require at least <key> <value> | ||||
| 		if len(parts) < 2 { | ||||
| 			return nil, fmt.Errorf("invalid NFS metric line %q", line) | ||||
| 		} | ||||
|  | ||||
| 		values, err := util.ParseUint64s(parts[1:]) | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("error parsing NFS metric line: %s", err) | ||||
| 		} | ||||
|  | ||||
| 		switch metricLine := parts[0]; metricLine { | ||||
| 		case "net": | ||||
| 			stats.Network, err = parseNetwork(values) | ||||
| 		case "rpc": | ||||
| 			stats.ClientRPC, err = parseClientRPC(values) | ||||
| 		case "proc2": | ||||
| 			stats.V2Stats, err = parseV2Stats(values) | ||||
| 		case "proc3": | ||||
| 			stats.V3Stats, err = parseV3Stats(values) | ||||
| 		case "proc4": | ||||
| 			stats.ClientV4Stats, err = parseClientV4Stats(values) | ||||
| 		default: | ||||
| 			return nil, fmt.Errorf("unknown NFS metric line %q", metricLine) | ||||
| 		} | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("errors parsing NFS metric line: %s", err) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if err := scanner.Err(); err != nil { | ||||
| 		return nil, fmt.Errorf("error scanning NFS file: %s", err) | ||||
| 	} | ||||
|  | ||||
| 	return stats, nil | ||||
| } | ||||
							
								
								
									
										89
									
								
								vendor/github.com/prometheus/procfs/nfs/parse_nfsd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										89
									
								
								vendor/github.com/prometheus/procfs/nfs/parse_nfsd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,89 +0,0 @@ | ||||
| // Copyright 2018 The Prometheus Authors | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| package nfs | ||||
|  | ||||
| import ( | ||||
| 	"bufio" | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/prometheus/procfs/internal/util" | ||||
| ) | ||||
|  | ||||
| // ParseServerRPCStats returns stats read from /proc/net/rpc/nfsd | ||||
| func ParseServerRPCStats(r io.Reader) (*ServerRPCStats, error) { | ||||
| 	stats := &ServerRPCStats{} | ||||
|  | ||||
| 	scanner := bufio.NewScanner(r) | ||||
| 	for scanner.Scan() { | ||||
| 		line := scanner.Text() | ||||
| 		parts := strings.Fields(scanner.Text()) | ||||
| 		// require at least <key> <value> | ||||
| 		if len(parts) < 2 { | ||||
| 			return nil, fmt.Errorf("invalid NFSd metric line %q", line) | ||||
| 		} | ||||
| 		label := parts[0] | ||||
|  | ||||
| 		var values []uint64 | ||||
| 		var err error | ||||
| 		if label == "th" { | ||||
| 			if len(parts) < 3 { | ||||
| 				return nil, fmt.Errorf("invalid NFSd th metric line %q", line) | ||||
| 			} | ||||
| 			values, err = util.ParseUint64s(parts[1:3]) | ||||
| 		} else { | ||||
| 			values, err = util.ParseUint64s(parts[1:]) | ||||
| 		} | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("error parsing NFSd metric line: %s", err) | ||||
| 		} | ||||
|  | ||||
| 		switch metricLine := parts[0]; metricLine { | ||||
| 		case "rc": | ||||
| 			stats.ReplyCache, err = parseReplyCache(values) | ||||
| 		case "fh": | ||||
| 			stats.FileHandles, err = parseFileHandles(values) | ||||
| 		case "io": | ||||
| 			stats.InputOutput, err = parseInputOutput(values) | ||||
| 		case "th": | ||||
| 			stats.Threads, err = parseThreads(values) | ||||
| 		case "ra": | ||||
| 			stats.ReadAheadCache, err = parseReadAheadCache(values) | ||||
| 		case "net": | ||||
| 			stats.Network, err = parseNetwork(values) | ||||
| 		case "rpc": | ||||
| 			stats.ServerRPC, err = parseServerRPC(values) | ||||
| 		case "proc2": | ||||
| 			stats.V2Stats, err = parseV2Stats(values) | ||||
| 		case "proc3": | ||||
| 			stats.V3Stats, err = parseV3Stats(values) | ||||
| 		case "proc4": | ||||
| 			stats.ServerV4Stats, err = parseServerV4Stats(values) | ||||
| 		case "proc4ops": | ||||
| 			stats.V4Ops, err = parseV4Ops(values) | ||||
| 		default: | ||||
| 			return nil, fmt.Errorf("unknown NFSd metric line %q", metricLine) | ||||
| 		} | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("errors parsing NFSd metric line: %s", err) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if err := scanner.Err(); err != nil { | ||||
| 		return nil, fmt.Errorf("error scanning NFSd file: %s", err) | ||||
| 	} | ||||
|  | ||||
| 	return stats, nil | ||||
| } | ||||
							
								
								
									
										27
									
								
								vendor/github.com/prometheus/procfs/proc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								vendor/github.com/prometheus/procfs/proc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -20,6 +20,8 @@ import ( | ||||
| 	"os" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/prometheus/procfs/internal/fs" | ||||
| ) | ||||
|  | ||||
| // Proc provides information about a running process. | ||||
| @@ -27,7 +29,7 @@ type Proc struct { | ||||
| 	// The process ID. | ||||
| 	PID int | ||||
|  | ||||
| 	fs FS | ||||
| 	fs fs.FS | ||||
| } | ||||
|  | ||||
| // Procs represents a list of Proc structs. | ||||
| @@ -52,7 +54,7 @@ func NewProc(pid int) (Proc, error) { | ||||
| 	if err != nil { | ||||
| 		return Proc{}, err | ||||
| 	} | ||||
| 	return fs.NewProc(pid) | ||||
| 	return fs.Proc(pid) | ||||
| } | ||||
|  | ||||
| // AllProcs returns a list of all currently available processes under /proc. | ||||
| @@ -66,28 +68,35 @@ func AllProcs() (Procs, error) { | ||||
|  | ||||
| // Self returns a process for the current process. | ||||
| func (fs FS) Self() (Proc, error) { | ||||
| 	p, err := os.Readlink(fs.Path("self")) | ||||
| 	p, err := os.Readlink(fs.proc.Path("self")) | ||||
| 	if err != nil { | ||||
| 		return Proc{}, err | ||||
| 	} | ||||
| 	pid, err := strconv.Atoi(strings.Replace(p, string(fs), "", -1)) | ||||
| 	pid, err := strconv.Atoi(strings.Replace(p, string(fs.proc), "", -1)) | ||||
| 	if err != nil { | ||||
| 		return Proc{}, err | ||||
| 	} | ||||
| 	return fs.NewProc(pid) | ||||
| 	return fs.Proc(pid) | ||||
| } | ||||
|  | ||||
| // NewProc returns a process for the given pid. | ||||
| // | ||||
| // Deprecated: use fs.Proc() instead | ||||
| func (fs FS) NewProc(pid int) (Proc, error) { | ||||
| 	if _, err := os.Stat(fs.Path(strconv.Itoa(pid))); err != nil { | ||||
| 	return fs.Proc(pid) | ||||
| } | ||||
|  | ||||
| // Proc returns a process for the given pid. | ||||
| func (fs FS) Proc(pid int) (Proc, error) { | ||||
| 	if _, err := os.Stat(fs.proc.Path(strconv.Itoa(pid))); err != nil { | ||||
| 		return Proc{}, err | ||||
| 	} | ||||
| 	return Proc{PID: pid, fs: fs}, nil | ||||
| 	return Proc{PID: pid, fs: fs.proc}, nil | ||||
| } | ||||
|  | ||||
| // AllProcs returns a list of all currently available processes. | ||||
| func (fs FS) AllProcs() (Procs, error) { | ||||
| 	d, err := os.Open(fs.Path()) | ||||
| 	d, err := os.Open(fs.proc.Path()) | ||||
| 	if err != nil { | ||||
| 		return Procs{}, err | ||||
| 	} | ||||
| @@ -104,7 +113,7 @@ func (fs FS) AllProcs() (Procs, error) { | ||||
| 		if err != nil { | ||||
| 			continue | ||||
| 		} | ||||
| 		p = append(p, Proc{PID: int(pid), fs: fs}) | ||||
| 		p = append(p, Proc{PID: int(pid), fs: fs.proc}) | ||||
| 	} | ||||
|  | ||||
| 	return p, nil | ||||
|   | ||||
							
								
								
									
										4
									
								
								vendor/github.com/prometheus/procfs/proc_io.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/prometheus/procfs/proc_io.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -39,8 +39,8 @@ type ProcIO struct { | ||||
| 	CancelledWriteBytes int64 | ||||
| } | ||||
|  | ||||
| // NewIO creates a new ProcIO instance from a given Proc instance. | ||||
| func (p Proc) NewIO() (ProcIO, error) { | ||||
| // IO creates a new ProcIO instance from a given Proc instance. | ||||
| func (p Proc) IO() (ProcIO, error) { | ||||
| 	pio := ProcIO{} | ||||
|  | ||||
| 	f, err := os.Open(p.path("io")) | ||||
|   | ||||
							
								
								
									
										7
									
								
								vendor/github.com/prometheus/procfs/proc_limits.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/github.com/prometheus/procfs/proc_limits.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -78,7 +78,14 @@ var ( | ||||
| ) | ||||
|  | ||||
| // NewLimits returns the current soft limits of the process. | ||||
| // | ||||
| // Deprecated: use p.Limits() instead | ||||
| func (p Proc) NewLimits() (ProcLimits, error) { | ||||
| 	return p.Limits() | ||||
| } | ||||
|  | ||||
| // Limits returns the current soft limits of the process. | ||||
| func (p Proc) Limits() (ProcLimits, error) { | ||||
| 	f, err := os.Open(p.path("limits")) | ||||
| 	if err != nil { | ||||
| 		return ProcLimits{}, err | ||||
|   | ||||
							
								
								
									
										4
									
								
								vendor/github.com/prometheus/procfs/proc_ns.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/prometheus/procfs/proc_ns.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -29,9 +29,9 @@ type Namespace struct { | ||||
| // Namespaces contains all of the namespaces that the process is contained in. | ||||
| type Namespaces map[string]Namespace | ||||
|  | ||||
| // NewNamespaces reads from /proc/[pid/ns/* to get the namespaces of which the | ||||
| // Namespaces reads from /proc/<pid>/ns/* to get the namespaces of which the | ||||
| // process is a member. | ||||
| func (p Proc) NewNamespaces() (Namespaces, error) { | ||||
| func (p Proc) Namespaces() (Namespaces, error) { | ||||
| 	d, err := os.Open(p.path("ns")) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
|   | ||||
							
								
								
									
										101
									
								
								vendor/github.com/prometheus/procfs/proc_psi.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								vendor/github.com/prometheus/procfs/proc_psi.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,101 @@ | ||||
| // Copyright 2019 The Prometheus Authors | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| package procfs | ||||
|  | ||||
| // The PSI / pressure interface is described at | ||||
| //   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/accounting/psi.txt | ||||
| // Each resource (cpu, io, memory, ...) is exposed as a single file. | ||||
| // Each file may contain up to two lines, one for "some" pressure and one for "full" pressure. | ||||
| // Each line contains several averages (over n seconds) and a total in µs. | ||||
| // | ||||
| // Example io pressure file: | ||||
| // > some avg10=0.06 avg60=0.21 avg300=0.99 total=8537362 | ||||
| // > full avg10=0.00 avg60=0.13 avg300=0.96 total=8183134 | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"io/ioutil" | ||||
| 	"os" | ||||
| 	"strings" | ||||
| ) | ||||
|  | ||||
| const lineFormat = "avg10=%f avg60=%f avg300=%f total=%d" | ||||
|  | ||||
| // PSILine is a single line of values as returned by /proc/pressure/* | ||||
| // The Avg entries are averages over n seconds, as a percentage | ||||
| // The Total line is in microseconds | ||||
| type PSILine struct { | ||||
| 	Avg10  float64 | ||||
| 	Avg60  float64 | ||||
| 	Avg300 float64 | ||||
| 	Total  uint64 | ||||
| } | ||||
|  | ||||
| // PSIStats represent pressure stall information from /proc/pressure/* | ||||
| // Some indicates the share of time in which at least some tasks are stalled | ||||
| // Full indicates the share of time in which all non-idle tasks are stalled simultaneously | ||||
| type PSIStats struct { | ||||
| 	Some *PSILine | ||||
| 	Full *PSILine | ||||
| } | ||||
|  | ||||
| // PSIStatsForResource reads pressure stall information for the specified | ||||
| // resource from /proc/pressure/<resource>. At time of writing this can be | ||||
| // either "cpu", "memory" or "io". | ||||
| func (fs FS) PSIStatsForResource(resource string) (PSIStats, error) { | ||||
| 	file, err := os.Open(fs.proc.Path(fmt.Sprintf("%s/%s", "pressure", resource))) | ||||
| 	if err != nil { | ||||
| 		return PSIStats{}, fmt.Errorf("psi_stats: unavailable for %s", resource) | ||||
| 	} | ||||
|  | ||||
| 	defer file.Close() | ||||
| 	return parsePSIStats(resource, file) | ||||
| } | ||||
|  | ||||
| // parsePSIStats parses the specified file for pressure stall information | ||||
| func parsePSIStats(resource string, file io.Reader) (PSIStats, error) { | ||||
| 	psiStats := PSIStats{} | ||||
| 	stats, err := ioutil.ReadAll(file) | ||||
| 	if err != nil { | ||||
| 		return psiStats, fmt.Errorf("psi_stats: unable to read data for %s", resource) | ||||
| 	} | ||||
|  | ||||
| 	for _, l := range strings.Split(string(stats), "\n") { | ||||
| 		prefix := strings.Split(l, " ")[0] | ||||
| 		switch prefix { | ||||
| 		case "some": | ||||
| 			psi := PSILine{} | ||||
| 			_, err := fmt.Sscanf(l, fmt.Sprintf("some %s", lineFormat), &psi.Avg10, &psi.Avg60, &psi.Avg300, &psi.Total) | ||||
| 			if err != nil { | ||||
| 				return PSIStats{}, err | ||||
| 			} | ||||
| 			psiStats.Some = &psi | ||||
| 		case "full": | ||||
| 			psi := PSILine{} | ||||
| 			_, err := fmt.Sscanf(l, fmt.Sprintf("full %s", lineFormat), &psi.Avg10, &psi.Avg60, &psi.Avg300, &psi.Total) | ||||
| 			if err != nil { | ||||
| 				return PSIStats{}, err | ||||
| 			} | ||||
| 			psiStats.Full = &psi | ||||
| 		default: | ||||
| 			// If we encounter a line with an unknown prefix, ignore it and move on | ||||
| 			// Should new measurement types be added in the future we'll simply ignore them instead | ||||
| 			// of erroring on retrieval | ||||
| 			continue | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	return psiStats, nil | ||||
| } | ||||
							
								
								
									
										20
									
								
								vendor/github.com/prometheus/procfs/proc_stat.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								vendor/github.com/prometheus/procfs/proc_stat.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -18,6 +18,8 @@ import ( | ||||
| 	"fmt" | ||||
| 	"io/ioutil" | ||||
| 	"os" | ||||
|  | ||||
| 	"github.com/prometheus/procfs/internal/fs" | ||||
| ) | ||||
|  | ||||
| // Originally, this USER_HZ value was dynamically retrieved via a sysconf call | ||||
| @@ -95,15 +97,22 @@ type ProcStat struct { | ||||
| 	// in clock ticks. | ||||
| 	Starttime uint64 | ||||
| 	// Virtual memory size in bytes. | ||||
| 	VSize int | ||||
| 	VSize uint | ||||
| 	// Resident set size in pages. | ||||
| 	RSS int | ||||
|  | ||||
| 	fs FS | ||||
| 	proc fs.FS | ||||
| } | ||||
|  | ||||
| // NewStat returns the current status information of the process. | ||||
| // | ||||
| // Deprecated: use NewStat() instead | ||||
| func (p Proc) NewStat() (ProcStat, error) { | ||||
| 	return p.Stat() | ||||
| } | ||||
|  | ||||
| // Stat returns the current status information of the process. | ||||
| func (p Proc) Stat() (ProcStat, error) { | ||||
| 	f, err := os.Open(p.path("stat")) | ||||
| 	if err != nil { | ||||
| 		return ProcStat{}, err | ||||
| @@ -118,7 +127,7 @@ func (p Proc) NewStat() (ProcStat, error) { | ||||
| 	var ( | ||||
| 		ignore int | ||||
|  | ||||
| 		s = ProcStat{PID: p.PID, fs: p.fs} | ||||
| 		s = ProcStat{PID: p.PID, proc: p.fs} | ||||
| 		l = bytes.Index(data, []byte("(")) | ||||
| 		r = bytes.LastIndex(data, []byte(")")) | ||||
| 	) | ||||
| @@ -164,7 +173,7 @@ func (p Proc) NewStat() (ProcStat, error) { | ||||
| } | ||||
|  | ||||
| // VirtualMemory returns the virtual memory size in bytes. | ||||
| func (s ProcStat) VirtualMemory() int { | ||||
| func (s ProcStat) VirtualMemory() uint { | ||||
| 	return s.VSize | ||||
| } | ||||
|  | ||||
| @@ -175,7 +184,8 @@ func (s ProcStat) ResidentMemory() int { | ||||
|  | ||||
| // StartTime returns the unix timestamp of the process in seconds. | ||||
| func (s ProcStat) StartTime() (float64, error) { | ||||
| 	stat, err := s.fs.NewStat() | ||||
| 	fs := FS{proc: s.proc} | ||||
| 	stat, err := fs.Stat() | ||||
| 	if err != nil { | ||||
| 		return 0, err | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										162
									
								
								vendor/github.com/prometheus/procfs/proc_status.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										162
									
								
								vendor/github.com/prometheus/procfs/proc_status.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,162 @@ | ||||
| // Copyright 2018 The Prometheus Authors | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| package procfs | ||||
|  | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"io/ioutil" | ||||
| 	"os" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| ) | ||||
|  | ||||
| // ProcStat provides status information about the process, | ||||
| // read from /proc/[pid]/stat. | ||||
| type ProcStatus struct { | ||||
| 	// The process ID. | ||||
| 	PID int | ||||
| 	// The process name. | ||||
| 	Name string | ||||
|  | ||||
| 	// Peak virtual memory size. | ||||
| 	VmPeak uint64 | ||||
| 	// Virtual memory size. | ||||
| 	VmSize uint64 | ||||
| 	// Locked memory size. | ||||
| 	VmLck uint64 | ||||
| 	// Pinned memory size. | ||||
| 	VmPin uint64 | ||||
| 	// Peak resident set size. | ||||
| 	VmHWM uint64 | ||||
| 	// Resident set size (sum of RssAnnon RssFile and RssShmem). | ||||
| 	VmRSS uint64 | ||||
| 	// Size of resident anonymous memory. | ||||
| 	RssAnon uint64 | ||||
| 	// Size of resident file mappings. | ||||
| 	RssFile uint64 | ||||
| 	// Size of resident shared memory. | ||||
| 	RssShmem uint64 | ||||
| 	// Size of data segments. | ||||
| 	VmData uint64 | ||||
| 	// Size of stack segments. | ||||
| 	VmStk uint64 | ||||
| 	// Size of text segments. | ||||
| 	VmExe uint64 | ||||
| 	// Shared library code size. | ||||
| 	VmLib uint64 | ||||
| 	// Page table entries size. | ||||
| 	VmPTE uint64 | ||||
| 	// Size of second-level page tables. | ||||
| 	VmPMD uint64 | ||||
| 	// Swapped-out virtual memory size by anonymous private. | ||||
| 	VmSwap uint64 | ||||
| 	// Size of hugetlb memory portions | ||||
| 	HugetlbPages uint64 | ||||
|  | ||||
| 	// Number of voluntary context switches. | ||||
| 	VoluntaryCtxtSwitches uint64 | ||||
| 	// Number of involuntary context switches. | ||||
| 	NonVoluntaryCtxtSwitches uint64 | ||||
| } | ||||
|  | ||||
| // NewStatus returns the current status information of the process. | ||||
| func (p Proc) NewStatus() (ProcStatus, error) { | ||||
| 	f, err := os.Open(p.path("status")) | ||||
| 	if err != nil { | ||||
| 		return ProcStatus{}, err | ||||
| 	} | ||||
| 	defer f.Close() | ||||
|  | ||||
| 	data, err := ioutil.ReadAll(f) | ||||
| 	if err != nil { | ||||
| 		return ProcStatus{}, err | ||||
| 	} | ||||
|  | ||||
| 	s := ProcStatus{PID: p.PID} | ||||
|  | ||||
| 	lines := strings.Split(string(data), "\n") | ||||
| 	for _, line := range lines { | ||||
| 		if !bytes.Contains([]byte(line), []byte(":")) { | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		kv := strings.SplitN(line, ":", 2) | ||||
|  | ||||
| 		// removes spaces | ||||
| 		k := string(strings.TrimSpace(kv[0])) | ||||
| 		v := string(strings.TrimSpace(kv[1])) | ||||
| 		// removes "kB" | ||||
| 		v = string(bytes.Trim([]byte(v), " kB")) | ||||
|  | ||||
| 		// value to int when possible | ||||
| 		// we can skip error check here, 'cause vKBytes is not used when value is a string | ||||
| 		vKBytes, _ := strconv.ParseUint(v, 10, 64) | ||||
| 		// convert kB to B | ||||
| 		vBytes := vKBytes * 1024 | ||||
|  | ||||
| 		s.fillStatus(k, v, vKBytes, vBytes) | ||||
| 	} | ||||
|  | ||||
| 	return s, nil | ||||
| } | ||||
|  | ||||
| func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintBytes uint64) { | ||||
| 	switch k { | ||||
| 	case "Name": | ||||
| 		s.Name = vString | ||||
| 	case "VmPeak": | ||||
| 		s.VmPeak = vUintBytes | ||||
| 	case "VmSize": | ||||
| 		s.VmSize = vUintBytes | ||||
| 	case "VmLck": | ||||
| 		s.VmLck = vUintBytes | ||||
| 	case "VmPin": | ||||
| 		s.VmPin = vUintBytes | ||||
| 	case "VmHWM": | ||||
| 		s.VmHWM = vUintBytes | ||||
| 	case "VmRSS": | ||||
| 		s.VmRSS = vUintBytes | ||||
| 	case "RssAnon": | ||||
| 		s.RssAnon = vUintBytes | ||||
| 	case "RssFile": | ||||
| 		s.RssFile = vUintBytes | ||||
| 	case "RssShmem": | ||||
| 		s.RssShmem = vUintBytes | ||||
| 	case "VmData": | ||||
| 		s.VmData = vUintBytes | ||||
| 	case "VmStk": | ||||
| 		s.VmStk = vUintBytes | ||||
| 	case "VmExe": | ||||
| 		s.VmExe = vUintBytes | ||||
| 	case "VmLib": | ||||
| 		s.VmLib = vUintBytes | ||||
| 	case "VmPTE": | ||||
| 		s.VmPTE = vUintBytes | ||||
| 	case "VmPMD": | ||||
| 		s.VmPMD = vUintBytes | ||||
| 	case "VmSwap": | ||||
| 		s.VmSwap = vUintBytes | ||||
| 	case "HugetlbPages": | ||||
| 		s.HugetlbPages = vUintBytes | ||||
| 	case "voluntary_ctxt_switches": | ||||
| 		s.VoluntaryCtxtSwitches = vUint | ||||
| 	case "nonvoluntary_ctxt_switches": | ||||
| 		s.NonVoluntaryCtxtSwitches = vUint | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // TotalCtxtSwitches returns the total context switch. | ||||
| func (s ProcStatus) TotalCtxtSwitches() uint64 { | ||||
| 	return s.VoluntaryCtxtSwitches + s.NonVoluntaryCtxtSwitches | ||||
| } | ||||
							
								
								
									
										38
									
								
								vendor/github.com/prometheus/procfs/stat.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										38
									
								
								vendor/github.com/prometheus/procfs/stat.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -20,6 +20,8 @@ import ( | ||||
| 	"os" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/prometheus/procfs/internal/fs" | ||||
| ) | ||||
|  | ||||
| // CPUStat shows how much time the cpu spend in various stages. | ||||
| @@ -78,16 +80,6 @@ type Stat struct { | ||||
| 	SoftIRQ SoftIRQStat | ||||
| } | ||||
|  | ||||
| // NewStat returns kernel/system statistics read from /proc/stat. | ||||
| func NewStat() (Stat, error) { | ||||
| 	fs, err := NewFS(DefaultMountPoint) | ||||
| 	if err != nil { | ||||
| 		return Stat{}, err | ||||
| 	} | ||||
|  | ||||
| 	return fs.NewStat() | ||||
| } | ||||
|  | ||||
| // Parse a cpu statistics line and returns the CPUStat struct plus the cpu id (or -1 for the overall sum). | ||||
| func parseCPUStat(line string) (CPUStat, int64, error) { | ||||
| 	cpuStat := CPUStat{} | ||||
| @@ -149,11 +141,31 @@ func parseSoftIRQStat(line string) (SoftIRQStat, uint64, error) { | ||||
| 	return softIRQStat, total, nil | ||||
| } | ||||
|  | ||||
| // NewStat returns an information about current kernel/system statistics. | ||||
| func (fs FS) NewStat() (Stat, error) { | ||||
| // NewStat returns information about current cpu/process statistics. | ||||
| // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt | ||||
| // | ||||
| // Deprecated: use fs.Stat() instead | ||||
| func NewStat() (Stat, error) { | ||||
| 	fs, err := NewFS(fs.DefaultProcMountPoint) | ||||
| 	if err != nil { | ||||
| 		return Stat{}, err | ||||
| 	} | ||||
| 	return fs.Stat() | ||||
| } | ||||
|  | ||||
| 	f, err := os.Open(fs.Path("stat")) | ||||
| // NewStat returns information about current cpu/process statistics. | ||||
| // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt | ||||
| // | ||||
| // Deprecated: use fs.Stat() instead | ||||
| func (fs FS) NewStat() (Stat, error) { | ||||
| 	return fs.Stat() | ||||
| } | ||||
|  | ||||
| // Stat returns information about current cpu/process statistics. | ||||
| // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt | ||||
| func (fs FS) Stat() (Stat, error) { | ||||
|  | ||||
| 	f, err := os.Open(fs.proc.Path("stat")) | ||||
| 	if err != nil { | ||||
| 		return Stat{}, err | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										34
									
								
								vendor/github.com/prometheus/procfs/ttar
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										34
									
								
								vendor/github.com/prometheus/procfs/ttar
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -88,6 +88,8 @@ Usage:   $bname [-C <DIR>] -c -f <ARCHIVE> <FILE...> (create archive) | ||||
| Options: | ||||
|          -C <DIR>           (change directory) | ||||
|          -v                 (verbose) | ||||
|          --recursive-unlink (recursively delete existing directory if path | ||||
|                              collides with file or directory to extract) | ||||
|  | ||||
| Example: Change to sysfs directory, create ttar file from fixtures directory | ||||
|          $bname -C sysfs -c -f sysfs/fixtures.ttar fixtures/ | ||||
| @@ -111,8 +113,9 @@ function set_cmd { | ||||
| } | ||||
|  | ||||
| unset VERBOSE | ||||
| unset RECURSIVE_UNLINK | ||||
|  | ||||
| while getopts :cf:htxvC: opt; do | ||||
| while getopts :cf:-:htxvC: opt; do | ||||
|     case $opt in | ||||
|         c) | ||||
|             set_cmd "create" | ||||
| @@ -136,6 +139,18 @@ while getopts :cf:htxvC: opt; do | ||||
|         C) | ||||
|             CDIR=$OPTARG | ||||
|             ;; | ||||
|         -) | ||||
|             case $OPTARG in | ||||
|                 recursive-unlink) | ||||
|                     RECURSIVE_UNLINK="yes" | ||||
|                     ;; | ||||
|                 *) | ||||
|                     echo -e "Error: invalid option -$OPTARG" | ||||
|                     echo | ||||
|                     usage 1 | ||||
|                     ;; | ||||
|             esac | ||||
|             ;; | ||||
|         *) | ||||
|             echo >&2 "ERROR: invalid option -$OPTARG" | ||||
|             echo | ||||
| @@ -212,16 +227,16 @@ function extract { | ||||
|         local eof_without_newline | ||||
|         if [ "$size" -gt 0 ]; then | ||||
|             if [[ "$line" =~ [^\\]EOF ]]; then | ||||
|                 # An EOF not preceeded by a backslash indicates that the line | ||||
|                 # An EOF not preceded by a backslash indicates that the line | ||||
|                 # does not end with a newline | ||||
|                 eof_without_newline=1 | ||||
|             else | ||||
|                 eof_without_newline=0 | ||||
|             fi | ||||
|             # Replace NULLBYTE with null byte if at beginning of line | ||||
|             # Replace NULLBYTE with null byte unless preceeded by backslash | ||||
|             # Replace NULLBYTE with null byte unless preceded by backslash | ||||
|             # Remove one backslash in front of NULLBYTE (if any) | ||||
|             # Remove EOF unless preceeded by backslash | ||||
|             # Remove EOF unless preceded by backslash | ||||
|             # Remove one backslash in front of EOF | ||||
|             if [ $USE_PYTHON -eq 1 ]; then | ||||
|                 echo -n "$line" | python -c "$PYTHON_EXTRACT_FILTER" >> "$path" | ||||
| @@ -245,7 +260,16 @@ function extract { | ||||
|         fi | ||||
|         if [[ $line =~ ^Path:\ (.*)$ ]]; then | ||||
|             path=${BASH_REMATCH[1]} | ||||
|             if [ -e "$path" ] || [ -L "$path" ]; then | ||||
|             if [ -L "$path" ]; then | ||||
|                 rm "$path" | ||||
|             elif [ -d "$path" ]; then | ||||
|                 if [ "${RECURSIVE_UNLINK:-}" == "yes" ]; then | ||||
|                     rm -r "$path" | ||||
|                 else | ||||
|                     # Safe because symlinks to directories are dealt with above | ||||
|                     rmdir "$path" | ||||
|                 fi | ||||
|             elif [ -e "$path" ]; then | ||||
|                 rm "$path" | ||||
|             fi | ||||
|         elif [[ $line =~ ^Lines:\ (.*)$ ]]; then | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/prometheus/procfs/xfrm.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/prometheus/procfs/xfrm.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -97,7 +97,7 @@ func NewXfrmStat() (XfrmStat, error) { | ||||
|  | ||||
| // NewXfrmStat reads the xfrm_stat statistics from the 'proc' filesystem. | ||||
| func (fs FS) NewXfrmStat() (XfrmStat, error) { | ||||
| 	file, err := os.Open(fs.Path("net/xfrm_stat")) | ||||
| 	file, err := os.Open(fs.proc.Path("net/xfrm_stat")) | ||||
| 	if err != nil { | ||||
| 		return XfrmStat{}, err | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										27
									
								
								vendor/github.com/prometheus/procfs/xfs/BUILD
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								vendor/github.com/prometheus/procfs/xfs/BUILD
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,27 +0,0 @@ | ||||
| load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||||
|  | ||||
| go_library( | ||||
|     name = "go_default_library", | ||||
|     srcs = [ | ||||
|         "parse.go", | ||||
|         "xfs.go", | ||||
|     ], | ||||
|     importmap = "k8s.io/kubernetes/vendor/github.com/prometheus/procfs/xfs", | ||||
|     importpath = "github.com/prometheus/procfs/xfs", | ||||
|     visibility = ["//visibility:public"], | ||||
|     deps = ["//vendor/github.com/prometheus/procfs/internal/util:go_default_library"], | ||||
| ) | ||||
|  | ||||
| filegroup( | ||||
|     name = "package-srcs", | ||||
|     srcs = glob(["**"]), | ||||
|     tags = ["automanaged"], | ||||
|     visibility = ["//visibility:private"], | ||||
| ) | ||||
|  | ||||
| filegroup( | ||||
|     name = "all-srcs", | ||||
|     srcs = [":package-srcs"], | ||||
|     tags = ["automanaged"], | ||||
|     visibility = ["//visibility:public"], | ||||
| ) | ||||
							
								
								
									
										330
									
								
								vendor/github.com/prometheus/procfs/xfs/parse.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										330
									
								
								vendor/github.com/prometheus/procfs/xfs/parse.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,330 +0,0 @@ | ||||
| // Copyright 2017 The Prometheus Authors | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| package xfs | ||||
|  | ||||
| import ( | ||||
| 	"bufio" | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/prometheus/procfs/internal/util" | ||||
| ) | ||||
|  | ||||
| // ParseStats parses a Stats from an input io.Reader, using the format | ||||
| // found in /proc/fs/xfs/stat. | ||||
| func ParseStats(r io.Reader) (*Stats, error) { | ||||
| 	const ( | ||||
| 		// Fields parsed into stats structures. | ||||
| 		fieldExtentAlloc = "extent_alloc" | ||||
| 		fieldAbt         = "abt" | ||||
| 		fieldBlkMap      = "blk_map" | ||||
| 		fieldBmbt        = "bmbt" | ||||
| 		fieldDir         = "dir" | ||||
| 		fieldTrans       = "trans" | ||||
| 		fieldIg          = "ig" | ||||
| 		fieldLog         = "log" | ||||
| 		fieldRw          = "rw" | ||||
| 		fieldAttr        = "attr" | ||||
| 		fieldIcluster    = "icluster" | ||||
| 		fieldVnodes      = "vnodes" | ||||
| 		fieldBuf         = "buf" | ||||
| 		fieldXpc         = "xpc" | ||||
|  | ||||
| 		// Unimplemented at this time due to lack of documentation. | ||||
| 		fieldPushAil = "push_ail" | ||||
| 		fieldXstrat  = "xstrat" | ||||
| 		fieldAbtb2   = "abtb2" | ||||
| 		fieldAbtc2   = "abtc2" | ||||
| 		fieldBmbt2   = "bmbt2" | ||||
| 		fieldIbt2    = "ibt2" | ||||
| 		fieldFibt2   = "fibt2" | ||||
| 		fieldQm      = "qm" | ||||
| 		fieldDebug   = "debug" | ||||
| 	) | ||||
|  | ||||
| 	var xfss Stats | ||||
|  | ||||
| 	s := bufio.NewScanner(r) | ||||
| 	for s.Scan() { | ||||
| 		// Expect at least a string label and a single integer value, ex: | ||||
| 		//   - abt 0 | ||||
| 		//   - rw 1 2 | ||||
| 		ss := strings.Fields(string(s.Bytes())) | ||||
| 		if len(ss) < 2 { | ||||
| 			continue | ||||
| 		} | ||||
| 		label := ss[0] | ||||
|  | ||||
| 		// Extended precision counters are uint64 values. | ||||
| 		if label == fieldXpc { | ||||
| 			us, err := util.ParseUint64s(ss[1:]) | ||||
| 			if err != nil { | ||||
| 				return nil, err | ||||
| 			} | ||||
|  | ||||
| 			xfss.ExtendedPrecision, err = extendedPrecisionStats(us) | ||||
| 			if err != nil { | ||||
| 				return nil, err | ||||
| 			} | ||||
|  | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		// All other counters are uint32 values. | ||||
| 		us, err := util.ParseUint32s(ss[1:]) | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
| 		} | ||||
|  | ||||
| 		switch label { | ||||
| 		case fieldExtentAlloc: | ||||
| 			xfss.ExtentAllocation, err = extentAllocationStats(us) | ||||
| 		case fieldAbt: | ||||
| 			xfss.AllocationBTree, err = btreeStats(us) | ||||
| 		case fieldBlkMap: | ||||
| 			xfss.BlockMapping, err = blockMappingStats(us) | ||||
| 		case fieldBmbt: | ||||
| 			xfss.BlockMapBTree, err = btreeStats(us) | ||||
| 		case fieldDir: | ||||
| 			xfss.DirectoryOperation, err = directoryOperationStats(us) | ||||
| 		case fieldTrans: | ||||
| 			xfss.Transaction, err = transactionStats(us) | ||||
| 		case fieldIg: | ||||
| 			xfss.InodeOperation, err = inodeOperationStats(us) | ||||
| 		case fieldLog: | ||||
| 			xfss.LogOperation, err = logOperationStats(us) | ||||
| 		case fieldRw: | ||||
| 			xfss.ReadWrite, err = readWriteStats(us) | ||||
| 		case fieldAttr: | ||||
| 			xfss.AttributeOperation, err = attributeOperationStats(us) | ||||
| 		case fieldIcluster: | ||||
| 			xfss.InodeClustering, err = inodeClusteringStats(us) | ||||
| 		case fieldVnodes: | ||||
| 			xfss.Vnode, err = vnodeStats(us) | ||||
| 		case fieldBuf: | ||||
| 			xfss.Buffer, err = bufferStats(us) | ||||
| 		} | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	return &xfss, s.Err() | ||||
| } | ||||
|  | ||||
| // extentAllocationStats builds an ExtentAllocationStats from a slice of uint32s. | ||||
| func extentAllocationStats(us []uint32) (ExtentAllocationStats, error) { | ||||
| 	if l := len(us); l != 4 { | ||||
| 		return ExtentAllocationStats{}, fmt.Errorf("incorrect number of values for XFS extent allocation stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	return ExtentAllocationStats{ | ||||
| 		ExtentsAllocated: us[0], | ||||
| 		BlocksAllocated:  us[1], | ||||
| 		ExtentsFreed:     us[2], | ||||
| 		BlocksFreed:      us[3], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| // btreeStats builds a BTreeStats from a slice of uint32s. | ||||
| func btreeStats(us []uint32) (BTreeStats, error) { | ||||
| 	if l := len(us); l != 4 { | ||||
| 		return BTreeStats{}, fmt.Errorf("incorrect number of values for XFS btree stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	return BTreeStats{ | ||||
| 		Lookups:         us[0], | ||||
| 		Compares:        us[1], | ||||
| 		RecordsInserted: us[2], | ||||
| 		RecordsDeleted:  us[3], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| // BlockMappingStat builds a BlockMappingStats from a slice of uint32s. | ||||
| func blockMappingStats(us []uint32) (BlockMappingStats, error) { | ||||
| 	if l := len(us); l != 7 { | ||||
| 		return BlockMappingStats{}, fmt.Errorf("incorrect number of values for XFS block mapping stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	return BlockMappingStats{ | ||||
| 		Reads:                us[0], | ||||
| 		Writes:               us[1], | ||||
| 		Unmaps:               us[2], | ||||
| 		ExtentListInsertions: us[3], | ||||
| 		ExtentListDeletions:  us[4], | ||||
| 		ExtentListLookups:    us[5], | ||||
| 		ExtentListCompares:   us[6], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| // DirectoryOperationStats builds a DirectoryOperationStats from a slice of uint32s. | ||||
| func directoryOperationStats(us []uint32) (DirectoryOperationStats, error) { | ||||
| 	if l := len(us); l != 4 { | ||||
| 		return DirectoryOperationStats{}, fmt.Errorf("incorrect number of values for XFS directory operation stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	return DirectoryOperationStats{ | ||||
| 		Lookups:  us[0], | ||||
| 		Creates:  us[1], | ||||
| 		Removes:  us[2], | ||||
| 		Getdents: us[3], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| // TransactionStats builds a TransactionStats from a slice of uint32s. | ||||
| func transactionStats(us []uint32) (TransactionStats, error) { | ||||
| 	if l := len(us); l != 3 { | ||||
| 		return TransactionStats{}, fmt.Errorf("incorrect number of values for XFS transaction stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	return TransactionStats{ | ||||
| 		Sync:  us[0], | ||||
| 		Async: us[1], | ||||
| 		Empty: us[2], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| // InodeOperationStats builds an InodeOperationStats from a slice of uint32s. | ||||
| func inodeOperationStats(us []uint32) (InodeOperationStats, error) { | ||||
| 	if l := len(us); l != 7 { | ||||
| 		return InodeOperationStats{}, fmt.Errorf("incorrect number of values for XFS inode operation stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	return InodeOperationStats{ | ||||
| 		Attempts:        us[0], | ||||
| 		Found:           us[1], | ||||
| 		Recycle:         us[2], | ||||
| 		Missed:          us[3], | ||||
| 		Duplicate:       us[4], | ||||
| 		Reclaims:        us[5], | ||||
| 		AttributeChange: us[6], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| // LogOperationStats builds a LogOperationStats from a slice of uint32s. | ||||
| func logOperationStats(us []uint32) (LogOperationStats, error) { | ||||
| 	if l := len(us); l != 5 { | ||||
| 		return LogOperationStats{}, fmt.Errorf("incorrect number of values for XFS log operation stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	return LogOperationStats{ | ||||
| 		Writes:            us[0], | ||||
| 		Blocks:            us[1], | ||||
| 		NoInternalBuffers: us[2], | ||||
| 		Force:             us[3], | ||||
| 		ForceSleep:        us[4], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| // ReadWriteStats builds a ReadWriteStats from a slice of uint32s. | ||||
| func readWriteStats(us []uint32) (ReadWriteStats, error) { | ||||
| 	if l := len(us); l != 2 { | ||||
| 		return ReadWriteStats{}, fmt.Errorf("incorrect number of values for XFS read write stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	return ReadWriteStats{ | ||||
| 		Read:  us[0], | ||||
| 		Write: us[1], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| // AttributeOperationStats builds an AttributeOperationStats from a slice of uint32s. | ||||
| func attributeOperationStats(us []uint32) (AttributeOperationStats, error) { | ||||
| 	if l := len(us); l != 4 { | ||||
| 		return AttributeOperationStats{}, fmt.Errorf("incorrect number of values for XFS attribute operation stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	return AttributeOperationStats{ | ||||
| 		Get:    us[0], | ||||
| 		Set:    us[1], | ||||
| 		Remove: us[2], | ||||
| 		List:   us[3], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| // InodeClusteringStats builds an InodeClusteringStats from a slice of uint32s. | ||||
| func inodeClusteringStats(us []uint32) (InodeClusteringStats, error) { | ||||
| 	if l := len(us); l != 3 { | ||||
| 		return InodeClusteringStats{}, fmt.Errorf("incorrect number of values for XFS inode clustering stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	return InodeClusteringStats{ | ||||
| 		Iflush:     us[0], | ||||
| 		Flush:      us[1], | ||||
| 		FlushInode: us[2], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| // VnodeStats builds a VnodeStats from a slice of uint32s. | ||||
| func vnodeStats(us []uint32) (VnodeStats, error) { | ||||
| 	// The attribute "Free" appears to not be available on older XFS | ||||
| 	// stats versions.  Therefore, 7 or 8 elements may appear in | ||||
| 	// this slice. | ||||
| 	l := len(us) | ||||
| 	if l != 7 && l != 8 { | ||||
| 		return VnodeStats{}, fmt.Errorf("incorrect number of values for XFS vnode stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	s := VnodeStats{ | ||||
| 		Active:   us[0], | ||||
| 		Allocate: us[1], | ||||
| 		Get:      us[2], | ||||
| 		Hold:     us[3], | ||||
| 		Release:  us[4], | ||||
| 		Reclaim:  us[5], | ||||
| 		Remove:   us[6], | ||||
| 	} | ||||
|  | ||||
| 	// Skip adding free, unless it is present. The zero value will | ||||
| 	// be used in place of an actual count. | ||||
| 	if l == 7 { | ||||
| 		return s, nil | ||||
| 	} | ||||
|  | ||||
| 	s.Free = us[7] | ||||
| 	return s, nil | ||||
| } | ||||
|  | ||||
| // BufferStats builds a BufferStats from a slice of uint32s. | ||||
| func bufferStats(us []uint32) (BufferStats, error) { | ||||
| 	if l := len(us); l != 9 { | ||||
| 		return BufferStats{}, fmt.Errorf("incorrect number of values for XFS buffer stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	return BufferStats{ | ||||
| 		Get:             us[0], | ||||
| 		Create:          us[1], | ||||
| 		GetLocked:       us[2], | ||||
| 		GetLockedWaited: us[3], | ||||
| 		BusyLocked:      us[4], | ||||
| 		MissLocked:      us[5], | ||||
| 		PageRetries:     us[6], | ||||
| 		PageFound:       us[7], | ||||
| 		GetRead:         us[8], | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| // ExtendedPrecisionStats builds an ExtendedPrecisionStats from a slice of uint32s. | ||||
| func extendedPrecisionStats(us []uint64) (ExtendedPrecisionStats, error) { | ||||
| 	if l := len(us); l != 3 { | ||||
| 		return ExtendedPrecisionStats{}, fmt.Errorf("incorrect number of values for XFS extended precision stats: %d", l) | ||||
| 	} | ||||
|  | ||||
| 	return ExtendedPrecisionStats{ | ||||
| 		FlushBytes: us[0], | ||||
| 		WriteBytes: us[1], | ||||
| 		ReadBytes:  us[2], | ||||
| 	}, nil | ||||
| } | ||||
							
								
								
									
										163
									
								
								vendor/github.com/prometheus/procfs/xfs/xfs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										163
									
								
								vendor/github.com/prometheus/procfs/xfs/xfs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,163 +0,0 @@ | ||||
| // Copyright 2017 The Prometheus Authors | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| // Package xfs provides access to statistics exposed by the XFS filesystem. | ||||
| package xfs | ||||
|  | ||||
| // Stats contains XFS filesystem runtime statistics, parsed from | ||||
| // /proc/fs/xfs/stat. | ||||
| // | ||||
| // The names and meanings of each statistic were taken from | ||||
| // http://xfs.org/index.php/Runtime_Stats and xfs_stats.h in the Linux | ||||
| // kernel source. Most counters are uint32s (same data types used in | ||||
| // xfs_stats.h), but some of the "extended precision stats" are uint64s. | ||||
| type Stats struct { | ||||
| 	// The name of the filesystem used to source these statistics. | ||||
| 	// If empty, this indicates aggregated statistics for all XFS | ||||
| 	// filesystems on the host. | ||||
| 	Name string | ||||
|  | ||||
| 	ExtentAllocation   ExtentAllocationStats | ||||
| 	AllocationBTree    BTreeStats | ||||
| 	BlockMapping       BlockMappingStats | ||||
| 	BlockMapBTree      BTreeStats | ||||
| 	DirectoryOperation DirectoryOperationStats | ||||
| 	Transaction        TransactionStats | ||||
| 	InodeOperation     InodeOperationStats | ||||
| 	LogOperation       LogOperationStats | ||||
| 	ReadWrite          ReadWriteStats | ||||
| 	AttributeOperation AttributeOperationStats | ||||
| 	InodeClustering    InodeClusteringStats | ||||
| 	Vnode              VnodeStats | ||||
| 	Buffer             BufferStats | ||||
| 	ExtendedPrecision  ExtendedPrecisionStats | ||||
| } | ||||
|  | ||||
| // ExtentAllocationStats contains statistics regarding XFS extent allocations. | ||||
| type ExtentAllocationStats struct { | ||||
| 	ExtentsAllocated uint32 | ||||
| 	BlocksAllocated  uint32 | ||||
| 	ExtentsFreed     uint32 | ||||
| 	BlocksFreed      uint32 | ||||
| } | ||||
|  | ||||
| // BTreeStats contains statistics regarding an XFS internal B-tree. | ||||
| type BTreeStats struct { | ||||
| 	Lookups         uint32 | ||||
| 	Compares        uint32 | ||||
| 	RecordsInserted uint32 | ||||
| 	RecordsDeleted  uint32 | ||||
| } | ||||
|  | ||||
| // BlockMappingStats contains statistics regarding XFS block maps. | ||||
| type BlockMappingStats struct { | ||||
| 	Reads                uint32 | ||||
| 	Writes               uint32 | ||||
| 	Unmaps               uint32 | ||||
| 	ExtentListInsertions uint32 | ||||
| 	ExtentListDeletions  uint32 | ||||
| 	ExtentListLookups    uint32 | ||||
| 	ExtentListCompares   uint32 | ||||
| } | ||||
|  | ||||
| // DirectoryOperationStats contains statistics regarding XFS directory entries. | ||||
| type DirectoryOperationStats struct { | ||||
| 	Lookups  uint32 | ||||
| 	Creates  uint32 | ||||
| 	Removes  uint32 | ||||
| 	Getdents uint32 | ||||
| } | ||||
|  | ||||
| // TransactionStats contains statistics regarding XFS metadata transactions. | ||||
| type TransactionStats struct { | ||||
| 	Sync  uint32 | ||||
| 	Async uint32 | ||||
| 	Empty uint32 | ||||
| } | ||||
|  | ||||
| // InodeOperationStats contains statistics regarding XFS inode operations. | ||||
| type InodeOperationStats struct { | ||||
| 	Attempts        uint32 | ||||
| 	Found           uint32 | ||||
| 	Recycle         uint32 | ||||
| 	Missed          uint32 | ||||
| 	Duplicate       uint32 | ||||
| 	Reclaims        uint32 | ||||
| 	AttributeChange uint32 | ||||
| } | ||||
|  | ||||
| // LogOperationStats contains statistics regarding the XFS log buffer. | ||||
| type LogOperationStats struct { | ||||
| 	Writes            uint32 | ||||
| 	Blocks            uint32 | ||||
| 	NoInternalBuffers uint32 | ||||
| 	Force             uint32 | ||||
| 	ForceSleep        uint32 | ||||
| } | ||||
|  | ||||
| // ReadWriteStats contains statistics regarding the number of read and write | ||||
| // system calls for XFS filesystems. | ||||
| type ReadWriteStats struct { | ||||
| 	Read  uint32 | ||||
| 	Write uint32 | ||||
| } | ||||
|  | ||||
| // AttributeOperationStats contains statistics regarding manipulation of | ||||
| // XFS extended file attributes. | ||||
| type AttributeOperationStats struct { | ||||
| 	Get    uint32 | ||||
| 	Set    uint32 | ||||
| 	Remove uint32 | ||||
| 	List   uint32 | ||||
| } | ||||
|  | ||||
| // InodeClusteringStats contains statistics regarding XFS inode clustering | ||||
| // operations. | ||||
| type InodeClusteringStats struct { | ||||
| 	Iflush     uint32 | ||||
| 	Flush      uint32 | ||||
| 	FlushInode uint32 | ||||
| } | ||||
|  | ||||
| // VnodeStats contains statistics regarding XFS vnode operations. | ||||
| type VnodeStats struct { | ||||
| 	Active   uint32 | ||||
| 	Allocate uint32 | ||||
| 	Get      uint32 | ||||
| 	Hold     uint32 | ||||
| 	Release  uint32 | ||||
| 	Reclaim  uint32 | ||||
| 	Remove   uint32 | ||||
| 	Free     uint32 | ||||
| } | ||||
|  | ||||
| // BufferStats contains statistics regarding XFS read/write I/O buffers. | ||||
| type BufferStats struct { | ||||
| 	Get             uint32 | ||||
| 	Create          uint32 | ||||
| 	GetLocked       uint32 | ||||
| 	GetLockedWaited uint32 | ||||
| 	BusyLocked      uint32 | ||||
| 	MissLocked      uint32 | ||||
| 	PageRetries     uint32 | ||||
| 	PageFound       uint32 | ||||
| 	GetRead         uint32 | ||||
| } | ||||
|  | ||||
| // ExtendedPrecisionStats contains high precision counters used to track the | ||||
| // total number of bytes read, written, or flushed, during XFS operations. | ||||
| type ExtendedPrecisionStats struct { | ||||
| 	FlushBytes uint64 | ||||
| 	WriteBytes uint64 | ||||
| 	ReadBytes  uint64 | ||||
| } | ||||
							
								
								
									
										6
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							| @@ -726,11 +726,9 @@ github.com/prometheus/client_model/go | ||||
| github.com/prometheus/common/expfmt | ||||
| github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg | ||||
| github.com/prometheus/common/model | ||||
| # github.com/prometheus/procfs v0.0.2 => github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a | ||||
| # github.com/prometheus/procfs v0.0.2 => github.com/prometheus/procfs v0.0.2 | ||||
| github.com/prometheus/procfs | ||||
| github.com/prometheus/procfs/internal/util | ||||
| github.com/prometheus/procfs/nfs | ||||
| github.com/prometheus/procfs/xfs | ||||
| github.com/prometheus/procfs/internal/fs | ||||
| # github.com/quobyte/api v0.1.2 => github.com/quobyte/api v0.1.2 | ||||
| github.com/quobyte/api | ||||
| # github.com/robfig/cron v1.1.0 => github.com/robfig/cron v1.1.0 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user