code: def set_attributes(trace):
      
      spans = trace.get('spans')
      for span in spans:
          if span.get('attributes') is None:
              span['attributes'] = {}
  
          if is_gae_environment():
              set_gae_attributes(span)
  
          set_common_attributes(span)
  
          set_monitored_resource_attributes(span)
docs: Automatically set attributes for Google Cloud environment.