private SupportedPlatform detectSupportedPlatform()

in detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detection/GCPPlatformDetector.java [44:62]


  private SupportedPlatform detectSupportedPlatform() {
    if (!isRunningOnGcp()) {
      return SupportedPlatform.UNKNOWN_PLATFORM;
    }
    // Note: Order of detection matters here
    if (environmentVariables.get("KUBERNETES_SERVICE_HOST") != null) {
      return SupportedPlatform.GOOGLE_KUBERNETES_ENGINE;
    } else if (environmentVariables.get("K_CONFIGURATION") != null
        && environmentVariables.get("FUNCTION_TARGET") == null) {
      return SupportedPlatform.GOOGLE_CLOUD_RUN;
    } else if (environmentVariables.get("FUNCTION_TARGET") != null) {
      return SupportedPlatform.GOOGLE_CLOUD_FUNCTIONS;
    } else if (environmentVariables.get("CLOUD_RUN_JOB") != null) {
      return SupportedPlatform.GOOGLE_CLOUD_RUN_JOB;
    } else if (environmentVariables.get("GAE_SERVICE") != null) {
      return SupportedPlatform.GOOGLE_APP_ENGINE;
    }
    return SupportedPlatform.GOOGLE_COMPUTE_ENGINE; // default to GCE
  }