async function detect()

in packages/opentelemetry-resource-util/src/detector/detector.ts [44:64]


async function detect(): Promise<Resource> {
  if (!(await metadata.isAvailable())) {
    return Resource.EMPTY;
  }

  // Note the order of these if checks is significant with more specific resources coming
  // first. E.g. Cloud Functions gen2 are executed in Cloud Run so it must be checked first.
  if (await gke.onGke()) {
    return await gkeResource();
  } else if (await faas.onCloudFunctions()) {
    return await cloudFunctionsResource();
  } else if (await faas.onCloudRun()) {
    return await cloudRunResource();
  } else if (await gae.onAppEngine()) {
    return await gaeResource();
  } else if (await gce.onGce()) {
    return await gceResource();
  }

  return Resource.EMPTY;
}