@@ -115,6 +115,15 @@ var awsResourceMap = map[string]string{
115
115
"aws_account" : CloudKeyAccountID ,
116
116
}
117
117
118
+ // For generic_task, assume there's no further transformation required. Still
119
+ // provide a map here to check the existence of the required labels.
120
+ var genericTaskMap = map [string ]string {
121
+ "task_id" : "task_id" ,
122
+ "location" : "location" ,
123
+ "namespace" : "namespace" ,
124
+ "job" : "job" ,
125
+ }
126
+
118
127
// newMetricExporter returns an exporter that uploads OTel metric data to Google Cloud Monitoring.
119
128
func newMetricExporter (o * options ) (* metricExporter , error ) {
120
129
if strings .TrimSpace (o .ProjectID ) == "" {
@@ -335,6 +344,7 @@ func subdivideGCPTypes(labelMap map[string]string) (string, map[string]string) {
335
344
_ , hasNamespaceName := labelMap [K8SKeyNamespaceName ]
336
345
_ , hasPodName := labelMap [K8SKeyPodName ]
337
346
_ , hasContainerName := labelMap [ContainerKeyName ]
347
+ _ , hasTaskID := labelMap [TaskID ]
338
348
339
349
if hasLocation && hasClusterName && hasNamespaceName && hasPodName && hasContainerName {
340
350
return K8SContainer , k8sContainerMap
@@ -354,6 +364,10 @@ func subdivideGCPTypes(labelMap map[string]string) (string, map[string]string) {
354
364
return K8SCluster , k8sClusterMap
355
365
}
356
366
367
+ if hasTaskID {
368
+ return GenericTask , genericTaskMap
369
+ }
370
+
357
371
return GCEInstance , gceResourceMap
358
372
}
359
373
0 commit comments