2020 * https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/v1.8.0/detectors/gcp/gce.go
2121 */
2222
23- import { diag } from '@opentelemetry/api' ;
23+ import { diag } from '@opentelemetry/api' ;
2424import * as metadata from 'gcp-metadata' ;
2525
2626const MACHINE_TYPE_METADATA_ATTR = 'machine-type' ;
@@ -36,7 +36,7 @@ export async function onGce(): Promise<boolean> {
3636 diag . debug (
3737 'Could not fetch metadata attribute %s, assuming not on GCE. Error was %s' ,
3838 MACHINE_TYPE_METADATA_ATTR ,
39- err ,
39+ err
4040 ) ;
4141 return false ;
4242 }
@@ -57,7 +57,7 @@ export async function hostType(): Promise<string> {
5757export async function hostId ( ) : Promise < string > {
5858 // May be a bignumber.js BigNumber which can just be converted with toString(). See
5959 // https://github.com/googleapis/gcp-metadata#take-care-with-large-number-valued-properties
60- const id = await metadata . instance < number | Object > ( ID_METADATA_ATTR ) ;
60+ const id = await metadata . instance < number | object > ( ID_METADATA_ATTR ) ;
6161 return id . toString ( ) ;
6262}
6363
@@ -82,12 +82,12 @@ export async function availabilityZoneAndRegion(): Promise<{
8282 // Format described in
8383 // https://cloud.google.com/compute/docs/metadata/default-metadata-values#vm_instance_metadata
8484 const re = / p r o j e c t s \/ \d + \/ z o n e s \/ (?< zone > (?< region > \w + - \w + ) - \w + ) / ;
85- const { zone, region} = fullZone . match ( re ) ?. groups ?? { } ;
85+ const { zone, region } = fullZone . match ( re ) ?. groups ?? { } ;
8686 if ( ! zone || ! region ) {
8787 throw new Error (
88- `zone was not in the expected format: projects/PROJECT_NUM/zones/COUNTRY-REGION-ZONE. Got ${ fullZone } ` ,
88+ `zone was not in the expected format: projects/PROJECT_NUM/zones/COUNTRY-REGION-ZONE. Got ${ fullZone } `
8989 ) ;
9090 }
9191
92- return { zone, region} ;
92+ return { zone, region } ;
9393}
0 commit comments