opencensus-go-exporter-stackdriver
opencensus-go-exporter-stackdriver copied to clipboard
MonitoredResource.Autodetect could be more useful running locally
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