String getRegionFromZone()

in detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detection/GCPMetadataConfig.java [97:108]


  String getRegionFromZone() {
    String region = null;
    String zone = getZone();
    if (zone != null && !zone.isEmpty()) {
      // Parsing required to scope up to a region
      String[] splitArr = zone.split("-");
      if (splitArr.length > 2) {
        region = String.join("-", splitArr[0], splitArr[1]);
      }
    }
    return region;
  }