diff --git a/stackdriver.go b/stackdriver.go index 7524b44..fc96955 100644 --- a/stackdriver.go +++ b/stackdriver.go @@ -346,6 +346,9 @@ func NewExporter(o Options) (*Exporter, error) { } // Populate internal resource labels for defaulting project_id, location, and // generic resource labels of applicable monitored resources. + if res.Labels == nil { + res.Labels = make(map[string]string) + } res.Labels[stackdriverProjectID] = o.ProjectID res.Labels[resourcekeys.CloudKeyZone] = o.Location res.Labels[stackdriverGenericTaskNamespace] = "default"