MM-14617 Dependency upgrades and adding modules support. (#10517)

* Dependency upgrades and adding modules support.

* Commenting out file tests playload verification portion.

* Fixing viper.

* Fixing hclog.
Этот коммит содержится в:
Christopher Speller
2019-04-10 07:56:17 -07:00
коммит произвёл GitHub
родитель bd8a54bb08
Коммит 41d117c37b
550 изменённых файлов: 22572 добавлений и 114088 удалений

10
vendor/github.com/prometheus/procfs/Makefile сгенерированный поставляемый
Просмотреть файл

@@ -17,14 +17,12 @@ include Makefile.common
./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

81
vendor/github.com/prometheus/procfs/diskstats.go сгенерированный поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,81 @@
// 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"
"fmt"
"io"
"os"
"github.com/prometheus/procfs/iostats"
)
const (
diskstatsFilename = "diskstats"
statFormat = "%d %d %s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d"
)
// NewDiskstats reads the diskstats file and returns
// an array of Diskstats (one per line/device)
func NewDiskstats() ([]iostats.IODeviceStats, error) {
fs, err := NewFS(DefaultMountPoint)
if err != nil {
return nil, err
}
return fs.NewDiskstats()
}
// NewDiskstats reads the diskstats file and returns
// an array of Diskstats (one per line/device)
func (fs FS) NewDiskstats() ([]iostats.IODeviceStats, error) {
file, err := os.Open(fs.Path(diskstatsFilename))
if err != nil {
return nil, err
}
defer file.Close()
diskstats := []iostats.IODeviceStats{}
scanner := bufio.NewScanner(file)
for scanner.Scan() {
d := &iostats.IODeviceStats{}
count, err := fmt.Sscanf(scanner.Text(), statFormat,
&d.MajorNumber,
&d.MinorNumber,
&d.DeviceName,
&d.ReadIOs,
&d.ReadMerges,
&d.ReadSectors,
&d.ReadTicks,
&d.WriteIOs,
&d.WriteMerges,
&d.WriteSectors,
&d.WriteTicks,
&d.IOsInProgress,
&d.IOsTotalTicks,
&d.WeightedIOTicks,
&d.DiscardIOs,
&d.DiscardMerges,
&d.DiscardSectors,
&d.DiscardTicks)
if err != nil && err != io.EOF {
return diskstats, err
}
if count == 14 || count == 18 {
diskstats = append(diskstats, *d)
}
}
return diskstats, nil
}

1428
vendor/github.com/prometheus/procfs/fixtures.ttar сгенерированный поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

2
vendor/github.com/prometheus/procfs/go.mod сгенерированный поставляемый
Просмотреть файл

@@ -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 сгенерированный поставляемый Обычный файл
Просмотреть файл

@@ -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=

14
vendor/github.com/prometheus/procfs/internal/util/parse.go сгенерированный поставляемый
Просмотреть файл

@@ -57,3 +57,17 @@ func ReadUintFromFile(path string) (uint64, error) {
}
return strconv.ParseUint(strings.TrimSpace(string(data)), 10, 64)
}
// ParseBool parses a string into a boolean pointer.
func ParseBool(b string) *bool {
var truth bool
switch b {
case "enabled":
truth = true
case "disabled":
truth = false
default:
return nil
}
return &truth
}

Просмотреть файл

@@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// +build !windows
// +build linux,!appengine
package util

26
vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go сгенерированный поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,26 @@
// 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.
// +build linux,appengine !linux
package util
import (
"fmt"
)
// SysReadFile is here implemented as a noop for builds that do not support
// the read syscall. For example Windows, or Linux on Google App Engine.
func SysReadFile(file string) (string, error) {
return "", fmt.Errorf("not supported on this platform")
}

67
vendor/github.com/prometheus/procfs/iostats/iostats.go сгенерированный поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,67 @@
// 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 iostats
// IODevice contains identifying information for an I/O device
type IODevice struct {
MajorNumber uint32
MinorNumber uint32
DeviceName string
}
// IOStats models the iostats data described in the kernel documentation
// https://www.kernel.org/doc/Documentation/iostats.txt,
// https://www.kernel.org/doc/Documentation/block/stat.txt,
// and https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats
type IOStats struct {
// ReadIOs is the number of reads completed successfully.
ReadIOs uint64
// ReadMerges is the number of reads merged. Reads and writes
// which are adjacent to each other may be merged for efficiency.
ReadMerges uint64
// ReadSectors is the total number of sectors read successfully.
ReadSectors uint64
// ReadTicks is the total number of milliseconds spent by all reads.
ReadTicks uint64
// WriteIOs is the total number of writes completed successfully.
WriteIOs uint64
// WriteMerges is the number of reads merged.
WriteMerges uint64
// WriteSectors is the total number of sectors written successfully.
WriteSectors uint64
// WriteTicks is the total number of milliseconds spent by all writes.
WriteTicks uint64
// IOsInProgress is number of I/Os currently in progress.
IOsInProgress uint64
// IOsTotalTicks is the number of milliseconds spent doing I/Os.
// This field increases so long as IosInProgress is nonzero.
IOsTotalTicks uint64
// WeightedIOTicks is the weighted number of milliseconds spent doing I/Os.
// This can also be used to estimate average queue wait time for requests.
WeightedIOTicks uint64
// DiscardIOs is the total number of discards completed successfully.
DiscardIOs uint64
// DiscardMerges is the number of discards merged.
DiscardMerges uint64
// DiscardSectors is the total number of sectors discarded successfully.
DiscardSectors uint64
// DiscardTicks is the total number of milliseconds spent by all discards.
DiscardTicks uint64
}
// IODeviceStats combines IODevice and IOStats
type IODeviceStats struct {
IODevice
IOStats
}

10
vendor/github.com/prometheus/procfs/mountstats.go сгенерированный поставляемый
Просмотреть файл

@@ -69,6 +69,8 @@ type MountStats interface {
type MountStatsNFS struct {
// The version of statistics provided.
StatVersion string
// The optional mountaddr of the NFS mount.
MountAddress string
// The age of the NFS mount.
Age time.Duration
// Statistics related to byte counters for various operations.
@@ -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,13 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e
}
switch ss[0] {
case fieldOpts:
for _, opt := range strings.Split(ss[1], ",") {
split := strings.Split(opt, "=")
if len(split) == 2 && split[0] == "mountaddr" {
stats.MountAddress = split[1]
}
}
case fieldAge:
// Age integer is in seconds
d, err := time.ParseDuration(ss[1] + "s")

110
vendor/github.com/prometheus/procfs/proc_psi.go сгенерированный поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,110 @@
// 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
}
// NewPSIStatsForResource reads pressure stall information for the specified
// resource. At time of writing this can be either "cpu", "memory" or "io".
func NewPSIStatsForResource(resource string) (PSIStats, error) {
fs, err := NewFS(DefaultMountPoint)
if err != nil {
return PSIStats{}, err
}
return fs.NewPSIStatsForResource(resource)
}
// NewPSIStatsForResource reads pressure stall information from /proc/pressure/<resource>
func (fs FS) NewPSIStatsForResource(resource string) (PSIStats, error) {
file, err := os.Open(fs.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
}

4
vendor/github.com/prometheus/procfs/proc_stat.go сгенерированный поставляемый
Просмотреть файл

@@ -95,7 +95,7 @@ type ProcStat struct {
// in clock ticks.
Starttime uint64
// Virtual memory size in bytes.
VSize int
VSize uint
// Resident set size in pages.
RSS int
@@ -164,7 +164,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
}

0
vendor/github.com/prometheus/procfs/ttar сгенерированный поставляемый Исполняемый файл → Обычный файл
Просмотреть файл