Forward OS/Kernel version to checkpoint

Useful to prioritize ebpf testing

Also:
* Make treatment of kernel release and version consistent across Darwin/Linux
This commit is contained in:
Alfonso Acosta
2016-12-19 13:27:17 +00:00
parent e70f2b98c0
commit 06ff64d477
9 changed files with 48 additions and 26 deletions

View File

@@ -246,6 +246,7 @@ func appMain(flags appFlags) {
checkpoint.CheckInterval(&checkpoint.CheckParams{
Product: "scope-app",
Version: app.Version,
Flags: makeBaseCheckpointFlags(),
}, versionCheckPeriod, func(r *checkpoint.CheckResponse, err error) {
if err != nil {
log.Errorf("Error checking version: %v", err)

View File

@@ -7,6 +7,7 @@ import (
"net"
"os"
"regexp"
"runtime"
"strconv"
"strings"
"time"
@@ -16,6 +17,7 @@ import (
"github.com/weaveworks/scope/app"
"github.com/weaveworks/scope/common/xfer"
"github.com/weaveworks/scope/probe/appclient"
"github.com/weaveworks/scope/probe/host"
"github.com/weaveworks/scope/probe/kubernetes"
"github.com/weaveworks/scope/render"
"github.com/weaveworks/weave/common"
@@ -215,6 +217,18 @@ func logCensoredArgs() {
log.Infof("command line args:%s", prettyPrintedArgs)
}
func makeBaseCheckpointFlags() map[string]string {
release, _, err := host.GetKernelReleaseAndVersion()
if err != nil {
release = "unknown"
}
return map[string]string{
// Inconsistent key (using a dash) to match Weave Net
"kernel-version": release,
"os": runtime.GOOS,
}
}
func main() {
var (
flags = flags{}

View File

@@ -91,7 +91,8 @@ func probeMain(flags probeFlags, targets []appclient.Target) {
hostID = hostName // TODO(pb): we should sanitize the hostname
)
log.Infof("probe starting, version %s, ID %s", version, probeID)
checkpointFlags := map[string]string{}
checkpointFlags := makeBaseCheckpointFlags()
if flags.kubernetesEnabled {
checkpointFlags["kubernetes_enabled"] = "true"
}