mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-04 02:30:45 +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.
49 lines
930 B
Go
49 lines
930 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"log"
|
|
"math/rand"
|
|
"net/http"
|
|
_ "net/http/pprof"
|
|
"os"
|
|
"os/signal"
|
|
"strconv"
|
|
"syscall"
|
|
"time"
|
|
|
|
"github.com/weaveworks/scope/xfer"
|
|
)
|
|
|
|
// Set during buildtime.
|
|
var version = "dev"
|
|
|
|
func main() {
|
|
var (
|
|
window = flag.Duration("window", 15*time.Second, "window")
|
|
listen = flag.String("http.address", ":"+strconv.Itoa(xfer.AppPort), "webserver listen address")
|
|
)
|
|
flag.Parse()
|
|
|
|
rand.Seed(time.Now().UnixNano())
|
|
id := strconv.FormatInt(rand.Int63(), 16)
|
|
log.Printf("app starting, version %s, ID %s", version, id)
|
|
|
|
c := xfer.NewCollector(*window)
|
|
http.Handle("/", Router(c))
|
|
irq := interrupt()
|
|
go func() {
|
|
log.Printf("listening on %s", *listen)
|
|
log.Print(http.ListenAndServe(*listen, nil))
|
|
irq <- syscall.SIGINT
|
|
}()
|
|
<-irq
|
|
log.Printf("shutting down")
|
|
}
|
|
|
|
func interrupt() chan os.Signal {
|
|
c := make(chan os.Signal)
|
|
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
|
|
return c
|
|
}
|