Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Setting up appdash in Go, not seeing traces #209

Open
sethgrid opened this issue Jan 4, 2019 · 1 comment
Open

Setting up appdash in Go, not seeing traces #209

sethgrid opened this issue Jan 4, 2019 · 1 comment

Comments

@sethgrid
Copy link

sethgrid commented Jan 4, 2019

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))
}
@keegancsmith
Copy link
Member

cc @slimsag

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants