in packages/opentelemetry-resource-util/src/detector/gke.ts [51:68]
export async function availabilityZoneOrRegion(): Promise<{
type: 'zone' | 'region';
value: string;
}> {
const clusterLocation = await metadata.instance<string>(
CLUSTER_LOCATION_METADATA_ATTR
);
switch (countChar(clusterLocation, '-')) {
case 1:
return {type: 'region', value: clusterLocation};
case 2:
return {type: 'zone', value: clusterLocation};
default:
throw new Error(
`unrecognized format for cluster location: ${clusterLocation}`
);
}
}