appdash icon indicating copy to clipboard operation
appdash copied to clipboard

Setting up appdash in Go, not seeing traces

Open sethgrid opened this issue 6 years ago • 1 comments

Hi all. Couldn't ask on slack as the link on the README is dead. When I used the in-app example code, I got traces to a local running appdash instance. I'm now trying to connect to a already running appdash instance and not getting traces. I think I'm setting up the tracer wrong. Any help?

// my app.go
tracer := appdashtracer.NewTracer(appdash.NewRemoteCollector("appdash.service.consul:8700"))

edit Saw an example using chunked collector. Tried that, it did not work either. Still not seeing traces (appDashAddr is the same as above, appdash.service.consul:8700).

// my app.go
collector := appdash.NewRemoteCollector(appDashAddr)
chunkedCollector := appdash.NewChunkedCollector(collector)
tracer := appdashtracer.NewTracer(chunkedCollector)

2nd edit updated to the following. Still no traces. No logs either.

logger := log.New(os.Stdout, "appdash", log.Lshortfile|log.Ltime)
collector := appdash.NewRemoteCollector(appDashAddr)
chunkedCollector := appdash.NewChunkedCollector(collector)
tracer := appdashtracer.NewTracerWithOptions(chunkedCollector, appdashtracer.Options{
	Verbose: true,
	Logger:  logger,
})

*** end edits ***

I can hit appdash.service.consul:8700 and it comes up. But no traces to be found.

The separately running appdash instance looks like:

// separate server running appdash
func main() {
	var minEvictAge time.Duration
	var port int

	flag.DurationVar(&minEvictAge, "min-evict-age", 5*time.Minute, "set the amount of time the tracer will hold onto traces")
	flag.IntVar(&port, "port", 8700, "the port on which the for app dash tracer will run")
	flag.Parse()

	memStore := appdash.NewMemoryStore()
	store := &appdash.RecentStore{
		MinEvictAge: minEvictAge,
		DeleteStore: memStore,
	}

	appDashURLString := fmt.Sprintf("http://localhost:%d", port)
	appDashURL, err := url.Parse(appDashURLString)
	if err != nil {
		log.Fatal(err)
	}
	tapp, err := traceapp.New(nil, appDashURL)
	if err != nil {
		log.Fatal(err)
	}
	tapp.Store = store
	tapp.Queryer = memStore

	log.Printf("starting on :%d", port)
	log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), tapp))
}

sethgrid avatar Jan 04 '19 21:01 sethgrid

cc @slimsag

keegancsmith avatar Jan 07 '19 17:01 keegancsmith