Skip to content

Commit

Permalink
move runtime debug funcs in own package (prometheus#4494)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
krasi-georgiev authored Aug 22, 2018
1 parent f3b7c22 commit 12fe204
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 11 deletions.
7 changes: 4 additions & 3 deletions cmd/prometheus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// +build !windows

package main
package runtime

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// +build windows

package main
package runtime

// FdLimits not supported on Windows
func FdLimits() string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// +build !linux

package main
package runtime

import "runtime"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package main
package runtime

import (
"log"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// +build !windows
// +build !openbsd

package main
package runtime

import (
"syscall"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// +build openbsd

package main
package runtime

import (
"syscall"
Expand Down

0 comments on commit 12fe204

Please sign in to comment.