opencensus-go-exporter-stackdriver icon indicating copy to clipboard operation
opencensus-go-exporter-stackdriver copied to clipboard

MonitoredResource.Autodetect could be more useful running locally

Open eliben opened this issue 6 years ago • 0 comments

I'm trying to run locally with tracing to Stackdriver (for testing). Calling monitoredresource.AutoDetect() takes a while and returns a nil (unable to detect GCE/GKE/AWS), so the traces go nowhere.

It would be nice if it returned something more use useful for local use, such as a global resource - or had a constructor that would do this. As I workaround I have:

type GlobalMonitoredResource struct {
	projectId string
}

func (g GlobalMonitoredResource) MonitoredResource() (string, map[string]string) {
	return "global", map[string]string{"project_id": g.projectId}
}

And then pass an initialized instance of this struct into sdserver.NewExporter

@zombiezen

eliben avatar Apr 08 '19 22:04 eliben