@@ -146,7 +146,7 @@ def _translate_to_cloud_trace(
146146 )
147147
148148 # Span does not support a MonitoredResource object. We put the
149- # information into labels instead.
149+ # information into attributes instead.
150150 resources_and_attrs = _extract_resources (span .resource )
151151 resources_and_attrs .update (span .attributes )
152152
@@ -318,7 +318,7 @@ def _strip_characters(ot_version):
318318 return "" .join (filter (lambda x : x .isdigit () or x == "." , ot_version ))
319319
320320
321- OT_RESOURCE_LABEL_TO_GCP = {
321+ OT_RESOURCE_ATTRIBUTE_TO_GCP = {
322322 "gce_instance" : {
323323 "host.id" : "instance_id" ,
324324 "cloud.account.id" : "project_id" ,
@@ -337,17 +337,17 @@ def _strip_characters(ot_version):
337337
338338
339339def _extract_resources (resource : Resource ) -> Dict [str , str ]:
340- resource_labels = resource .labels
341- if resource_labels .get ("cloud.provider" ) != "gcp" :
340+ resource_attributes = resource .attributes
341+ if resource_attributes .get ("cloud.provider" ) != "gcp" :
342342 return {}
343- resource_type = resource_labels ["gcp.resource_type" ]
344- if resource_type not in OT_RESOURCE_LABEL_TO_GCP :
343+ resource_type = resource_attributes ["gcp.resource_type" ]
344+ if resource_type not in OT_RESOURCE_ATTRIBUTE_TO_GCP :
345345 return {}
346346 return {
347347 "g.co/r/{}/{}" .format (resource_type , gcp_resource_key ,): str (
348- resource_labels [ot_resource_key ]
348+ resource_attributes [ot_resource_key ]
349349 )
350- for ot_resource_key , gcp_resource_key in OT_RESOURCE_LABEL_TO_GCP [
350+ for ot_resource_key , gcp_resource_key in OT_RESOURCE_ATTRIBUTE_TO_GCP [
351351 resource_type
352352 ].items ()
353353 }
0 commit comments