move runtime debug funcs in own package (#4494)

To make local debuging with `go run` easyer moved all files into a
dedicate package `runtime`.
This allows running prometheus just by using `go run main.go` instead of
passing mani files like `go run main.go limits_default.go ...`

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
This commit is contained in:
Krasi Georgiev 2018-08-22 13:41:11 +03:00 committed by GitHub
parent f3b7c22827
commit 12fe204ea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 12 additions and 11 deletions

View File

@ -39,6 +39,7 @@ import (
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"
"github.com/prometheus/common/version" "github.com/prometheus/common/version"
prom_runtime "github.com/prometheus/prometheus/pkg/runtime"
"gopkg.in/alecthomas/kingpin.v2" "gopkg.in/alecthomas/kingpin.v2"
k8s_runtime "k8s.io/apimachinery/pkg/util/runtime" k8s_runtime "k8s.io/apimachinery/pkg/util/runtime"
@ -229,9 +230,9 @@ func main() {
level.Info(logger).Log("msg", "Starting Prometheus", "version", version.Info()) level.Info(logger).Log("msg", "Starting Prometheus", "version", version.Info())
level.Info(logger).Log("build_context", version.BuildContext()) level.Info(logger).Log("build_context", version.BuildContext())
level.Info(logger).Log("host_details", Uname()) level.Info(logger).Log("host_details", prom_runtime.Uname())
level.Info(logger).Log("fd_limits", FdLimits()) level.Info(logger).Log("fd_limits", prom_runtime.FdLimits())
level.Info(logger).Log("vm_limits", VmLimits()) level.Info(logger).Log("vm_limits", prom_runtime.VmLimits())
var ( var (
localStorage = &tsdb.ReadyStorage{} localStorage = &tsdb.ReadyStorage{}

View File

@ -13,7 +13,7 @@
// +build !windows // +build !windows
package main package runtime
import ( import (
"fmt" "fmt"

View File

@ -13,7 +13,7 @@
// +build windows // +build windows
package main package runtime
// FdLimits not supported on Windows // FdLimits not supported on Windows
func FdLimits() string { func FdLimits() string {

View File

@ -13,7 +13,7 @@
// +build !linux // +build !linux
package main package runtime
import "runtime" import "runtime"

View File

@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package main package runtime
import ( import (
"log" "log"

View File

@ -14,7 +14,7 @@
// +build 386 amd64 arm64 mips64 mips64le mips mipsle // +build 386 amd64 arm64 mips64 mips64le mips mipsle
// +build linux // +build linux
package main package runtime
func charsToString(ca []int8) string { func charsToString(ca []int8) string {
s := make([]byte, 0, len(ca)) s := make([]byte, 0, len(ca))

View File

@ -14,7 +14,7 @@
// +build arm ppc64 ppc64le s390x // +build arm ppc64 ppc64le s390x
// +build linux // +build linux
package main package runtime
func charsToString(ca []uint8) string { func charsToString(ca []uint8) string {
s := make([]byte, 0, len(ca)) s := make([]byte, 0, len(ca))

View File

@ -14,7 +14,7 @@
// +build !windows // +build !windows
// +build !openbsd // +build !openbsd
package main package runtime
import ( import (
"syscall" "syscall"

View File

@ -13,7 +13,7 @@
// +build openbsd // +build openbsd
package main package runtime
import ( import (
"syscall" "syscall"