mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 01:31:17 +00:00
- App takes POST report on /api/report - Probe publishes to configured target(s) - Name resolution happens on probe-side - There's no longer an xfer.ProbePort - xfer.Collector responsibility is reduced - Fixes to remaining experimental components. - rm experimental/bridge: it's not being used, and by changing the app/probe comm model, it would require a complete refactor anyway. We can easily rebuild it when we need to. It will even be much simpler. - rm experimental/graphviz: it's broken for some time anyway, and we don't really need to play around with it as a rendering option anymore. - rm experimental/oneshot: we never use this anymore.
46 lines
883 B
Go
46 lines
883 B
Go
// Publish a fixed report.
|
|
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/weaveworks/scope/report"
|
|
"github.com/weaveworks/scope/xfer"
|
|
)
|
|
|
|
func main() {
|
|
var (
|
|
publish = flag.String("publish", fmt.Sprintf("localhost:%d", xfer.AppPort), "publish target")
|
|
publishInterval = flag.Duration("publish.interval", 1*time.Second, "publish (output) interval")
|
|
)
|
|
flag.Parse()
|
|
|
|
if len(flag.Args()) != 1 {
|
|
log.Fatal("usage: fixprobe [--args] report.json")
|
|
}
|
|
|
|
f, err := os.Open(flag.Arg(0))
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
var fixedReport report.Report
|
|
if err := json.NewDecoder(f).Decode(&fixedReport); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
f.Close()
|
|
|
|
publisher, err := xfer.NewHTTPPublisher(*publish, "fixprobe")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
for range time.Tick(*publishInterval) {
|
|
publisher.Publish(fixedReport)
|
|
}
|
|
}
|