mirror of
https://github.com/weaveworks/scope.git
synced 2026-04-22 02:18:15 +00:00
- Add store of pipes in the app - Add pipe type, handling impedance mismatch, used in app and probe. - App <-> Probe pipes have their own websockets. - Add pipe websocket endpoint in app. - Pipe IDs are strings, lose the request/response IDs, and give the json encoder lowercase field names. - Add simple golang ws client, for testing. - Pipe lifecycle plumbing. - Ref count and timeout both ends of pipes in the app - Deal with POST /api/pipe/:pid?_method=delete - Add end-to-end unit test for pipes. - Add test for timing out pipes. - Update go-docker client to tomwilkie/go-dockerclient - Backend work for non-raw ttys - Close pipes when they close themselves in the probe - Ensure all http connections are done before returning from client.Stop()
51 lines
1000 B
Go
51 lines
1000 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()
|
|
|
|
client, err := xfer.NewAppClient(xfer.ProbeConfig{
|
|
Token: "fixprobe",
|
|
ProbeID: "fixprobe",
|
|
Insecure: false,
|
|
}, *publish, *publish, nil)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
rp := xfer.NewReportPublisher(client)
|
|
for range time.Tick(*publishInterval) {
|
|
rp.Publish(fixedReport)
|
|
}
|
|
}
|