detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detection/GCPMetadataConfig.java [51:86]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  String getProjectId() {
    return getAttribute("project/project-id");
  }

  /**
   * Method to extract cloud availability zone from the metadata server.
   *
   * <p>Example response: projects/640212054955/zones/australia-southeast1-a
   *
   * <p>Example zone: australia-southeast1-a
   *
   * @return the extracted zone from the metadata server response or null in case of failure to
   *     retrieve from metadata server.
   */
  String getZone() {
    String zone = getAttribute("instance/zone");
    if (zone != null && zone.contains("/")) {
      zone = zone.substring(zone.lastIndexOf('/') + 1);
    }
    return zone;
  }

  /**
   * Use this method only when the region cannot be parsed from the zone. Known use-cases of this
   * method involve detecting region in GAE standard environment.
   *
   * <p>Example response: projects/5689182099321/regions/us-central1.
   *
   * @return the retrieved region or null in case of failure to retrieve from metadata server
   */
  String getRegion() {
    String region = getAttribute("instance/region");
    if (region != null && region.contains("/")) {
      region = region.substring(region.lastIndexOf('/') + 1);
    }
    return region;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



detectors/resources/src/main/java/com/google/cloud/opentelemetry/detectors/GCPMetadataConfig.java [54:77]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  String getProjectId() {
    return getAttribute("project/project-id");
  }

  // Example response: projects/640212054955/zones/australia-southeast1-a
  // Returns null on failure to retrieve from metadata server
  String getZone() {
    String zone = getAttribute("instance/zone");
    if (zone != null && zone.contains("/")) {
      zone = zone.substring(zone.lastIndexOf('/') + 1);
    }
    return zone;
  }

  // Use this method only when the region cannot be parsed from the zone. Known use-cases of this
  // method involve detecting region in GAE standard environment
  // Example response: projects/5689182099321/regions/us-central1
  // Returns null on failure to retrieve from metadata server
  String getRegion() {
    String region = getAttribute("instance/region");
    if (region != null && region.contains("/")) {
      region = region.substring(region.lastIndexOf('/') + 1);
    }
    return region;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



