Initial commit
This commit is contained in:
commit
5e904971a7
|
@ -0,0 +1,96 @@
|
||||||
|
---
|
||||||
|
version: 2.1
|
||||||
|
|
||||||
|
orbs:
|
||||||
|
prometheus: prometheus/prometheus@0.4.0
|
||||||
|
|
||||||
|
executors:
|
||||||
|
# Whenever the Go version is updated here, .promu.yml should
|
||||||
|
# also be updated.
|
||||||
|
golang:
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:1.13
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
executor: golang
|
||||||
|
steps:
|
||||||
|
- prometheus/setup_environment
|
||||||
|
- run: make
|
||||||
|
- prometheus/store_artifact:
|
||||||
|
file: cgroup_exporter
|
||||||
|
build:
|
||||||
|
machine:
|
||||||
|
image: ubuntu-1604:201903-01
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: make promu
|
||||||
|
- run: promu crossbuild -v
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: .
|
||||||
|
paths:
|
||||||
|
- .build
|
||||||
|
- store_artifacts:
|
||||||
|
path: .build
|
||||||
|
destination: /build
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
if [ -n "$CIRCLE_TAG" ]; then
|
||||||
|
make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
|
||||||
|
else
|
||||||
|
make docker
|
||||||
|
fi
|
||||||
|
publish_master:
|
||||||
|
executor: golang
|
||||||
|
steps:
|
||||||
|
- prometheus/setup_build_environment
|
||||||
|
- prometheus/publish_images:
|
||||||
|
login_variable: DOCKER_LOGIN
|
||||||
|
organization: treydock
|
||||||
|
password_variable: DOCKER_PASSWORD
|
||||||
|
registry: docker.io
|
||||||
|
publish_release:
|
||||||
|
executor: golang
|
||||||
|
steps:
|
||||||
|
- prometheus/setup_build_environment
|
||||||
|
- run: promu crossbuild tarballs
|
||||||
|
- run: promu checksum .tarballs
|
||||||
|
- run: promu release .tarballs
|
||||||
|
- store_artifacts:
|
||||||
|
destination: releases
|
||||||
|
path: .tarballs
|
||||||
|
- prometheus/publish_release_images:
|
||||||
|
login_variable: DOCKER_LOGIN
|
||||||
|
organization: treydock
|
||||||
|
password_variable: DOCKER_PASSWORD
|
||||||
|
registry: docker.io
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
cgroup_exporter:
|
||||||
|
jobs:
|
||||||
|
- test:
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
|
- build:
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
|
- publish_master:
|
||||||
|
context: org-context
|
||||||
|
requires:
|
||||||
|
- test
|
||||||
|
- build
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: master
|
||||||
|
- publish_release:
|
||||||
|
context: org-context
|
||||||
|
requires:
|
||||||
|
- test
|
||||||
|
- build
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /^v([0-9]).*/
|
||||||
|
branches:
|
||||||
|
ignore: /.*/
|
|
@ -0,0 +1,21 @@
|
||||||
|
# EditorConfig is awesome: https://EditorConfig.org
|
||||||
|
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# Unix-style newlines with a newline ending every file
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.go]
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
# Tab indentation (no size specified)
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[{*.md,*.yaml,*.yml}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
|
@ -0,0 +1,3 @@
|
||||||
|
/.tarballs
|
||||||
|
/.build
|
||||||
|
/cgroup_exporter
|
|
@ -0,0 +1,34 @@
|
||||||
|
go:
|
||||||
|
version: 1.13
|
||||||
|
cgo: true
|
||||||
|
repository:
|
||||||
|
path: github.com/treydock/cgroup_exporter
|
||||||
|
build:
|
||||||
|
binaries:
|
||||||
|
- name: cgroup_exporter
|
||||||
|
path: .
|
||||||
|
flags: -a -tags netgo
|
||||||
|
ldflags: |
|
||||||
|
-extldflags "-static"
|
||||||
|
-X github.com/prometheus/common/version.Version={{.Version}}
|
||||||
|
-X github.com/prometheus/common/version.Revision={{.Revision}}
|
||||||
|
-X github.com/prometheus/common/version.Branch={{.Branch}}
|
||||||
|
-X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
|
||||||
|
-X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
|
||||||
|
tarball:
|
||||||
|
files:
|
||||||
|
- LICENSE
|
||||||
|
- CHANGELOG.md
|
||||||
|
crossbuild:
|
||||||
|
platforms:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/386
|
||||||
|
- linux/arm
|
||||||
|
- linux/arm64
|
||||||
|
- linux/mips
|
||||||
|
- linux/mipsle
|
||||||
|
- linux/mips64
|
||||||
|
- linux/mips64le
|
||||||
|
- linux/ppc64
|
||||||
|
- linux/ppc64le
|
||||||
|
- linux/s390x
|
|
@ -0,0 +1,10 @@
|
||||||
|
FROM golang:1.13 AS builder
|
||||||
|
RUN mkdir /build
|
||||||
|
ADD . /build/
|
||||||
|
WORKDIR /build
|
||||||
|
RUN make build
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
WORKDIR /
|
||||||
|
COPY --from=builder /build/cgroup_exporter /cgroup_exporter
|
||||||
|
ENTRYPOINT ["/cgroup_exporter"]
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Needs to be defined before including Makefile.common to auto-generate targets
|
||||||
|
DOCKER_ARCHS ?= amd64 armv7 arm64 ppc64le s390x
|
||||||
|
DOCKER_REPO ?= treydock
|
||||||
|
|
||||||
|
include Makefile.common
|
||||||
|
|
||||||
|
DOCKER_IMAGE_NAME ?= check_mount_exporter
|
|
@ -0,0 +1,277 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
# A common Makefile that includes rules to be reused in different prometheus projects.
|
||||||
|
# !!! Open PRs only against the prometheus/prometheus/Makefile.common repository!
|
||||||
|
|
||||||
|
# Example usage :
|
||||||
|
# Create the main Makefile in the root project directory.
|
||||||
|
# include Makefile.common
|
||||||
|
# customTarget:
|
||||||
|
# @echo ">> Running customTarget"
|
||||||
|
#
|
||||||
|
|
||||||
|
# Ensure GOBIN is not set during build so that promu is installed to the correct path
|
||||||
|
unexport GOBIN
|
||||||
|
|
||||||
|
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])\.')
|
||||||
|
|
||||||
|
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).
|
||||||
|
GO111MODULE := on
|
||||||
|
|
||||||
|
ifneq (,$(wildcard vendor))
|
||||||
|
# Always use the local vendor/ directory to satisfy the dependencies.
|
||||||
|
GOOPTS := $(GOOPTS) -mod=vendor
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifneq (,$(wildcard go.mod))
|
||||||
|
ifneq (,$(wildcard vendor))
|
||||||
|
$(warning This repository requires Go >= 1.11 because of Go modules)
|
||||||
|
$(warning Some recipes may not work as expected as the current Go runtime is '$(GO_VERSION_NUMBER)')
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
# This repository isn't using Go modules (yet).
|
||||||
|
GOVENDOR := $(FIRST_GOPATH)/bin/govendor
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
PROMU := $(FIRST_GOPATH)/bin/promu
|
||||||
|
pkgs = ./...
|
||||||
|
|
||||||
|
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.5.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.18.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))
|
||||||
|
DOCKERFILE_PATH ?= ./Dockerfile
|
||||||
|
DOCKERBUILD_CONTEXT ?= ./
|
||||||
|
DOCKER_REPO ?= prom
|
||||||
|
|
||||||
|
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"
|
||||||
|
@fmtRes=$$($(GOFMT) -d $$(find . -path ./vendor -prune -o -name '*.go' -print)); \
|
||||||
|
if [ -n "$${fmtRes}" ]; then \
|
||||||
|
echo "gofmt checking failed!"; echo "$${fmtRes}"; echo; \
|
||||||
|
echo "Please ensure you are using $$($(GO) version) for formatting code."; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
.PHONY: common-check_license
|
||||||
|
common-check_license:
|
||||||
|
@echo ">> checking license header"
|
||||||
|
@licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \
|
||||||
|
awk 'NR<=3' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
|
||||||
|
done); \
|
||||||
|
if [ -n "$${licRes}" ]; then \
|
||||||
|
echo "license header checking failed:"; echo "$${licRes}"; \
|
||||||
|
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"
|
||||||
|
GO111MODULE=$(GO111MODULE) $(GO) test -short $(GOOPTS) $(pkgs)
|
||||||
|
|
||||||
|
.PHONY: common-test
|
||||||
|
common-test:
|
||||||
|
@echo ">> running all tests"
|
||||||
|
GO111MODULE=$(GO111MODULE) $(GO) test $(test-flags) $(GOOPTS) $(pkgs)
|
||||||
|
|
||||||
|
.PHONY: common-format
|
||||||
|
common-format:
|
||||||
|
@echo ">> formatting code"
|
||||||
|
GO111MODULE=$(GO111MODULE) $(GO) fmt $(pkgs)
|
||||||
|
|
||||||
|
.PHONY: common-vet
|
||||||
|
common-vet:
|
||||||
|
@echo ">> vetting code"
|
||||||
|
GO111MODULE=$(GO111MODULE) $(GO) vet $(GOOPTS) $(pkgs)
|
||||||
|
|
||||||
|
.PHONY: common-lint
|
||||||
|
common-lint: $(GOLANGCI_LINT)
|
||||||
|
ifdef GOLANGCI_LINT
|
||||||
|
@echo ">> running golangci-lint"
|
||||||
|
ifdef GO111MODULE
|
||||||
|
# '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
|
||||||
|
$(GOLANGCI_LINT) run $(pkgs)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# For backward-compatibility.
|
||||||
|
.PHONY: common-staticcheck
|
||||||
|
common-staticcheck: lint
|
||||||
|
|
||||||
|
.PHONY: common-unused
|
||||||
|
common-unused: $(GOVENDOR)
|
||||||
|
ifdef GOVENDOR
|
||||||
|
@echo ">> running check for unused packages"
|
||||||
|
@$(GOVENDOR) list +unused | grep . && exit 1 || echo 'No unused packages'
|
||||||
|
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
|
||||||
|
else
|
||||||
|
@echo ">> running check for unused packages in vendor/"
|
||||||
|
GO111MODULE=$(GO111MODULE) $(GO) mod vendor
|
||||||
|
@git diff --exit-code -- go.sum go.mod vendor/
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: common-build
|
||||||
|
common-build: promu
|
||||||
|
@echo ">> building binaries"
|
||||||
|
GO111MODULE=$(GO111MODULE) $(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
|
||||||
|
|
||||||
|
.PHONY: common-tarball
|
||||||
|
common-tarball: promu
|
||||||
|
@echo ">> building release tarball"
|
||||||
|
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
|
||||||
|
|
||||||
|
.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)" \
|
||||||
|
-f $(DOCKERFILE_PATH) \
|
||||||
|
--build-arg ARCH="$*" \
|
||||||
|
--build-arg OS="linux" \
|
||||||
|
$(DOCKERBUILD_CONTEXT)
|
||||||
|
|
||||||
|
.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 $(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):
|
||||||
|
$(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
|
||||||
|
|
||||||
|
ifdef GOLANGCI_LINT
|
||||||
|
$(GOLANGCI_LINT):
|
||||||
|
mkdir -p $(FIRST_GOPATH)/bin
|
||||||
|
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_LINT_VERSION)/install.sh \
|
||||||
|
| sed -e '/install -d/d' \
|
||||||
|
| sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef GOVENDOR
|
||||||
|
.PHONY: $(GOVENDOR)
|
||||||
|
$(GOVENDOR):
|
||||||
|
GOOS= GOARCH= $(GO) get -u github.com/kardianos/govendor
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: precheck
|
||||||
|
precheck::
|
||||||
|
|
||||||
|
define PRECHECK_COMMAND_template =
|
||||||
|
precheck:: $(1)_precheck
|
||||||
|
|
||||||
|
PRECHECK_COMMAND_$(1) ?= $(1) $$(strip $$(PRECHECK_OPTIONS_$(1)))
|
||||||
|
.PHONY: $(1)_precheck
|
||||||
|
$(1)_precheck:
|
||||||
|
@if ! $$(PRECHECK_COMMAND_$(1)) 1>/dev/null 2>&1; then \
|
||||||
|
echo "Execution of '$$(PRECHECK_COMMAND_$(1))' command failed. Is $(1) installed?"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
endef
|
|
@ -0,0 +1,259 @@
|
||||||
|
// Copyright 2020 Trey Dockendorf
|
||||||
|
// 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 main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/containerd/cgroups"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
|
"github.com/prometheus/common/log"
|
||||||
|
"github.com/prometheus/common/version"
|
||||||
|
"gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
namespace = "cgroup"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
defCgroupRoot = "/sys/fs/cgroup"
|
||||||
|
configPaths = kingpin.Flag("config.paths", "Comma separated list of cgroup paths to check, eg /users.slice,/system.slice,/slurm").Required().String()
|
||||||
|
listenAddress = kingpin.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9304").String()
|
||||||
|
disableExporterMetrics = kingpin.Flag("web.disable-exporter-metrics", "Exclude metrics about the exporter (promhttp_*, process_*, go_*)").Default("false").Bool()
|
||||||
|
cgroupRoot = kingpin.Flag("path.cgroup.root", "Root path to cgroup fs").Default(defCgroupRoot).String()
|
||||||
|
)
|
||||||
|
|
||||||
|
type CgroupMetric struct {
|
||||||
|
name string
|
||||||
|
cpuUser float64
|
||||||
|
cpuSystem float64
|
||||||
|
cpuTotal float64
|
||||||
|
cpus int
|
||||||
|
memoryUsed float64
|
||||||
|
memoryTotal float64
|
||||||
|
}
|
||||||
|
|
||||||
|
type Exporter struct {
|
||||||
|
paths []string
|
||||||
|
cpuUser *prometheus.Desc
|
||||||
|
cpuSystem *prometheus.Desc
|
||||||
|
cpuTotal *prometheus.Desc
|
||||||
|
cpus *prometheus.Desc
|
||||||
|
memoryUsed *prometheus.Desc
|
||||||
|
memoryTotal *prometheus.Desc
|
||||||
|
success *prometheus.Desc
|
||||||
|
}
|
||||||
|
|
||||||
|
func fileExists(filename string) bool {
|
||||||
|
info, err := os.Stat(filename)
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return !info.IsDir()
|
||||||
|
}
|
||||||
|
|
||||||
|
func sliceContains(slice []string, str string) bool {
|
||||||
|
for _, s := range slice {
|
||||||
|
if str == s {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func subsystem() ([]cgroups.Subsystem, error) {
|
||||||
|
s := []cgroups.Subsystem{
|
||||||
|
cgroups.NewCpuacct(*cgroupRoot),
|
||||||
|
cgroups.NewMemory(*cgroupRoot),
|
||||||
|
}
|
||||||
|
return s, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseCpuSet(cpuset string) (int, error) {
|
||||||
|
var cpus int
|
||||||
|
if cpuset == "" {
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
|
ranges := strings.Split(cpuset, ",")
|
||||||
|
for _, r := range ranges {
|
||||||
|
boundaries := strings.Split(r, "-")
|
||||||
|
if len(boundaries) == 1 {
|
||||||
|
cpus++
|
||||||
|
} else if len(boundaries) == 2 {
|
||||||
|
start, err := strconv.Atoi(boundaries[0])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
end, err := strconv.Atoi(boundaries[1])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
for e := start; e <= end; e++ {
|
||||||
|
cpus++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cpus, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewExporter(paths []string) *Exporter {
|
||||||
|
return &Exporter{
|
||||||
|
paths: paths,
|
||||||
|
cpuUser: prometheus.NewDesc(prometheus.BuildFQName(namespace, "cpu", "user_seconds"),
|
||||||
|
"Cumalitive CPU user seconds for cgroup", []string{"cgroup"}, nil),
|
||||||
|
cpuSystem: prometheus.NewDesc(prometheus.BuildFQName(namespace, "cpu", "kernel_seconds"),
|
||||||
|
"Cumalitive CPU kernel seconds for cgroup", []string{"cgroup"}, nil),
|
||||||
|
cpuTotal: prometheus.NewDesc(prometheus.BuildFQName(namespace, "cpu", "total_seconds"),
|
||||||
|
"Cumalitive CPU total seconds for cgroup", []string{"cgroup"}, nil),
|
||||||
|
cpus: prometheus.NewDesc(prometheus.BuildFQName(namespace, "", "cpus"),
|
||||||
|
"Number of CPUs in the cgroup", []string{"cgroup"}, nil),
|
||||||
|
memoryUsed: prometheus.NewDesc(prometheus.BuildFQName(namespace, "memory", "used_bytes"),
|
||||||
|
"Memory used in bytes", []string{"cgroup"}, nil),
|
||||||
|
memoryTotal: prometheus.NewDesc(prometheus.BuildFQName(namespace, "memory", "total_bytes"),
|
||||||
|
"Memory total given to cgroup in bytes", []string{"cgroup"}, nil),
|
||||||
|
success: prometheus.NewDesc(prometheus.BuildFQName(namespace, "exporter", "success"),
|
||||||
|
"Exporter status, 1=successful 0=errors", nil, nil),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Exporter) collect() ([]CgroupMetric, error) {
|
||||||
|
var names []string
|
||||||
|
var metrics []CgroupMetric
|
||||||
|
for _, path := range e.paths {
|
||||||
|
control, err := cgroups.Load(subsystem, cgroups.StaticPath(path))
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Error loading cgroup subsystem path %s: %s", path, err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
processes, err := control.Processes(cgroups.Cpuacct, true)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Error loading cgroup processes for path %s: %s", path, err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, p := range processes {
|
||||||
|
cpuacctPath := filepath.Join(*cgroupRoot, "cpuacct")
|
||||||
|
name := strings.TrimPrefix(p.Path, cpuacctPath)
|
||||||
|
name = strings.TrimSuffix(name, "/")
|
||||||
|
if sliceContains(names, name) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
names = append(names, name)
|
||||||
|
metric := CgroupMetric{name: name}
|
||||||
|
ctrl, err := cgroups.Load(subsystem, func(subsystem cgroups.Name) (string, error) {
|
||||||
|
return name, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Failed to load cgroups for %s: %s", name, err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
stats, _ := ctrl.Stat(cgroups.IgnoreNotExist)
|
||||||
|
metric.cpuUser = float64(stats.CPU.Usage.User) / 1000000000.0
|
||||||
|
metric.cpuSystem = float64(stats.CPU.Usage.Kernel) / 1000000000.0
|
||||||
|
metric.cpuTotal = float64(stats.CPU.Usage.Total) / 1000000000.0
|
||||||
|
metric.memoryUsed = float64(stats.Memory.Usage.Usage)
|
||||||
|
metric.memoryTotal = float64(stats.Memory.Usage.Limit)
|
||||||
|
cpusData, _ := ioutil.ReadFile(fmt.Sprintf("/sys/fs/cgroup/cpuset%s/cpuset.cpus", name))
|
||||||
|
cpus, err := parseCpuSet(string(cpusData))
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Error parsing cpu set %s", err.Error())
|
||||||
|
} else {
|
||||||
|
metric.cpus = cpus
|
||||||
|
}
|
||||||
|
metrics = append(metrics, metric)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return metrics, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
|
||||||
|
ch <- e.cpuUser
|
||||||
|
ch <- e.cpuSystem
|
||||||
|
ch <- e.cpuTotal
|
||||||
|
ch <- e.cpus
|
||||||
|
ch <- e.memoryUsed
|
||||||
|
ch <- e.memoryTotal
|
||||||
|
ch <- e.success
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
|
||||||
|
metrics, err := e.collect()
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Exporter error: %s", err.Error())
|
||||||
|
ch <- prometheus.MustNewConstMetric(e.success, prometheus.GaugeValue, 0)
|
||||||
|
} else {
|
||||||
|
ch <- prometheus.MustNewConstMetric(e.success, prometheus.GaugeValue, 1)
|
||||||
|
}
|
||||||
|
for _, m := range metrics {
|
||||||
|
ch <- prometheus.MustNewConstMetric(e.cpuUser, prometheus.GaugeValue, m.cpuUser, m.name)
|
||||||
|
ch <- prometheus.MustNewConstMetric(e.cpuSystem, prometheus.GaugeValue, m.cpuSystem, m.name)
|
||||||
|
ch <- prometheus.MustNewConstMetric(e.cpuTotal, prometheus.GaugeValue, m.cpuTotal, m.name)
|
||||||
|
ch <- prometheus.MustNewConstMetric(e.cpus, prometheus.GaugeValue, float64(m.cpus), m.name)
|
||||||
|
ch <- prometheus.MustNewConstMetric(e.memoryUsed, prometheus.GaugeValue, m.memoryUsed, m.name)
|
||||||
|
ch <- prometheus.MustNewConstMetric(e.memoryTotal, prometheus.GaugeValue, m.memoryTotal, m.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func metricsHandler() http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
registry := prometheus.NewRegistry()
|
||||||
|
|
||||||
|
paths := strings.Split(*configPaths, ",")
|
||||||
|
|
||||||
|
exporter := NewExporter(paths)
|
||||||
|
registry.MustRegister(exporter)
|
||||||
|
|
||||||
|
gatherers := prometheus.Gatherers{registry}
|
||||||
|
if !*disableExporterMetrics {
|
||||||
|
gatherers = append(gatherers, prometheus.DefaultGatherer)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delegate http serving to Prometheus client library, which will call collector.Collect.
|
||||||
|
h := promhttp.HandlerFor(gatherers, promhttp.HandlerOpts{})
|
||||||
|
h.ServeHTTP(w, r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
metricsEndpoint := "/metrics"
|
||||||
|
log.AddFlags(kingpin.CommandLine)
|
||||||
|
kingpin.Version(version.Print("cgroup_exporter"))
|
||||||
|
kingpin.HelpFlag.Short('h')
|
||||||
|
kingpin.Parse()
|
||||||
|
|
||||||
|
log.Infoln("Starting cgroup_exporter", version.Info())
|
||||||
|
log.Infoln("Build context", version.BuildContext())
|
||||||
|
log.Infoln("Starting Server:", *listenAddress)
|
||||||
|
|
||||||
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
//nolint:errcheck
|
||||||
|
w.Write([]byte(`<html>
|
||||||
|
<head><title>cgroup Exporter</title></head>
|
||||||
|
<body>
|
||||||
|
<h1>cgroup Exporter</h1>
|
||||||
|
<p><a href='` + metricsEndpoint + `'>Metrics</a></p>
|
||||||
|
</body>
|
||||||
|
</html>`))
|
||||||
|
})
|
||||||
|
http.Handle(metricsEndpoint, metricsHandler())
|
||||||
|
log.Fatal(http.ListenAndServe(*listenAddress, nil))
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestParseCpuSet(t *testing.T) {
|
||||||
|
if cpus, err := parseCpuSet("0-2"); err != nil {
|
||||||
|
t.Errorf("Unexpected error: %s", err.Error())
|
||||||
|
} else if cpus != 3 {
|
||||||
|
t.Errorf("Unexpected cpus, expected 3 got %d", cpus)
|
||||||
|
}
|
||||||
|
if cpus, err := parseCpuSet("0-1,4-5,8-9"); err != nil {
|
||||||
|
t.Errorf("Unexpected error: %s", err.Error())
|
||||||
|
} else if cpus != 6 {
|
||||||
|
t.Errorf("Unexpected cpus, expected 6 got %d", cpus)
|
||||||
|
}
|
||||||
|
if cpus, err := parseCpuSet("1,3,5,7"); err != nil {
|
||||||
|
t.Errorf("Unexpected error: %s", err.Error())
|
||||||
|
} else if cpus != 4 {
|
||||||
|
t.Errorf("Unexpected cpus, expected 4 got %d", cpus)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCollectUserSlice(t *testing.T) {
|
||||||
|
if _, err := kingpin.CommandLine.Parse([]string{"--config.paths=/user.slice"}); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
_, filename, _, _ := runtime.Caller(0)
|
||||||
|
dir := filepath.Dir(filename)
|
||||||
|
fixture := filepath.Join(dir, "test")
|
||||||
|
cgroupRoot = &fixture
|
||||||
|
|
||||||
|
exporter := NewExporter([]string{"/user.slice"})
|
||||||
|
metrics, err := exporter.collect()
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Unexpected error: %s", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if val := len(metrics); val != 1 {
|
||||||
|
t.Errorf("Unexpected number of metrics, got %d expected 1", val)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if val := metrics[0].cpuUser; val != 0.41 {
|
||||||
|
t.Errorf("Unexpected value for cpuUser, got %v", val)
|
||||||
|
}
|
||||||
|
if val := metrics[0].cpuSystem; val != 0.39 {
|
||||||
|
t.Errorf("Unexpected value for cpuSystem, got %v", val)
|
||||||
|
}
|
||||||
|
if val := metrics[0].cpuTotal; val != 0.831825022 {
|
||||||
|
t.Errorf("Unexpected value for cpuTotal, got %v", val)
|
||||||
|
}
|
||||||
|
if val := metrics[0].cpus; val != 0 {
|
||||||
|
t.Errorf("Unexpected value for cpus, got %v", val)
|
||||||
|
}
|
||||||
|
if val := metrics[0].memoryUsed; val != 8081408 {
|
||||||
|
t.Errorf("Unexpected value for memoryUsed, got %v", val)
|
||||||
|
}
|
||||||
|
if val := metrics[0].memoryTotal; val != 68719476736 {
|
||||||
|
t.Errorf("Unexpected value for memoryTotal, got %v", val)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
module github.com/treydock/cgroup_exporter
|
||||||
|
|
||||||
|
go 1.13
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/containerd/cgroups v0.0.0-20200204152634-780d21166089
|
||||||
|
github.com/prometheus/client_golang v1.4.1
|
||||||
|
github.com/prometheus/common v0.9.1
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6
|
||||||
|
)
|
|
@ -0,0 +1,118 @@
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
|
||||||
|
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 h1:Hs82Z41s6SdL1CELW+XaDYmOH4hkBN4/N9og/AsOv7E=
|
||||||
|
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
|
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||||
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
|
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
||||||
|
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg=
|
||||||
|
github.com/containerd/cgroups v0.0.0-20200204152634-780d21166089 h1:46njUssIX9eslqKlbyuL1F8Gu0h4vSXQjId1WAEo/Ew=
|
||||||
|
github.com/containerd/cgroups v0.0.0-20200204152634-780d21166089/go.mod h1:CStdkl05lBnJej94BPFoJ7vB8cELKXwViS+dgfW0/M8=
|
||||||
|
github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQamW5YV28=
|
||||||
|
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
|
||||||
|
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||||
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
|
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
|
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||||
|
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||||
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME=
|
||||||
|
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
|
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
|
||||||
|
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||||
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||||
|
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
|
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||||
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||||
|
github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700 h1:eNUVfm/RFLIi1G7flU5/ZRTHvd4kcVuzfRnL6OFlzCI=
|
||||||
|
github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||||
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||||
|
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||||
|
github.com/prometheus/client_golang v1.4.1 h1:FFSuS004yOQEtDdTq+TAOLP5xUq63KqAFYyOi8zA+Y8=
|
||||||
|
github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
|
||||||
|
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/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
|
||||||
|
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
|
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||||
|
github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U=
|
||||||
|
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
||||||
|
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/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8=
|
||||||
|
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
||||||
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
|
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=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200120151820-655fe14d7479/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU=
|
||||||
|
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1,4 @@
|
||||||
|
99062
|
||||||
|
99080
|
||||||
|
99081
|
||||||
|
100190
|
|
@ -0,0 +1 @@
|
||||||
|
100000
|
|
@ -0,0 +1 @@
|
||||||
|
700000
|
|
@ -0,0 +1 @@
|
||||||
|
1000000
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1 @@
|
||||||
|
1024
|
|
@ -0,0 +1,3 @@
|
||||||
|
nr_periods 108
|
||||||
|
nr_throttled 0
|
||||||
|
throttled_time 0
|
|
@ -0,0 +1,2 @@
|
||||||
|
user 41
|
||||||
|
system 39
|
|
@ -0,0 +1 @@
|
||||||
|
831825022
|
|
@ -0,0 +1 @@
|
||||||
|
61450 0 159510184 194806141 30260284 104075880 27756977 11958754 17386097 3137240 4204283 2139986 2746800 24278319 0 2911961 97630563 480379 8984897 620214 7042341 0 61568952 0 38486957 0 8403565 0 18531243 0 569211 0 128518 0 193825 0 2063712 598605 1459026 0
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1,4 @@
|
||||||
|
99062
|
||||||
|
99080
|
||||||
|
99081
|
||||||
|
100190
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1,4 @@
|
||||||
|
99062
|
||||||
|
99080
|
||||||
|
99081
|
||||||
|
100666
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1 @@
|
||||||
|
9223372036854771712
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1 @@
|
||||||
|
9223372036854771712
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1 @@
|
||||||
|
68719476736
|
|
@ -0,0 +1 @@
|
||||||
|
13008896
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1 @@
|
||||||
|
9223372036854771712
|
|
@ -0,0 +1 @@
|
||||||
|
13008896
|
|
@ -0,0 +1 @@
|
||||||
|
8081408
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1,4 @@
|
||||||
|
total=1875 N0=1251 N1=624
|
||||||
|
file=564 N0=117 N1=447
|
||||||
|
anon=1311 N0=1134 N1=177
|
||||||
|
unevictable=0 N0=0 N1=0
|
|
@ -0,0 +1,2 @@
|
||||||
|
oom_kill_disable 0
|
||||||
|
under_oom 0
|
|
@ -0,0 +1 @@
|
||||||
|
9223372036854771712
|
|
@ -0,0 +1,30 @@
|
||||||
|
cache 2322432
|
||||||
|
rss 5378048
|
||||||
|
rss_huge 0
|
||||||
|
mapped_file 0
|
||||||
|
swap 0
|
||||||
|
pgpgin 33876
|
||||||
|
pgpgout 31996
|
||||||
|
pgfault 124973
|
||||||
|
pgmajfault 0
|
||||||
|
inactive_anon 0
|
||||||
|
active_anon 5373952
|
||||||
|
inactive_file 454656
|
||||||
|
active_file 1867776
|
||||||
|
unevictable 0
|
||||||
|
hierarchical_memory_limit 68719476736
|
||||||
|
hierarchical_memsw_limit 9223372036854771712
|
||||||
|
total_cache 2322432
|
||||||
|
total_rss 5378048
|
||||||
|
total_rss_huge 0
|
||||||
|
total_mapped_file 0
|
||||||
|
total_swap 0
|
||||||
|
total_pgpgin 33876
|
||||||
|
total_pgpgout 31996
|
||||||
|
total_pgfault 124973
|
||||||
|
total_pgmajfault 0
|
||||||
|
total_inactive_anon 0
|
||||||
|
total_active_anon 5373952
|
||||||
|
total_inactive_file 454656
|
||||||
|
total_active_file 1867776
|
||||||
|
total_unevictable 0
|
|
@ -0,0 +1 @@
|
||||||
|
60
|
|
@ -0,0 +1 @@
|
||||||
|
8081408
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1,4 @@
|
||||||
|
99062
|
||||||
|
99080
|
||||||
|
99081
|
||||||
|
100666
|
Loading…
Reference in New Issue