@@ -226,11 +226,23 @@ func TestResourceDetectionTrace(t *testing.T) {
226226 t .Skip ("Local runs do not need to test resource detection" )
227227 case args .Gce != nil :
228228 labelCases = append (labelCases ,
229- labelExpectation {expectKey : "g.co/r/gce_instance/zone" , expectRe : `.*-.*-.*` },
230- labelExpectation {expectKey : "g.co/r/gce_instance/instance_id" , expectRe : `.*` },
229+ labelExpectation {expectKey : "cloud.provider" , expectRe : `gcp` },
230+ labelExpectation {expectKey : "cloud.platform" , expectRe : `gcp_compute_engine` },
231+ labelExpectation {expectKey : "cloud.region" , expectRe : `.*-.*` },
232+ labelExpectation {expectKey : "cloud.availability_zone" , expectRe : `.*-.*-.*` },
233+ labelExpectation {expectKey : "host.id" , expectRe : `.*` },
231234 )
232235 case args .Gke != nil :
233236 labelCases = append (labelCases ,
237+ labelExpectation {expectKey : "cloud.provider" , expectRe : `gcp` },
238+ labelExpectation {expectKey : "cloud.platform" , expectRe : `gcp_kubernetes_engine` },
239+ labelExpectation {expectKey : "cloud.region" , expectRe : `.*-.*` },
240+ labelExpectation {expectKey : "k8s.cluster.name" , expectRe : `.*` },
241+ labelExpectation {expectKey : "k8s.namespace.name" , expectRe : `.*` },
242+ labelExpectation {expectKey : "k8s.pod.name" , expectRe : `.*` },
243+ labelExpectation {expectKey : "k8s.container.name" , expectRe : `.*` },
244+ // Check for cannonical labels for GKE:
245+ // https://cloud.google.com/trace/docs/trace-labels#canonical-gke
234246 labelExpectation {expectKey : "g.co/r/k8s_container/location" , expectRe : `.*-.*` },
235247 labelExpectation {expectKey : "g.co/r/k8s_container/cluster_name" , expectRe : `.*` },
236248 labelExpectation {expectKey : "g.co/r/k8s_container/namespace_name" , expectRe : `.*` },
@@ -239,22 +251,31 @@ func TestResourceDetectionTrace(t *testing.T) {
239251 )
240252 case args .CloudRun != nil :
241253 labelCases = append (labelCases ,
242- labelExpectation {expectKey : "g.co/r/cloud_run_revision/location" , expectRe : `.*-.*` },
243- labelExpectation {expectKey : "g.co/r/cloud_run_revision/service_name" , expectRe : `.*` },
244- labelExpectation {expectKey : "g.co/r/cloud_run_revision/configuration_name" , expectRe : `.*` },
245- labelExpectation {expectKey : "g.co/r/cloud_run_revision/revision_name" , expectRe : `.*` },
254+ labelExpectation {expectKey : "cloud.provider" , expectRe : `gcp` },
255+ labelExpectation {expectKey : "cloud.platform" , expectRe : `gcp_cloud_run` },
256+ labelExpectation {expectKey : "cloud.region" , expectRe : `.*-.*` },
257+ labelExpectation {expectKey : "faas.name" , expectRe : `.*` },
258+ labelExpectation {expectKey : "faas.id" , expectRe : `.*` },
259+ labelExpectation {expectKey : "faas.version" , expectRe : `.*` },
246260 )
247261 case args .CloudFunctionsGen2 != nil :
248262 labelCases = append (labelCases ,
249- labelExpectation {expectKey : "g.co/r/cloud_function/region" , expectRe : `.*-.*` },
250- labelExpectation {expectKey : "g.co/r/cloud_function/function_name" , expectRe : `.*` },
263+ labelExpectation {expectKey : "cloud.provider" , expectRe : `gcp` },
264+ labelExpectation {expectKey : "cloud.platform" , expectRe : `gcp_cloud_functions` },
265+ labelExpectation {expectKey : "cloud.region" , expectRe : `.*-.*` },
266+ labelExpectation {expectKey : "faas.name" , expectRe : `.*` },
267+ labelExpectation {expectKey : "faas.id" , expectRe : `.*` },
268+ labelExpectation {expectKey : "faas.version" , expectRe : `.*` },
251269 )
252270 case args .Gae != nil :
253271 labelCases = append (labelCases ,
254- labelExpectation {expectKey : "g.co/r/gae_instance/module_id" , expectRe : `.*` },
255- labelExpectation {expectKey : "g.co/r/gae_instance/version_id" , expectRe : `.*` },
256- labelExpectation {expectKey : "g.co/r/gae_instance/instance_id" , expectRe : `.*` },
257- labelExpectation {expectKey : "g.co/r/gae_instance/location" , expectRe : `.*-.*` },
272+ labelExpectation {expectKey : "cloud.provider" , expectRe : `gcp` },
273+ labelExpectation {expectKey : "cloud.platform" , expectRe : `gcp_app_engine` },
274+ labelExpectation {expectKey : "cloud.availability_zone" , expectRe : `.*-.*-.*` },
275+ labelExpectation {expectKey : "cloud.region" , expectRe : `.*-.*` },
276+ labelExpectation {expectKey : "faas.name" , expectRe : `.*` },
277+ labelExpectation {expectKey : "faas.id" , expectRe : `.*` },
278+ labelExpectation {expectKey : "faas.version" , expectRe : `.*` },
258279 )
259280 default :
260281 t .Logf ("Unexpected GCP environment provided. Make sure to add handling for all expected GCP environments." )
0 commit comments