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/common/model"
"github.com/prometheus/common/version"
prom_runtime "github.com/prometheus/prometheus/pkg/runtime"
"gopkg.in/alecthomas/kingpin.v2"
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("build_context", version.BuildContext())
level.Info(logger).Log("host_details", Uname())
level.Info(logger).Log("fd_limits", FdLimits())
level.Info(logger).Log("vm_limits", VmLimits())
level.Info(logger).Log("host_details", prom_runtime.Uname())
level.Info(logger).Log("fd_limits", prom_runtime.FdLimits())
level.Info(logger).Log("vm_limits", prom_runtime.VmLimits())
var (
localStorage = &tsdb.ReadyStorage{}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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