public static GcpResource mapResource()

in shared/resourcemapping/src/main/java/com/google/cloud/opentelemetry/resource/ResourceTranslator.java [172:187]


  public static GcpResource mapResource(Resource resource) {
    String platform = resource.getAttribute(ResourceAttributes.CLOUD_PLATFORM);
    if (platform == null) {
      return mapK8sResourceOrGenericTaskOrNode(resource);
    }
    switch (platform) {
      case ResourceAttributes.CloudPlatformValues.GCP_COMPUTE_ENGINE:
        return mapBase(resource, "gce_instance", GCE_INSTANCE_LABELS);
      case ResourceAttributes.CloudPlatformValues.AWS_EC2:
        return mapBase(resource, "aws_ec2_instance", AWS_EC2_INSTANCE_LABELS);
      case ResourceAttributes.CloudPlatformValues.GCP_APP_ENGINE:
        return mapBase(resource, "gae_instance", GOOGLE_CLOUD_APP_ENGINE_INSTANCE_LABELS);
      default:
        return mapK8sResourceOrGenericTaskOrNode(resource);
    }
  }