@opentelemetry/resource-detector-gcp 0.49.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/esm/detectors/GcpDetector.js +1 -12
- package/build/esm/detectors/GcpDetector.js.map +1 -1
- package/build/esm/detectors/faas.js +1 -12
- package/build/esm/detectors/faas.js.map +1 -1
- package/build/esm/detectors/gae.js +1 -12
- package/build/esm/detectors/gae.js.map +1 -1
- package/build/esm/detectors/gce.js +1 -12
- package/build/esm/detectors/gce.js.map +1 -1
- package/build/esm/detectors/gke.js +1 -12
- package/build/esm/detectors/gke.js.map +1 -1
- package/build/esm/detectors/index.js +1 -12
- package/build/esm/detectors/index.js.map +1 -1
- package/build/esm/index.js +1 -12
- package/build/esm/index.js.map +1 -1
- package/build/esm/semconv.js +1 -12
- package/build/esm/semconv.js.map +1 -1
- package/build/src/detectors/GcpDetector.js +1 -12
- package/build/src/detectors/GcpDetector.js.map +1 -1
- package/build/src/detectors/faas.js +1 -12
- package/build/src/detectors/faas.js.map +1 -1
- package/build/src/detectors/gae.js +1 -12
- package/build/src/detectors/gae.js.map +1 -1
- package/build/src/detectors/gce.js +1 -12
- package/build/src/detectors/gce.js.map +1 -1
- package/build/src/detectors/gke.js +1 -12
- package/build/src/detectors/gke.js.map +1 -1
- package/build/src/detectors/index.js +1 -12
- package/build/src/detectors/index.js.map +1 -1
- package/build/src/index.js +1 -12
- package/build/src/index.js.map +1 -1
- package/build/src/semconv.js +1 -12
- package/build/src/semconv.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
3
|
* Copyright 2022 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
import { context } from '@opentelemetry/api';
|
|
18
7
|
import { suppressTracing } from '@opentelemetry/core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GcpDetector.js","sourceRoot":"","sources":["../../../src/detectors/GcpDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,mCAAmC,EACnC,wCAAwC,EACxC,kCAAkC,EAClC,uCAAuC,EACvC,0CAA0C,EAC1C,wBAAwB,EACxB,qBAAqB,EACrB,4BAA4B,EAC5B,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAGL,aAAa,EAGb,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAE7B,MAAM,eAAe,GAAG;IACtB,mBAAmB;IACnB,4BAA4B;IAC5B,iBAAiB;I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AAC,EAAE,QAAQ;QAC1B,CAAC,YAAY,CAAC,EAAE,MAAM;QACtB,CAAC,cAAc,CAAC,EAAE,QAAQ;KAC3B,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,KAA4B;IACtD,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAS,YAAY,CAAC,CAAC;IAE7D,OAAO,sBAAsB,CAAC;QAC5B,CAAC,mBAAmB,CAAC,EAAE,wBAAwB;QAC/C,CAAC,qBAAqB,CAAC,EAAE,OAAO;QAChC,GAAG,KAAK;KACuB,CAAC,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,WAAW;IACd,KAAK,CAAC,gBAAgB;QAC5B,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,CACjC,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EACjC,MAAM,CACP,CAAC;QACF,OAAO,QAAQ,CAAC,UAAU,CAAC;IAC7B,CAAC;IAEM,MAAM;QACX,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAChD,MAAM,UAAU,GAAG,EAAgC,CAAC;QACpD,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC7B,yEAAyE;YACzE,UAAU,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,UAAU,EAAE,CAAC;IACxB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { context } from '@opentelemetry/api';\nimport { suppressTracing } from '@opentelemetry/core';\nimport {\n CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE,\n CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS,\n CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN,\n CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE,\n CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE,\n CLOUD_PROVIDER_VALUE_GCP,\n ATTR_CLOUD_ACCOUNT_ID,\n ATTR_CLOUD_AVAILABILITY_ZONE,\n ATTR_CLOUD_PLATFORM,\n ATTR_CLOUD_PROVIDER,\n ATTR_CLOUD_REGION,\n ATTR_FAAS_INSTANCE,\n ATTR_FAAS_NAME,\n ATTR_FAAS_VERSION,\n ATTR_HOST_ID,\n ATTR_HOST_NAME,\n ATTR_HOST_TYPE,\n ATTR_K8S_CLUSTER_NAME,\n} from '../semconv';\n\nimport { AttributeValue, Attributes } from '@opentelemetry/api';\nimport {\n DetectedResource,\n DetectedResourceAttributes,\n emptyResource,\n Resource,\n ResourceDetector,\n resourceFromAttributes,\n} from '@opentelemetry/resources';\nimport * as metadata from 'gcp-metadata';\nimport * as faas from './faas';\nimport * as gae from './gae';\nimport * as gce from './gce';\nimport * as gke from './gke';\n\nconst ATTRIBUTE_NAMES = [\n ATTR_CLOUD_PLATFORM,\n ATTR_CLOUD_AVAILABILITY_ZONE,\n ATTR_CLOUD_REGION,\n ATTR_K8S_CLUSTER_NAME,\n ATTR_HOST_TYPE,\n ATTR_HOST_ID,\n ATTR_HOST_NAME,\n ATTR_CLOUD_PROVIDER,\n ATTR_CLOUD_ACCOUNT_ID,\n ATTR_FAAS_NAME,\n ATTR_FAAS_VERSION,\n ATTR_FAAS_INSTANCE,\n] as const;\n\n// Ensure that all resource keys are accounted for in ATTRIBUTE_NAMES\ntype GcpResourceAttributeName = (typeof ATTRIBUTE_NAMES)[number];\ntype GcpResourceAttributes = Partial<\n Record<GcpResourceAttributeName, AttributeValue>\n>;\n\nasync function detect(): Promise<Resource> {\n if (!(await metadata.isAvailable())) {\n return emptyResource();\n }\n\n // Note the order of these if checks is significant with more specific resources coming\n // first. E.g. Cloud Functions gen2 are executed in Cloud Run so it must be checked first.\n if (await gke.onGke()) {\n return await gkeResource();\n } else if (await faas.onCloudFunctions()) {\n return await cloudFunctionsResource();\n } else if (await faas.onCloudRun()) {\n return await cloudRunResource();\n } else if (await gae.onAppEngine()) {\n return await gaeResource();\n } else if (await gce.onGce()) {\n return await gceResource();\n }\n\n return emptyResource();\n}\n\nasync function gkeResource(): Promise<Resource> {\n const [zoneOrRegion, k8sClusterName, hostId] = await Promise.all([\n gke.availabilityZoneOrRegion(),\n gke.clusterName(),\n gke.hostId(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE,\n [zoneOrRegion.type === 'zone'\n ? ATTR_CLOUD_AVAILABILITY_ZONE\n : ATTR_CLOUD_REGION]: zoneOrRegion.value,\n [ATTR_K8S_CLUSTER_NAME]: k8sClusterName,\n [ATTR_HOST_ID]: hostId,\n });\n}\n\nasync function cloudRunResource(): Promise<Resource> {\n const [faasName, faasVersion, faasInstance, faasCloudRegion] =\n await Promise.all([\n faas.faasName(),\n faas.faasVersion(),\n faas.faasInstance(),\n faas.faasCloudRegion(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN,\n [ATTR_FAAS_NAME]: faasName,\n [ATTR_FAAS_VERSION]: faasVersion,\n [ATTR_FAAS_INSTANCE]: faasInstance,\n [ATTR_CLOUD_REGION]: faasCloudRegion,\n });\n}\n\nasync function cloudFunctionsResource(): Promise<Resource> {\n const [faasName, faasVersion, faasInstance, faasCloudRegion] =\n await Promise.all([\n faas.faasName(),\n faas.faasVersion(),\n faas.faasInstance(),\n faas.faasCloudRegion(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS,\n [ATTR_FAAS_NAME]: faasName,\n [ATTR_FAAS_VERSION]: faasVersion,\n [ATTR_FAAS_INSTANCE]: faasInstance,\n [ATTR_CLOUD_REGION]: faasCloudRegion,\n });\n}\n\nasync function gaeResource(): Promise<Resource> {\n let zone, region;\n if (await gae.onAppEngineStandard()) {\n [zone, region] = await Promise.all([\n gae.standardAvailabilityZone(),\n gae.standardCloudRegion(),\n ]);\n } else {\n ({ zone, region } = await gce.availabilityZoneAndRegion());\n }\n const [faasName, faasVersion, faasInstance] = await Promise.all([\n gae.serviceName(),\n gae.serviceVersion(),\n gae.serviceInstance(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE,\n [ATTR_FAAS_NAME]: faasName,\n [ATTR_FAAS_VERSION]: faasVersion,\n [ATTR_FAAS_INSTANCE]: faasInstance,\n [ATTR_CLOUD_AVAILABILITY_ZONE]: zone,\n [ATTR_CLOUD_REGION]: region,\n });\n}\n\nasync function gceResource(): Promise<Resource> {\n const [zoneAndRegion, hostType, hostId, hostName] = await Promise.all([\n gce.availabilityZoneAndRegion(),\n gce.hostType(),\n gce.hostId(),\n gce.hostName(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE,\n [ATTR_CLOUD_AVAILABILITY_ZONE]: zoneAndRegion.zone,\n [ATTR_CLOUD_REGION]: zoneAndRegion.region,\n [ATTR_HOST_TYPE]: hostType,\n [ATTR_HOST_ID]: hostId,\n [ATTR_HOST_NAME]: hostName,\n });\n}\n\nasync function makeResource(attrs: GcpResourceAttributes): Promise<Resource> {\n const project = await metadata.project<string>('project-id');\n\n return resourceFromAttributes({\n [ATTR_CLOUD_PROVIDER]: CLOUD_PROVIDER_VALUE_GCP,\n [ATTR_CLOUD_ACCOUNT_ID]: project,\n ...attrs,\n } satisfies GcpResourceAttributes);\n}\n\n/**\n * Google Cloud resource detector which populates attributes based on the environment this\n * process is running in. If not on GCP, returns an empty resource.\n */\nexport class GcpDetector implements ResourceDetector {\n private async _asyncAttributes(): Promise<Attributes> {\n const resource = await context.with(\n suppressTracing(context.active()),\n detect\n );\n return resource.attributes;\n }\n\n public detect(): DetectedResource {\n const asyncAttributes = this._asyncAttributes();\n const attributes = {} as DetectedResourceAttributes;\n ATTRIBUTE_NAMES.forEach(name => {\n // Each resource attribute is determined asynchronously in _gatherData().\n attributes[name] = asyncAttributes.then(data => data[name]);\n });\n\n return { attributes };\n }\n}\n\nexport const gcpDetector = new GcpDetector();\n"]}
|
|
1
|
+
{"version":3,"file":"GcpDetector.js","sourceRoot":"","sources":["../../../src/detectors/GcpDetector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,mCAAmC,EACnC,wCAAwC,EACxC,kCAAkC,EAClC,uCAAuC,EACvC,0CAA0C,EAC1C,wBAAwB,EACxB,qBAAqB,EACrB,4BAA4B,EAC5B,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAGL,aAAa,EAGb,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,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AC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { context } from '@opentelemetry/api';\nimport { suppressTracing } from '@opentelemetry/core';\nimport {\n CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE,\n CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS,\n CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN,\n CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE,\n CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE,\n CLOUD_PROVIDER_VALUE_GCP,\n ATTR_CLOUD_ACCOUNT_ID,\n ATTR_CLOUD_AVAILABILITY_ZONE,\n ATTR_CLOUD_PLATFORM,\n ATTR_CLOUD_PROVIDER,\n ATTR_CLOUD_REGION,\n ATTR_FAAS_INSTANCE,\n ATTR_FAAS_NAME,\n ATTR_FAAS_VERSION,\n ATTR_HOST_ID,\n ATTR_HOST_NAME,\n ATTR_HOST_TYPE,\n ATTR_K8S_CLUSTER_NAME,\n} from '../semconv';\n\nimport { AttributeValue, Attributes } from '@opentelemetry/api';\nimport {\n DetectedResource,\n DetectedResourceAttributes,\n emptyResource,\n Resource,\n ResourceDetector,\n resourceFromAttributes,\n} from '@opentelemetry/resources';\nimport * as metadata from 'gcp-metadata';\nimport * as faas from './faas';\nimport * as gae from './gae';\nimport * as gce from './gce';\nimport * as gke from './gke';\n\nconst ATTRIBUTE_NAMES = [\n ATTR_CLOUD_PLATFORM,\n ATTR_CLOUD_AVAILABILITY_ZONE,\n ATTR_CLOUD_REGION,\n ATTR_K8S_CLUSTER_NAME,\n ATTR_HOST_TYPE,\n ATTR_HOST_ID,\n ATTR_HOST_NAME,\n ATTR_CLOUD_PROVIDER,\n ATTR_CLOUD_ACCOUNT_ID,\n ATTR_FAAS_NAME,\n ATTR_FAAS_VERSION,\n ATTR_FAAS_INSTANCE,\n] as const;\n\n// Ensure that all resource keys are accounted for in ATTRIBUTE_NAMES\ntype GcpResourceAttributeName = (typeof ATTRIBUTE_NAMES)[number];\ntype GcpResourceAttributes = Partial<\n Record<GcpResourceAttributeName, AttributeValue>\n>;\n\nasync function detect(): Promise<Resource> {\n if (!(await metadata.isAvailable())) {\n return emptyResource();\n }\n\n // Note the order of these if checks is significant with more specific resources coming\n // first. E.g. Cloud Functions gen2 are executed in Cloud Run so it must be checked first.\n if (await gke.onGke()) {\n return await gkeResource();\n } else if (await faas.onCloudFunctions()) {\n return await cloudFunctionsResource();\n } else if (await faas.onCloudRun()) {\n return await cloudRunResource();\n } else if (await gae.onAppEngine()) {\n return await gaeResource();\n } else if (await gce.onGce()) {\n return await gceResource();\n }\n\n return emptyResource();\n}\n\nasync function gkeResource(): Promise<Resource> {\n const [zoneOrRegion, k8sClusterName, hostId] = await Promise.all([\n gke.availabilityZoneOrRegion(),\n gke.clusterName(),\n gke.hostId(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE,\n [zoneOrRegion.type === 'zone'\n ? ATTR_CLOUD_AVAILABILITY_ZONE\n : ATTR_CLOUD_REGION]: zoneOrRegion.value,\n [ATTR_K8S_CLUSTER_NAME]: k8sClusterName,\n [ATTR_HOST_ID]: hostId,\n });\n}\n\nasync function cloudRunResource(): Promise<Resource> {\n const [faasName, faasVersion, faasInstance, faasCloudRegion] =\n await Promise.all([\n faas.faasName(),\n faas.faasVersion(),\n faas.faasInstance(),\n faas.faasCloudRegion(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN,\n [ATTR_FAAS_NAME]: faasName,\n [ATTR_FAAS_VERSION]: faasVersion,\n [ATTR_FAAS_INSTANCE]: faasInstance,\n [ATTR_CLOUD_REGION]: faasCloudRegion,\n });\n}\n\nasync function cloudFunctionsResource(): Promise<Resource> {\n const [faasName, faasVersion, faasInstance, faasCloudRegion] =\n await Promise.all([\n faas.faasName(),\n faas.faasVersion(),\n faas.faasInstance(),\n faas.faasCloudRegion(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS,\n [ATTR_FAAS_NAME]: faasName,\n [ATTR_FAAS_VERSION]: faasVersion,\n [ATTR_FAAS_INSTANCE]: faasInstance,\n [ATTR_CLOUD_REGION]: faasCloudRegion,\n });\n}\n\nasync function gaeResource(): Promise<Resource> {\n let zone, region;\n if (await gae.onAppEngineStandard()) {\n [zone, region] = await Promise.all([\n gae.standardAvailabilityZone(),\n gae.standardCloudRegion(),\n ]);\n } else {\n ({ zone, region } = await gce.availabilityZoneAndRegion());\n }\n const [faasName, faasVersion, faasInstance] = await Promise.all([\n gae.serviceName(),\n gae.serviceVersion(),\n gae.serviceInstance(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE,\n [ATTR_FAAS_NAME]: faasName,\n [ATTR_FAAS_VERSION]: faasVersion,\n [ATTR_FAAS_INSTANCE]: faasInstance,\n [ATTR_CLOUD_AVAILABILITY_ZONE]: zone,\n [ATTR_CLOUD_REGION]: region,\n });\n}\n\nasync function gceResource(): Promise<Resource> {\n const [zoneAndRegion, hostType, hostId, hostName] = await Promise.all([\n gce.availabilityZoneAndRegion(),\n gce.hostType(),\n gce.hostId(),\n gce.hostName(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE,\n [ATTR_CLOUD_AVAILABILITY_ZONE]: zoneAndRegion.zone,\n [ATTR_CLOUD_REGION]: zoneAndRegion.region,\n [ATTR_HOST_TYPE]: hostType,\n [ATTR_HOST_ID]: hostId,\n [ATTR_HOST_NAME]: hostName,\n });\n}\n\nasync function makeResource(attrs: GcpResourceAttributes): Promise<Resource> {\n const project = await metadata.project<string>('project-id');\n\n return resourceFromAttributes({\n [ATTR_CLOUD_PROVIDER]: CLOUD_PROVIDER_VALUE_GCP,\n [ATTR_CLOUD_ACCOUNT_ID]: project,\n ...attrs,\n } satisfies GcpResourceAttributes);\n}\n\n/**\n * Google Cloud resource detector which populates attributes based on the environment this\n * process is running in. If not on GCP, returns an empty resource.\n */\nexport class GcpDetector implements ResourceDetector {\n private async _asyncAttributes(): Promise<Attributes> {\n const resource = await context.with(\n suppressTracing(context.active()),\n detect\n );\n return resource.attributes;\n }\n\n public detect(): DetectedResource {\n const asyncAttributes = this._asyncAttributes();\n const attributes = {} as DetectedResourceAttributes;\n ATTRIBUTE_NAMES.forEach(name => {\n // Each resource attribute is determined asynchronously in _gatherData().\n attributes[name] = asyncAttributes.then(data => data[name]);\n });\n\n return { attributes };\n }\n}\n\nexport const gcpDetector = new GcpDetector();\n"]}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
3
|
* Copyright 2023 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
/**
|
|
18
7
|
* Implementation in this file copied from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faas.js","sourceRoot":"","sources":["../../../src/detectors/faas.ts"],"names":[],"mappings":"AAAA
|
|
1
|
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,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,GAAG,KAAK,SAAS,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,YAAY,CAAC,CAAC;KAC1D;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Implementation in this file copied from\n * https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/v1.8.0/detectors/gcp/faas.go\n */\n\nimport * as metadata from 'gcp-metadata';\n\nconst ID_METADATA_ATTR = 'id';\nconst CLOUD_RUN_CONFIG_ENV = 'K_CONFIGURATION';\nconst CLOUD_FUNCTION_TARGET_ENV = 'FUNCTION_TARGET';\nconst FAAS_SERVICE_ENV = 'K_SERVICE';\nconst FAAS_REVISION_ENV = 'K_REVISION';\nconst REGION_METADATA_ATTR = 'region';\n\nexport async function onCloudRun(): Promise<boolean> {\n return process.env[CLOUD_RUN_CONFIG_ENV] !== undefined;\n}\n\nexport async function onCloudFunctions(): Promise<boolean> {\n return process.env[CLOUD_FUNCTION_TARGET_ENV] !== undefined;\n}\n\n/**\n * The name of the Cloud Run or Cloud Function. Check that {@link onCloudRun()} or {@link\n * onCloudFunctions()} is true before calling this, or it may throw exceptions.\n */\nexport async function faasName(): Promise<string> {\n return lookupEnv(FAAS_SERVICE_ENV);\n}\n\n/**\n * The version/revision of the Cloud Run or Cloud Function. Check that {@link onCloudRun()} or\n * {@link onCloudFunctions()} is true before calling this, or it may throw exceptions.\n */\nexport async function faasVersion(): Promise<string> {\n return lookupEnv(FAAS_REVISION_ENV);\n}\n\n/**\n * The ID for the running instance of a Cloud Run or Cloud Function. Check that {@link\n * onCloudRun()} or {@link onCloudFunctions()} is true before calling this, or it may throw\n * exceptions.\n */\nexport async function faasInstance(): Promise<string> {\n // May be a bignumber.js BigNumber which can just be converted with toString(). See\n // https://github.com/googleapis/gcp-metadata#take-care-with-large-number-valued-properties\n const id = await metadata.instance<number | object>(ID_METADATA_ATTR);\n return id.toString();\n}\n\n/**\n * The cloud region where the running instance of a Cloud Run or Cloud Function is located.\n * Check that {@link onCloudRun()} or {@link onCloudFunctions()} is true before calling this,\n * or it may throw exceptions.\n */\nexport async function faasCloudRegion(): Promise<string> {\n const region = await metadata.instance<string>(REGION_METADATA_ATTR);\n return region.slice(region.lastIndexOf('/') + 1);\n}\n\nfunction lookupEnv(key: string): string {\n const val = process.env[key];\n if (val === undefined) {\n throw new Error(`Environment variable ${key} not found`);\n }\n return val;\n}\n"]}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
3
|
* Copyright 2023 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
/**
|
|
18
7
|
* Implementation in this file copied from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gae.js","sourceRoot":"","sources":["../../../src/detectors/gae.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gae.js","sourceRoot":"","sources":["../../../src/detectors/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AAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,OAAO,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,GAAG,KAAK,SAAS,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,YAAY,CAAC,CAAC;KAC1D;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Implementation in this file copied from\n * https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/v1.8.0/detectors/gcp/app_engine.go\n */\n\nimport * as metadata from 'gcp-metadata';\nimport * as gce from './gce';\nimport * as faas from './faas';\n\nconst GAE_SERVICE_ENV = 'GAE_SERVICE';\nconst GAE_VERSION_ENV = 'GAE_VERSION';\nconst GAE_INSTANCE_ENV = 'GAE_INSTANCE';\nconst GAE_ENV = 'GAE_ENV';\nconst GAE_STANDARD = 'standard';\nconst ZONE_METADATA_ATTR = 'zone';\n\nexport async function onAppEngineStandard(): Promise<boolean> {\n return process.env[GAE_ENV] === GAE_STANDARD;\n}\n\nexport async function onAppEngine(): Promise<boolean> {\n return process.env[GAE_SERVICE_ENV] !== undefined;\n}\n\n/**\n * The service name of the app engine service. Check that {@link onAppEngine()} is true before\n * calling this, or it may throw exceptions.\n */\nexport async function serviceName(): Promise<string> {\n return lookupEnv(GAE_SERVICE_ENV);\n}\n\n/**\n * The service version of the app engine service. Check that {@link onAppEngine()} is true\n * before calling this, or it may throw exceptions.\n */\nexport async function serviceVersion(): Promise<string> {\n return lookupEnv(GAE_VERSION_ENV);\n}\n\n/**\n * The service instance of the app engine service. Check that {@link onAppEngine()} is true\n * before calling this, or it may throw exceptions.\n */\nexport async function serviceInstance(): Promise<string> {\n return lookupEnv(GAE_INSTANCE_ENV);\n}\n\n/**\n * The zone and region in which this program is running. Check that {@link onAppEngine()} is\n * true before calling this, or it may throw exceptions.\n */\nexport async function flexAvailabilityZoneAndRegion(): Promise<{\n zone: string;\n region: string;\n}> {\n return await gce.availabilityZoneAndRegion();\n}\n\n/**\n * The zone the app engine service is running in. Check that {@link onAppEngineStandard()} is\n * true before calling this, or it may throw exceptions.\n */\nexport async function standardAvailabilityZone(): Promise<string> {\n const zone = await metadata.instance<string>(ZONE_METADATA_ATTR);\n // zone is of the form \"projects/233510669999/zones/us15\"\n return zone.slice(zone.lastIndexOf('/') + 1);\n}\n\n/**\n * The region the app engine service is running in. Check that {@link onAppEngineStandard()} is\n * true before calling this, or it may throw exceptions.\n */\nexport async function standardCloudRegion(): Promise<string> {\n return await faas.faasCloudRegion();\n}\n\nfunction lookupEnv(key: string): string {\n const val = process.env[key];\n if (val === undefined) {\n throw new Error(`Environment variable ${key} not found`);\n }\n return val;\n}\n"]}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
3
|
* Copyright 2022 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
/**
|
|
18
7
|
* Implementation in this file copied from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gce.js","sourceRoot":"","sources":["../../../src/detectors/gce.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gce.js","sourceRoot":"","sources":["../../../src/detectors/gce.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,cAAc,CAAC;AAEzC,MAAM,0BAA0B,GAAG,cAAc,CAAC;AAClD,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,uBAAuB,GAAG,MAAM,CAAC;AACvC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,KAAK;IACzB,IAAI;QACF,MAAM,QAAQ,CAAC,QAAQ,CAAS,0BAA0B,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,CAAC,KAAK,CACR,0EAA0E,EAC1E,0BAA0B,EAC1B,GAAG,CACJ,CAAC;QACF,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,OAAO,QAAQ,CAAC,QAAQ,CAAS,0BAA0B,CAAC,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM;IAC1B,mFAAmF;IACnF,2FAA2F;IAC3F,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAkB,gBAAgB,CAAC,CAAC;IACtE,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,OAAO,QAAQ,CAAC,QAAQ,CAAS,uBAAuB,CAAC,CAAC;AAC5D,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAI7C,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAS,kBAAkB,CAAC,CAAC;IAErE,sBAAsB;IACtB,8FAA8F;IAC9F,MAAM,EAAE,GAAG,uDAAuD,CAAC;IACnE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC;IAC1D,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE;QACpB,MAAM,IAAI,KAAK,CACb,4FAA4F,QAAQ,EAAE,CACvG,CAAC;KACH;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Implementation in this file copied from\n * https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/v1.8.0/detectors/gcp/gce.go\n */\n\nimport { diag } from '@opentelemetry/api';\nimport * as metadata from 'gcp-metadata';\n\nconst MACHINE_TYPE_METADATA_ATTR = 'machine-type';\nconst ID_METADATA_ATTR = 'id';\nconst HOST_NAME_METADATA_ATTR = 'name';\nconst ZONE_METADATA_ATTR = 'zone';\n\nexport async function onGce(): Promise<boolean> {\n try {\n await metadata.instance<string>(MACHINE_TYPE_METADATA_ATTR);\n return true;\n } catch (err) {\n diag.debug(\n 'Could not fetch metadata attribute %s, assuming not on GCE. Error was %s',\n MACHINE_TYPE_METADATA_ATTR,\n err\n );\n return false;\n }\n}\n\n/**\n * The machine type of the instance on which this program is running. Check that {@link\n * onGce()} is true before calling this, or it may throw exceptions.\n */\nexport async function hostType(): Promise<string> {\n return metadata.instance<string>(MACHINE_TYPE_METADATA_ATTR);\n}\n\n/**\n * The instance ID of the instance on which this program is running. Check that {@link onGce()}\n * is true before calling this, or it may throw exceptions.\n */\nexport async function hostId(): Promise<string> {\n // May be a bignumber.js BigNumber which can just be converted with toString(). See\n // https://github.com/googleapis/gcp-metadata#take-care-with-large-number-valued-properties\n const id = await metadata.instance<number | object>(ID_METADATA_ATTR);\n return id.toString();\n}\n\n/**\n * The instance ID of the instance on which this program is running. Check that {@link onGce()}\n * is true before calling this, or it may throw exceptions.\n */\nexport async function hostName(): Promise<string> {\n return metadata.instance<string>(HOST_NAME_METADATA_ATTR);\n}\n\n/**\n * The zone and region in which this program is running. Check that {@link onGce()} is true\n * before calling this, or it may throw exceptions.\n */\nexport async function availabilityZoneAndRegion(): Promise<{\n zone: string;\n region: string;\n}> {\n const fullZone = await metadata.instance<string>(ZONE_METADATA_ATTR);\n\n // Format described in\n // https://cloud.google.com/compute/docs/metadata/default-metadata-values#vm_instance_metadata\n const re = /projects\\/\\d+\\/zones\\/(?<zone>(?<region>\\w+-\\w+)-\\w+)/;\n const { zone, region } = fullZone.match(re)?.groups ?? {};\n if (!zone || !region) {\n throw new Error(\n `zone was not in the expected format: projects/PROJECT_NUM/zones/COUNTRY-REGION-ZONE. Got ${fullZone}`\n );\n }\n\n return { zone, region };\n}\n"]}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
3
|
* Copyright 2022 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
/**
|
|
18
7
|
* Implementation in this file copied from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gke.js","sourceRoot":"","sources":["../../../src/detectors/gke.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gke.js","sourceRoot":"","sources":["../../../src/detectors/gke.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,OAAO,KAAK,QAAQ,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAE7B,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AAC9D,MAAM,0BAA0B,GAAG,yBAAyB,CAAC;AAC7D,MAAM,8BAA8B,GAAG,6BAA6B,CAAC;AAErE,MAAM,CAAC,KAAK,UAAU,KAAK;IACzB,OAAO,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,KAAK,SAAS,CAAC;AAChE,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM;IAC1B,OAAO,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;AAC5B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,OAAO,QAAQ,CAAC,QAAQ,CAAS,0BAA0B,CAAC,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAI5C,MAAM,eAAe,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAC7C,8BAA8B,CAC/B,CAAC;IACF,QAAQ,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC,EAAE;QACvC,KAAK,CAAC;YACJ,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;QACpD,KAAK,CAAC;YACJ,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;QAClD;YACE,MAAM,IAAI,KAAK,CACb,6CAA6C,eAAe,EAAE,CAC/D,CAAC;KACL;AACH,CAAC;AAED,SAAS,SAAS,CAAC,CAAS,EAAE,IAAY;IACxC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACjC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;YACjB,KAAK,IAAI,CAAC,CAAC;SACZ;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Implementation in this file copied from\n * https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/v1.8.0/detectors/gcp/gke.go\n */\n\nimport * as metadata from 'gcp-metadata';\nimport * as gce from './gce';\n\nconst KUBERNETES_SERVICE_HOST_ENV = 'KUBERNETES_SERVICE_HOST';\nconst CLUSTER_NAME_METADATA_ATTR = 'attributes/cluster-name';\nconst CLUSTER_LOCATION_METADATA_ATTR = 'attributes/cluster-location';\n\nexport async function onGke(): Promise<boolean> {\n return process.env[KUBERNETES_SERVICE_HOST_ENV] !== undefined;\n}\n\n/**\n * The instance ID of the instance on which this program is running. Check that {@link onGke()}\n * is true before calling this, or it may throw exceptions.\n */\nexport async function hostId(): Promise<string> {\n return await gce.hostId();\n}\n\n/**\n * The name of the GKE cluster in which this program is running. Check that {@link onGke()} is\n * true before calling this, or it may throw exceptions.\n */\nexport async function clusterName(): Promise<string> {\n return metadata.instance<string>(CLUSTER_NAME_METADATA_ATTR);\n}\n\n/**\n * The location of the cluster and whether the cluster is zonal or regional. Check that {@link\n * onGke()} is true before calling this, or it may throw exceptions.\n */\nexport async function availabilityZoneOrRegion(): Promise<{\n type: 'zone' | 'region';\n value: string;\n}> {\n const clusterLocation = await metadata.instance<string>(\n CLUSTER_LOCATION_METADATA_ATTR\n );\n switch (countChar(clusterLocation, '-')) {\n case 1:\n return { type: 'region', value: clusterLocation };\n case 2:\n return { type: 'zone', value: clusterLocation };\n default:\n throw new Error(\n `unrecognized format for cluster location: ${clusterLocation}`\n );\n }\n}\n\nfunction countChar(s: string, char: string): number {\n let count = 0;\n for (let i = 0; i < s.length; i++) {\n if (s[i] === char) {\n count += 1;\n }\n }\n return count;\n}\n"]}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15
4
|
*/
|
|
16
5
|
export { gcpDetector } from './GcpDetector';
|
|
17
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/detectors/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/detectors/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { gcpDetector } from './GcpDetector';\n"]}
|
package/build/esm/index.js
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15
4
|
*/
|
|
16
5
|
export { gcpDetector } from './detectors';
|
|
17
6
|
// Internal - used for tests only
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,iCAAiC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { gcpDetector } from './detectors';\n\n// Internal - used for tests only\nexport { resetIsAvailableCache } from 'gcp-metadata';\n"]}
|
package/build/esm/semconv.js
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15
4
|
*/
|
|
16
5
|
/*
|
|
17
6
|
* This file contains a copy of unstable semantic convention definitions
|
package/build/esm/semconv.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAA2B,CAAC;AAEjE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,yBAAkC,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAuB,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAwB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAuB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,SAAkB,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAoB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAoB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAA2B,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,gBAAyB,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wCAAwC,GACnD,qBAA8B,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,eAAwB,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAClD,oBAA6B,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0CAA0C,GACrD,uBAAgC,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAc,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * The cloud account ID the resource is assigned to.\n *\n * @example 111111111111\n * @example opentelemetry\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_ACCOUNT_ID = 'cloud.account.id' as const;\n\n/**\n * Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.\n *\n * @example us-east-1c\n *\n * @note Availability zones are called \"zones\" on Alibaba Cloud and Google Cloud.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_AVAILABILITY_ZONE = 'cloud.availability_zone' as const;\n\n/**\n * The cloud platform in use.\n *\n * @note The prefix of the service **SHOULD** match the one specified in `cloud.provider`.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_PLATFORM = 'cloud.platform' as const;\n\n/**\n * Name of the cloud provider.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_PROVIDER = 'cloud.provider' as const;\n\n/**\n * The geographical region within a cloud provider. When associated with a resource, this attribute specifies the region where the resource operates. When calling services or APIs deployed on a cloud, this attribute identifies the region where the called destination is deployed.\n *\n * @example us-central1\n * @example us-east-1\n *\n * @note Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_REGION = 'cloud.region' as const;\n\n/**\n * The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version.\n *\n * @example 2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de\n *\n * @note - **AWS Lambda:** Use the (full) log stream name.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_INSTANCE = 'faas.instance' as const;\n\n/**\n * The name of the single function that this runtime instance executes.\n *\n * @example my-function\n * @example myazurefunctionapp/some-function-name\n *\n * @note This is the name of the function as configured/deployed on the FaaS\n * platform and is usually different from the name of the callback\n * function (which may be stored in the\n * [`code.namespace`/`code.function.name`](/docs/general/attributes.md#source-code-attributes)\n * span attributes).\n *\n * For some cloud providers, the above definition is ambiguous. The following\n * definition of function name **MUST** be used for this attribute\n * (and consequently the span name) for the listed cloud providers/products:\n *\n * - **Azure:** The full name `<FUNCAPP>/<FUNC>`, i.e., function app name\n * followed by a forward slash followed by the function name (this form\n * can also be seen in the resource JSON for the function).\n * This means that a span attribute **MUST** be used, as an Azure function\n * app can host multiple functions that would usually share\n * a TracerProvider (see also the `cloud.resource_id` attribute).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_NAME = 'faas.name' as const;\n\n/**\n * The immutable version of the function being executed.\n *\n * @example 26\n * @example pinkfroid-00002\n *\n * @note Depending on the cloud provider and platform, use:\n *\n * - **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html)\n * (an integer represented as a decimal string).\n * - **Google Cloud Run (Services):** The [revision](https://cloud.google.com/run/docs/managing/revisions)\n * (i.e., the function name plus the revision suffix).\n * - **Google Cloud Functions:** The value of the\n * [`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically).\n * - **Azure Functions:** Not applicable. Do not set this attribute.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_VERSION = 'faas.version' as const;\n\n/**\n * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the `machine-id`. See the table below for the sources to use to determine the `machine-id` based on operating system.\n *\n * @example fdbf79e8af94cb7f9e8df36789187052\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HOST_ID = 'host.id' as const;\n\n/**\n * Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user.\n *\n * @example opentelemetry-test\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HOST_NAME = 'host.name' as const;\n\n/**\n * Type of host. For Cloud, this must be the machine type.\n *\n * @example n1-standard-1\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HOST_TYPE = 'host.type' as const;\n\n/**\n * The name of the cluster.\n *\n * @example opentelemetry-cluster\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_K8S_CLUSTER_NAME = 'k8s.cluster.name' as const;\n\n/**\n * Enum value \"gcp_app_engine\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud App Engine (GAE)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE = 'gcp_app_engine' as const;\n\n/**\n * Enum value \"gcp_cloud_functions\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Functions (GCF)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS =\n 'gcp_cloud_functions' as const;\n\n/**\n * Enum value \"gcp_cloud_run\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Run\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN = 'gcp_cloud_run' as const;\n\n/**\n * Enum value \"gcp_compute_engine\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Compute Engine (GCE)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE =\n 'gcp_compute_engine' as const;\n\n/**\n * Enum value \"gcp_kubernetes_engine\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Kubernetes Engine (GKE)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE =\n 'gcp_kubernetes_engine' as const;\n\n/**\n * Enum value \"gcp\" for attribute {@link ATTR_CLOUD_PROVIDER}.\n *\n * Google Cloud Platform\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PROVIDER_VALUE_GCP = 'gcp' as const;\n"]}
|
|
1
|
+
{"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAA2B,CAAC;AAEjE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,yBAAkC,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAuB,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAwB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAuB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,SAAkB,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAoB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAoB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAA2B,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,gBAAyB,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wCAAwC,GACnD,qBAA8B,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,eAAwB,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAClD,oBAA6B,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0CAA0C,GACrD,uBAAgC,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAc,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * The cloud account ID the resource is assigned to.\n *\n * @example 111111111111\n * @example opentelemetry\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_ACCOUNT_ID = 'cloud.account.id' as const;\n\n/**\n * Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.\n *\n * @example us-east-1c\n *\n * @note Availability zones are called \"zones\" on Alibaba Cloud and Google Cloud.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_AVAILABILITY_ZONE = 'cloud.availability_zone' as const;\n\n/**\n * The cloud platform in use.\n *\n * @note The prefix of the service **SHOULD** match the one specified in `cloud.provider`.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_PLATFORM = 'cloud.platform' as const;\n\n/**\n * Name of the cloud provider.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_PROVIDER = 'cloud.provider' as const;\n\n/**\n * The geographical region within a cloud provider. When associated with a resource, this attribute specifies the region where the resource operates. When calling services or APIs deployed on a cloud, this attribute identifies the region where the called destination is deployed.\n *\n * @example us-central1\n * @example us-east-1\n *\n * @note Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_REGION = 'cloud.region' as const;\n\n/**\n * The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version.\n *\n * @example 2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de\n *\n * @note - **AWS Lambda:** Use the (full) log stream name.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_INSTANCE = 'faas.instance' as const;\n\n/**\n * The name of the single function that this runtime instance executes.\n *\n * @example my-function\n * @example myazurefunctionapp/some-function-name\n *\n * @note This is the name of the function as configured/deployed on the FaaS\n * platform and is usually different from the name of the callback\n * function (which may be stored in the\n * [`code.namespace`/`code.function.name`](/docs/general/attributes.md#source-code-attributes)\n * span attributes).\n *\n * For some cloud providers, the above definition is ambiguous. The following\n * definition of function name **MUST** be used for this attribute\n * (and consequently the span name) for the listed cloud providers/products:\n *\n * - **Azure:** The full name `<FUNCAPP>/<FUNC>`, i.e., function app name\n * followed by a forward slash followed by the function name (this form\n * can also be seen in the resource JSON for the function).\n * This means that a span attribute **MUST** be used, as an Azure function\n * app can host multiple functions that would usually share\n * a TracerProvider (see also the `cloud.resource_id` attribute).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_NAME = 'faas.name' as const;\n\n/**\n * The immutable version of the function being executed.\n *\n * @example 26\n * @example pinkfroid-00002\n *\n * @note Depending on the cloud provider and platform, use:\n *\n * - **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html)\n * (an integer represented as a decimal string).\n * - **Google Cloud Run (Services):** The [revision](https://cloud.google.com/run/docs/managing/revisions)\n * (i.e., the function name plus the revision suffix).\n * - **Google Cloud Functions:** The value of the\n * [`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically).\n * - **Azure Functions:** Not applicable. Do not set this attribute.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_VERSION = 'faas.version' as const;\n\n/**\n * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the `machine-id`. See the table below for the sources to use to determine the `machine-id` based on operating system.\n *\n * @example fdbf79e8af94cb7f9e8df36789187052\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HOST_ID = 'host.id' as const;\n\n/**\n * Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user.\n *\n * @example opentelemetry-test\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HOST_NAME = 'host.name' as const;\n\n/**\n * Type of host. For Cloud, this must be the machine type.\n *\n * @example n1-standard-1\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HOST_TYPE = 'host.type' as const;\n\n/**\n * The name of the cluster.\n *\n * @example opentelemetry-cluster\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_K8S_CLUSTER_NAME = 'k8s.cluster.name' as const;\n\n/**\n * Enum value \"gcp_app_engine\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud App Engine (GAE)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE = 'gcp_app_engine' as const;\n\n/**\n * Enum value \"gcp_cloud_functions\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Functions (GCF)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS =\n 'gcp_cloud_functions' as const;\n\n/**\n * Enum value \"gcp_cloud_run\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Run\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN = 'gcp_cloud_run' as const;\n\n/**\n * Enum value \"gcp_compute_engine\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Compute Engine (GCE)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE =\n 'gcp_compute_engine' as const;\n\n/**\n * Enum value \"gcp_kubernetes_engine\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Kubernetes Engine (GKE)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE =\n 'gcp_kubernetes_engine' as const;\n\n/**\n * Enum value \"gcp\" for attribute {@link ATTR_CLOUD_PROVIDER}.\n *\n * Google Cloud Platform\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PROVIDER_VALUE_GCP = 'gcp' as const;\n"]}
|
|
@@ -2,18 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
4
|
* Copyright 2022 Google LLC
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
17
6
|
*/
|
|
18
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
8
|
exports.gcpDetector = exports.GcpDetector = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GcpDetector.js","sourceRoot":"","sources":["../../../src/detectors/GcpDetector.ts"],"names":[],"mappings":";AAAA;;;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CAAC;IACxB,CAAC;CACF;AAnBD,kCAmBC;AAEY,QAAA,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { context } from '@opentelemetry/api';\nimport { suppressTracing } from '@opentelemetry/core';\nimport {\n CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE,\n CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS,\n CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN,\n CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE,\n CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE,\n CLOUD_PROVIDER_VALUE_GCP,\n ATTR_CLOUD_ACCOUNT_ID,\n ATTR_CLOUD_AVAILABILITY_ZONE,\n ATTR_CLOUD_PLATFORM,\n ATTR_CLOUD_PROVIDER,\n ATTR_CLOUD_REGION,\n ATTR_FAAS_INSTANCE,\n ATTR_FAAS_NAME,\n ATTR_FAAS_VERSION,\n ATTR_HOST_ID,\n ATTR_HOST_NAME,\n ATTR_HOST_TYPE,\n ATTR_K8S_CLUSTER_NAME,\n} from '../semconv';\n\nimport { AttributeValue, Attributes } from '@opentelemetry/api';\nimport {\n DetectedResource,\n DetectedResourceAttributes,\n emptyResource,\n Resource,\n ResourceDetector,\n resourceFromAttributes,\n} from '@opentelemetry/resources';\nimport * as metadata from 'gcp-metadata';\nimport * as faas from './faas';\nimport * as gae from './gae';\nimport * as gce from './gce';\nimport * as gke from './gke';\n\nconst ATTRIBUTE_NAMES = [\n ATTR_CLOUD_PLATFORM,\n ATTR_CLOUD_AVAILABILITY_ZONE,\n ATTR_CLOUD_REGION,\n ATTR_K8S_CLUSTER_NAME,\n ATTR_HOST_TYPE,\n ATTR_HOST_ID,\n ATTR_HOST_NAME,\n ATTR_CLOUD_PROVIDER,\n ATTR_CLOUD_ACCOUNT_ID,\n ATTR_FAAS_NAME,\n ATTR_FAAS_VERSION,\n ATTR_FAAS_INSTANCE,\n] as const;\n\n// Ensure that all resource keys are accounted for in ATTRIBUTE_NAMES\ntype GcpResourceAttributeName = (typeof ATTRIBUTE_NAMES)[number];\ntype GcpResourceAttributes = Partial<\n Record<GcpResourceAttributeName, AttributeValue>\n>;\n\nasync function detect(): Promise<Resource> {\n if (!(await metadata.isAvailable())) {\n return emptyResource();\n }\n\n // Note the order of these if checks is significant with more specific resources coming\n // first. E.g. Cloud Functions gen2 are executed in Cloud Run so it must be checked first.\n if (await gke.onGke()) {\n return await gkeResource();\n } else if (await faas.onCloudFunctions()) {\n return await cloudFunctionsResource();\n } else if (await faas.onCloudRun()) {\n return await cloudRunResource();\n } else if (await gae.onAppEngine()) {\n return await gaeResource();\n } else if (await gce.onGce()) {\n return await gceResource();\n }\n\n return emptyResource();\n}\n\nasync function gkeResource(): Promise<Resource> {\n const [zoneOrRegion, k8sClusterName, hostId] = await Promise.all([\n gke.availabilityZoneOrRegion(),\n gke.clusterName(),\n gke.hostId(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE,\n [zoneOrRegion.type === 'zone'\n ? ATTR_CLOUD_AVAILABILITY_ZONE\n : ATTR_CLOUD_REGION]: zoneOrRegion.value,\n [ATTR_K8S_CLUSTER_NAME]: k8sClusterName,\n [ATTR_HOST_ID]: hostId,\n });\n}\n\nasync function cloudRunResource(): Promise<Resource> {\n const [faasName, faasVersion, faasInstance, faasCloudRegion] =\n await Promise.all([\n faas.faasName(),\n faas.faasVersion(),\n faas.faasInstance(),\n faas.faasCloudRegion(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN,\n [ATTR_FAAS_NAME]: faasName,\n [ATTR_FAAS_VERSION]: faasVersion,\n [ATTR_FAAS_INSTANCE]: faasInstance,\n [ATTR_CLOUD_REGION]: faasCloudRegion,\n });\n}\n\nasync function cloudFunctionsResource(): Promise<Resource> {\n const [faasName, faasVersion, faasInstance, faasCloudRegion] =\n await Promise.all([\n faas.faasName(),\n faas.faasVersion(),\n faas.faasInstance(),\n faas.faasCloudRegion(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS,\n [ATTR_FAAS_NAME]: faasName,\n [ATTR_FAAS_VERSION]: faasVersion,\n [ATTR_FAAS_INSTANCE]: faasInstance,\n [ATTR_CLOUD_REGION]: faasCloudRegion,\n });\n}\n\nasync function gaeResource(): Promise<Resource> {\n let zone, region;\n if (await gae.onAppEngineStandard()) {\n [zone, region] = await Promise.all([\n gae.standardAvailabilityZone(),\n gae.standardCloudRegion(),\n ]);\n } else {\n ({ zone, region } = await gce.availabilityZoneAndRegion());\n }\n const [faasName, faasVersion, faasInstance] = await Promise.all([\n gae.serviceName(),\n gae.serviceVersion(),\n gae.serviceInstance(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE,\n [ATTR_FAAS_NAME]: faasName,\n [ATTR_FAAS_VERSION]: faasVersion,\n [ATTR_FAAS_INSTANCE]: faasInstance,\n [ATTR_CLOUD_AVAILABILITY_ZONE]: zone,\n [ATTR_CLOUD_REGION]: region,\n });\n}\n\nasync function gceResource(): Promise<Resource> {\n const [zoneAndRegion, hostType, hostId, hostName] = await Promise.all([\n gce.availabilityZoneAndRegion(),\n gce.hostType(),\n gce.hostId(),\n gce.hostName(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE,\n [ATTR_CLOUD_AVAILABILITY_ZONE]: zoneAndRegion.zone,\n [ATTR_CLOUD_REGION]: zoneAndRegion.region,\n [ATTR_HOST_TYPE]: hostType,\n [ATTR_HOST_ID]: hostId,\n [ATTR_HOST_NAME]: hostName,\n });\n}\n\nasync function makeResource(attrs: GcpResourceAttributes): Promise<Resource> {\n const project = await metadata.project<string>('project-id');\n\n return resourceFromAttributes({\n [ATTR_CLOUD_PROVIDER]: CLOUD_PROVIDER_VALUE_GCP,\n [ATTR_CLOUD_ACCOUNT_ID]: project,\n ...attrs,\n } satisfies GcpResourceAttributes);\n}\n\n/**\n * Google Cloud resource detector which populates attributes based on the environment this\n * process is running in. If not on GCP, returns an empty resource.\n */\nexport class GcpDetector implements ResourceDetector {\n private async _asyncAttributes(): Promise<Attributes> {\n const resource = await context.with(\n suppressTracing(context.active()),\n detect\n );\n return resource.attributes;\n }\n\n public detect(): DetectedResource {\n const asyncAttributes = this._asyncAttributes();\n const attributes = {} as DetectedResourceAttributes;\n ATTRIBUTE_NAMES.forEach(name => {\n // Each resource attribute is determined asynchronously in _gatherData().\n attributes[name] = asyncAttributes.then(data => data[name]);\n });\n\n return { attributes };\n }\n}\n\nexport const gcpDetector = new GcpDetector();\n"]}
|
|
1
|
+
{"version":3,"file":"GcpDetector.js","sourceRoot":"","sources":["../../../src/detectors/GcpDetector.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,4CAA6C;AAC7C,8CAAsD;AACtD,wCAmBoB;AAGpB,wDAOkC;AAClC,yCAAyC;AACzC,+BAA+B;AAC/B,6BAA6B;AAC7B,6BAA6B;AAC7B,6BAA6B;AAE7B,MAAM,eAAe,GAAG;IACtB,6BAAmB;IACnB,sCAA4B;IAC5B,2BAAiB;IACjB,+BAAqB;IACrB,wBAAc;IACd,sBAAY;IACZ,wBAAc;IACd,6BAAmB;IACnB,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AAE,MAAM;QACtB,CAAC,wBAAc,CAAC,EAAE,QAAQ;KAC3B,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,KAA4B;IACtD,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAS,YAAY,CAAC,CAAC;IAE7D,OAAO,IAAA,kCAAsB,EAAC;QAC5B,CAAC,6BAAmB,CAAC,EAAE,kCAAwB;QAC/C,CAAC,+BAAqB,CAAC,EAAE,OAAO;QAChC,GAAG,KAAK;KACuB,CAAC,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,MAAa,WAAW;IACd,KAAK,CAAC,gBAAgB;QAC5B,MAAM,QAAQ,GAAG,MAAM,aAAO,CAAC,IAAI,CACjC,IAAA,sBAAe,EAAC,aAAO,CAAC,MAAM,EAAE,CAAC,EACjC,MAAM,CACP,CAAC;QACF,OAAO,QAAQ,CAAC,UAAU,CAAC;IAC7B,CAAC;IAEM,MAAM;QACX,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAChD,MAAM,UAAU,GAAG,EAAgC,CAAC;QACpD,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC7B,yEAAyE;YACzE,UAAU,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,UAAU,EAAE,CAAC;IACxB,CAAC;CACF;AAnBD,kCAmBC;AAEY,QAAA,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { context } from '@opentelemetry/api';\nimport { suppressTracing } from '@opentelemetry/core';\nimport {\n CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE,\n CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS,\n CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN,\n CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE,\n CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE,\n CLOUD_PROVIDER_VALUE_GCP,\n ATTR_CLOUD_ACCOUNT_ID,\n ATTR_CLOUD_AVAILABILITY_ZONE,\n ATTR_CLOUD_PLATFORM,\n ATTR_CLOUD_PROVIDER,\n ATTR_CLOUD_REGION,\n ATTR_FAAS_INSTANCE,\n ATTR_FAAS_NAME,\n ATTR_FAAS_VERSION,\n ATTR_HOST_ID,\n ATTR_HOST_NAME,\n ATTR_HOST_TYPE,\n ATTR_K8S_CLUSTER_NAME,\n} from '../semconv';\n\nimport { AttributeValue, Attributes } from '@opentelemetry/api';\nimport {\n DetectedResource,\n DetectedResourceAttributes,\n emptyResource,\n Resource,\n ResourceDetector,\n resourceFromAttributes,\n} from '@opentelemetry/resources';\nimport * as metadata from 'gcp-metadata';\nimport * as faas from './faas';\nimport * as gae from './gae';\nimport * as gce from './gce';\nimport * as gke from './gke';\n\nconst ATTRIBUTE_NAMES = [\n ATTR_CLOUD_PLATFORM,\n ATTR_CLOUD_AVAILABILITY_ZONE,\n ATTR_CLOUD_REGION,\n ATTR_K8S_CLUSTER_NAME,\n ATTR_HOST_TYPE,\n ATTR_HOST_ID,\n ATTR_HOST_NAME,\n ATTR_CLOUD_PROVIDER,\n ATTR_CLOUD_ACCOUNT_ID,\n ATTR_FAAS_NAME,\n ATTR_FAAS_VERSION,\n ATTR_FAAS_INSTANCE,\n] as const;\n\n// Ensure that all resource keys are accounted for in ATTRIBUTE_NAMES\ntype GcpResourceAttributeName = (typeof ATTRIBUTE_NAMES)[number];\ntype GcpResourceAttributes = Partial<\n Record<GcpResourceAttributeName, AttributeValue>\n>;\n\nasync function detect(): Promise<Resource> {\n if (!(await metadata.isAvailable())) {\n return emptyResource();\n }\n\n // Note the order of these if checks is significant with more specific resources coming\n // first. E.g. Cloud Functions gen2 are executed in Cloud Run so it must be checked first.\n if (await gke.onGke()) {\n return await gkeResource();\n } else if (await faas.onCloudFunctions()) {\n return await cloudFunctionsResource();\n } else if (await faas.onCloudRun()) {\n return await cloudRunResource();\n } else if (await gae.onAppEngine()) {\n return await gaeResource();\n } else if (await gce.onGce()) {\n return await gceResource();\n }\n\n return emptyResource();\n}\n\nasync function gkeResource(): Promise<Resource> {\n const [zoneOrRegion, k8sClusterName, hostId] = await Promise.all([\n gke.availabilityZoneOrRegion(),\n gke.clusterName(),\n gke.hostId(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE,\n [zoneOrRegion.type === 'zone'\n ? ATTR_CLOUD_AVAILABILITY_ZONE\n : ATTR_CLOUD_REGION]: zoneOrRegion.value,\n [ATTR_K8S_CLUSTER_NAME]: k8sClusterName,\n [ATTR_HOST_ID]: hostId,\n });\n}\n\nasync function cloudRunResource(): Promise<Resource> {\n const [faasName, faasVersion, faasInstance, faasCloudRegion] =\n await Promise.all([\n faas.faasName(),\n faas.faasVersion(),\n faas.faasInstance(),\n faas.faasCloudRegion(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN,\n [ATTR_FAAS_NAME]: faasName,\n [ATTR_FAAS_VERSION]: faasVersion,\n [ATTR_FAAS_INSTANCE]: faasInstance,\n [ATTR_CLOUD_REGION]: faasCloudRegion,\n });\n}\n\nasync function cloudFunctionsResource(): Promise<Resource> {\n const [faasName, faasVersion, faasInstance, faasCloudRegion] =\n await Promise.all([\n faas.faasName(),\n faas.faasVersion(),\n faas.faasInstance(),\n faas.faasCloudRegion(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS,\n [ATTR_FAAS_NAME]: faasName,\n [ATTR_FAAS_VERSION]: faasVersion,\n [ATTR_FAAS_INSTANCE]: faasInstance,\n [ATTR_CLOUD_REGION]: faasCloudRegion,\n });\n}\n\nasync function gaeResource(): Promise<Resource> {\n let zone, region;\n if (await gae.onAppEngineStandard()) {\n [zone, region] = await Promise.all([\n gae.standardAvailabilityZone(),\n gae.standardCloudRegion(),\n ]);\n } else {\n ({ zone, region } = await gce.availabilityZoneAndRegion());\n }\n const [faasName, faasVersion, faasInstance] = await Promise.all([\n gae.serviceName(),\n gae.serviceVersion(),\n gae.serviceInstance(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE,\n [ATTR_FAAS_NAME]: faasName,\n [ATTR_FAAS_VERSION]: faasVersion,\n [ATTR_FAAS_INSTANCE]: faasInstance,\n [ATTR_CLOUD_AVAILABILITY_ZONE]: zone,\n [ATTR_CLOUD_REGION]: region,\n });\n}\n\nasync function gceResource(): Promise<Resource> {\n const [zoneAndRegion, hostType, hostId, hostName] = await Promise.all([\n gce.availabilityZoneAndRegion(),\n gce.hostType(),\n gce.hostId(),\n gce.hostName(),\n ]);\n\n return await makeResource({\n [ATTR_CLOUD_PLATFORM]: CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE,\n [ATTR_CLOUD_AVAILABILITY_ZONE]: zoneAndRegion.zone,\n [ATTR_CLOUD_REGION]: zoneAndRegion.region,\n [ATTR_HOST_TYPE]: hostType,\n [ATTR_HOST_ID]: hostId,\n [ATTR_HOST_NAME]: hostName,\n });\n}\n\nasync function makeResource(attrs: GcpResourceAttributes): Promise<Resource> {\n const project = await metadata.project<string>('project-id');\n\n return resourceFromAttributes({\n [ATTR_CLOUD_PROVIDER]: CLOUD_PROVIDER_VALUE_GCP,\n [ATTR_CLOUD_ACCOUNT_ID]: project,\n ...attrs,\n } satisfies GcpResourceAttributes);\n}\n\n/**\n * Google Cloud resource detector which populates attributes based on the environment this\n * process is running in. If not on GCP, returns an empty resource.\n */\nexport class GcpDetector implements ResourceDetector {\n private async _asyncAttributes(): Promise<Attributes> {\n const resource = await context.with(\n suppressTracing(context.active()),\n detect\n );\n return resource.attributes;\n }\n\n public detect(): DetectedResource {\n const asyncAttributes = this._asyncAttributes();\n const attributes = {} as DetectedResourceAttributes;\n ATTRIBUTE_NAMES.forEach(name => {\n // Each resource attribute is determined asynchronously in _gatherData().\n attributes[name] = asyncAttributes.then(data => data[name]);\n });\n\n return { attributes };\n }\n}\n\nexport const gcpDetector = new GcpDetector();\n"]}
|
|
@@ -2,18 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
4
|
* Copyright 2023 Google LLC
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
17
6
|
*/
|
|
18
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
8
|
exports.faasCloudRegion = exports.faasInstance = exports.faasVersion = exports.faasName = exports.onCloudFunctions = exports.onCloudRun = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faas.js","sourceRoot":"","sources":["../../../src/detectors/faas.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"faas.js","sourceRoot":"","sources":["../../../src/detectors/faas.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;GAGG;AAEH,yCAAyC;AAEzC,MAAM,gB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B,IAAI,GAAG,KAAK,SAAS,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,YAAY,CAAC,CAAC;KAC1D;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Implementation in this file copied from\n * https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/v1.8.0/detectors/gcp/faas.go\n */\n\nimport * as metadata from 'gcp-metadata';\n\nconst ID_METADATA_ATTR = 'id';\nconst CLOUD_RUN_CONFIG_ENV = 'K_CONFIGURATION';\nconst CLOUD_FUNCTION_TARGET_ENV = 'FUNCTION_TARGET';\nconst FAAS_SERVICE_ENV = 'K_SERVICE';\nconst FAAS_REVISION_ENV = 'K_REVISION';\nconst REGION_METADATA_ATTR = 'region';\n\nexport async function onCloudRun(): Promise<boolean> {\n return process.env[CLOUD_RUN_CONFIG_ENV] !== undefined;\n}\n\nexport async function onCloudFunctions(): Promise<boolean> {\n return process.env[CLOUD_FUNCTION_TARGET_ENV] !== undefined;\n}\n\n/**\n * The name of the Cloud Run or Cloud Function. Check that {@link onCloudRun()} or {@link\n * onCloudFunctions()} is true before calling this, or it may throw exceptions.\n */\nexport async function faasName(): Promise<string> {\n return lookupEnv(FAAS_SERVICE_ENV);\n}\n\n/**\n * The version/revision of the Cloud Run or Cloud Function. Check that {@link onCloudRun()} or\n * {@link onCloudFunctions()} is true before calling this, or it may throw exceptions.\n */\nexport async function faasVersion(): Promise<string> {\n return lookupEnv(FAAS_REVISION_ENV);\n}\n\n/**\n * The ID for the running instance of a Cloud Run or Cloud Function. Check that {@link\n * onCloudRun()} or {@link onCloudFunctions()} is true before calling this, or it may throw\n * exceptions.\n */\nexport async function faasInstance(): Promise<string> {\n // May be a bignumber.js BigNumber which can just be converted with toString(). See\n // https://github.com/googleapis/gcp-metadata#take-care-with-large-number-valued-properties\n const id = await metadata.instance<number | object>(ID_METADATA_ATTR);\n return id.toString();\n}\n\n/**\n * The cloud region where the running instance of a Cloud Run or Cloud Function is located.\n * Check that {@link onCloudRun()} or {@link onCloudFunctions()} is true before calling this,\n * or it may throw exceptions.\n */\nexport async function faasCloudRegion(): Promise<string> {\n const region = await metadata.instance<string>(REGION_METADATA_ATTR);\n return region.slice(region.lastIndexOf('/') + 1);\n}\n\nfunction lookupEnv(key: string): string {\n const val = process.env[key];\n if (val === undefined) {\n throw new Error(`Environment variable ${key} not found`);\n }\n return val;\n}\n"]}
|
|
@@ -2,18 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
4
|
* Copyright 2023 Google LLC
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
17
6
|
*/
|
|
18
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
8
|
exports.standardCloudRegion = exports.standardAvailabilityZone = exports.flexAvailabilityZoneAndRegion = exports.serviceInstance = exports.serviceVersion = exports.serviceName = exports.onAppEngine = exports.onAppEngineStandard = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gae.js","sourceRoot":"","sources":["../../../src/detectors/gae.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"gae.js","sourceRoot":"","sources":["../../../src/detectors/gae.ts"],"names":[],"m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;GAGG;AACI,KAAK,UAAU,mBAAmB;IACvC,OAAO,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;AACtC,CAAC;AAFD,kDAEC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,GAAG,KAAK,SAAS,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,YAAY,CAAC,CAAC;KAC1D;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Implementation in this file copied from\n * https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/v1.8.0/detectors/gcp/app_engine.go\n */\n\nimport * as metadata from 'gcp-metadata';\nimport * as gce from './gce';\nimport * as faas from './faas';\n\nconst GAE_SERVICE_ENV = 'GAE_SERVICE';\nconst GAE_VERSION_ENV = 'GAE_VERSION';\nconst GAE_INSTANCE_ENV = 'GAE_INSTANCE';\nconst GAE_ENV = 'GAE_ENV';\nconst GAE_STANDARD = 'standard';\nconst ZONE_METADATA_ATTR = 'zone';\n\nexport async function onAppEngineStandard(): Promise<boolean> {\n return process.env[GAE_ENV] === GAE_STANDARD;\n}\n\nexport async function onAppEngine(): Promise<boolean> {\n return process.env[GAE_SERVICE_ENV] !== undefined;\n}\n\n/**\n * The service name of the app engine service. Check that {@link onAppEngine()} is true before\n * calling this, or it may throw exceptions.\n */\nexport async function serviceName(): Promise<string> {\n return lookupEnv(GAE_SERVICE_ENV);\n}\n\n/**\n * The service version of the app engine service. Check that {@link onAppEngine()} is true\n * before calling this, or it may throw exceptions.\n */\nexport async function serviceVersion(): Promise<string> {\n return lookupEnv(GAE_VERSION_ENV);\n}\n\n/**\n * The service instance of the app engine service. Check that {@link onAppEngine()} is true\n * before calling this, or it may throw exceptions.\n */\nexport async function serviceInstance(): Promise<string> {\n return lookupEnv(GAE_INSTANCE_ENV);\n}\n\n/**\n * The zone and region in which this program is running. Check that {@link onAppEngine()} is\n * true before calling this, or it may throw exceptions.\n */\nexport async function flexAvailabilityZoneAndRegion(): Promise<{\n zone: string;\n region: string;\n}> {\n return await gce.availabilityZoneAndRegion();\n}\n\n/**\n * The zone the app engine service is running in. Check that {@link onAppEngineStandard()} is\n * true before calling this, or it may throw exceptions.\n */\nexport async function standardAvailabilityZone(): Promise<string> {\n const zone = await metadata.instance<string>(ZONE_METADATA_ATTR);\n // zone is of the form \"projects/233510669999/zones/us15\"\n return zone.slice(zone.lastIndexOf('/') + 1);\n}\n\n/**\n * The region the app engine service is running in. Check that {@link onAppEngineStandard()} is\n * true before calling this, or it may throw exceptions.\n */\nexport async function standardCloudRegion(): Promise<string> {\n return await faas.faasCloudRegion();\n}\n\nfunction lookupEnv(key: string): string {\n const val = process.env[key];\n if (val === undefined) {\n throw new Error(`Environment variable ${key} not found`);\n }\n return val;\n}\n"]}
|
|
@@ -2,18 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
4
|
* Copyright 2022 Google LLC
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
17
6
|
*/
|
|
18
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
8
|
exports.availabilityZoneAndRegion = exports.hostName = exports.hostId = exports.hostType = exports.onGce = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gce.js","sourceRoot":"","sources":["../../../src/detectors/gce.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"gce.js","sourceRoot":"","sources":["../../../src/detectors/gce.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;GAGG;AAEH,4CAA0C;AAC1C,yCAAyC;AAEzC,MAAM,0BAA0B,GAAG,cAAc,CAAC;AAClD,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,uBAAuB,GAAG,MAAM,CAAC;AACvC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAE3B,KAAK,UAAU,KAAK;IACzB,IAAI;QACF,MAAM,QAAQ,CAAC,QAAQ,CAAS,0BAA0B,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,GAAG,EAAE;QACZ,UAAI,CAAC,KAAK,CACR,0EAA0E,EAC1E,0BAA0B,EAC1B,GAAG,CACJ,CAAC;QACF,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAZD,sBAYC;AAED;;;GAGG;AACI,KAAK,UAAU,QAAQ;IAC5B,OAAO,QAAQ,CAAC,QAAQ,CAAS,0BAA0B,CAAC,CAAC;AAC/D,CAAC;AAFD,4BAEC;AAED;;;GAGG;AACI,KAAK,UAAU,MAAM;IAC1B,mFAAmF;IACnF,2FAA2F;IAC3F,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAkB,gBAAgB,CAAC,CAAC;IACtE,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;AACvB,CAAC;AALD,wBAKC;AAED;;;GAGG;AACI,KAAK,UAAU,QAAQ;IAC5B,OAAO,QAAQ,CAAC,QAAQ,CAAS,uBAAuB,CAAC,CAAC;AAC5D,CAAC;AAFD,4BAEC;AAED;;;GAGG;AACI,KAAK,UAAU,yBAAyB;IAI7C,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAS,kBAAkB,CAAC,CAAC;IAErE,sBAAsB;IACtB,8FAA8F;IAC9F,MAAM,EAAE,GAAG,uDAAuD,CAAC;IACnE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC;IAC1D,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE;QACpB,MAAM,IAAI,KAAK,CACb,4FAA4F,QAAQ,EAAE,CACvG,CAAC;KACH;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC;AAjBD,8DAiBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Implementation in this file copied from\n * https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/v1.8.0/detectors/gcp/gce.go\n */\n\nimport { diag } from '@opentelemetry/api';\nimport * as metadata from 'gcp-metadata';\n\nconst MACHINE_TYPE_METADATA_ATTR = 'machine-type';\nconst ID_METADATA_ATTR = 'id';\nconst HOST_NAME_METADATA_ATTR = 'name';\nconst ZONE_METADATA_ATTR = 'zone';\n\nexport async function onGce(): Promise<boolean> {\n try {\n await metadata.instance<string>(MACHINE_TYPE_METADATA_ATTR);\n return true;\n } catch (err) {\n diag.debug(\n 'Could not fetch metadata attribute %s, assuming not on GCE. Error was %s',\n MACHINE_TYPE_METADATA_ATTR,\n err\n );\n return false;\n }\n}\n\n/**\n * The machine type of the instance on which this program is running. Check that {@link\n * onGce()} is true before calling this, or it may throw exceptions.\n */\nexport async function hostType(): Promise<string> {\n return metadata.instance<string>(MACHINE_TYPE_METADATA_ATTR);\n}\n\n/**\n * The instance ID of the instance on which this program is running. Check that {@link onGce()}\n * is true before calling this, or it may throw exceptions.\n */\nexport async function hostId(): Promise<string> {\n // May be a bignumber.js BigNumber which can just be converted with toString(). See\n // https://github.com/googleapis/gcp-metadata#take-care-with-large-number-valued-properties\n const id = await metadata.instance<number | object>(ID_METADATA_ATTR);\n return id.toString();\n}\n\n/**\n * The instance ID of the instance on which this program is running. Check that {@link onGce()}\n * is true before calling this, or it may throw exceptions.\n */\nexport async function hostName(): Promise<string> {\n return metadata.instance<string>(HOST_NAME_METADATA_ATTR);\n}\n\n/**\n * The zone and region in which this program is running. Check that {@link onGce()} is true\n * before calling this, or it may throw exceptions.\n */\nexport async function availabilityZoneAndRegion(): Promise<{\n zone: string;\n region: string;\n}> {\n const fullZone = await metadata.instance<string>(ZONE_METADATA_ATTR);\n\n // Format described in\n // https://cloud.google.com/compute/docs/metadata/default-metadata-values#vm_instance_metadata\n const re = /projects\\/\\d+\\/zones\\/(?<zone>(?<region>\\w+-\\w+)-\\w+)/;\n const { zone, region } = fullZone.match(re)?.groups ?? {};\n if (!zone || !region) {\n throw new Error(\n `zone was not in the expected format: projects/PROJECT_NUM/zones/COUNTRY-REGION-ZONE. Got ${fullZone}`\n );\n }\n\n return { zone, region };\n}\n"]}
|
|
@@ -2,18 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
4
|
* Copyright 2022 Google LLC
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
17
6
|
*/
|
|
18
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
8
|
exports.availabilityZoneOrRegion = exports.clusterName = exports.hostId = exports.onGke = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gke.js","sourceRoot":"","sources":["../../../src/detectors/gke.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"gke.js","sourceRoot":"","sources":["../../../src/detectors/gke.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;GAGG;AAEH,yCAAyC;AACzC,6BAA6B;AAE7B,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AAC9D,MAAM,0BAA0B,GAAG,yBAAyB,CAAC;AAC7D,MAAM,8BAA8B,GAAG,6BAA6B,CAAC;AAE9D,KAAK,UAAU,KAAK;IACzB,OAAO,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,KAAK,SAAS,CAAC;AAChE,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACI,KAAK,UAAU,MAAM;IAC1B,OAAO,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;AAC5B,CAAC;AAFD,wBAEC;AAED;;;GAGG;AACI,KAAK,UAAU,WAAW;IAC/B,OAAO,QAAQ,CAAC,QAAQ,CAAS,0BAA0B,CAAC,CAAC;AAC/D,CAAC;AAFD,kCAEC;AAED;;;GAGG;AACI,KAAK,UAAU,wBAAwB;IAI5C,MAAM,eAAe,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAC7C,8BAA8B,CAC/B,CAAC;IACF,QAAQ,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC,EAAE;QACvC,KAAK,CAAC;YACJ,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;QACpD,KAAK,CAAC;YACJ,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;QAClD;YACE,MAAM,IAAI,KAAK,CACb,6CAA6C,eAAe,EAAE,CAC/D,CAAC;KACL;AACH,CAAC;AAjBD,4DAiBC;AAED,SAAS,SAAS,CAAC,CAAS,EAAE,IAAY;IACxC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACjC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;YACjB,KAAK,IAAI,CAAC,CAAC;SACZ;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Implementation in this file copied from\n * https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/v1.8.0/detectors/gcp/gke.go\n */\n\nimport * as metadata from 'gcp-metadata';\nimport * as gce from './gce';\n\nconst KUBERNETES_SERVICE_HOST_ENV = 'KUBERNETES_SERVICE_HOST';\nconst CLUSTER_NAME_METADATA_ATTR = 'attributes/cluster-name';\nconst CLUSTER_LOCATION_METADATA_ATTR = 'attributes/cluster-location';\n\nexport async function onGke(): Promise<boolean> {\n return process.env[KUBERNETES_SERVICE_HOST_ENV] !== undefined;\n}\n\n/**\n * The instance ID of the instance on which this program is running. Check that {@link onGke()}\n * is true before calling this, or it may throw exceptions.\n */\nexport async function hostId(): Promise<string> {\n return await gce.hostId();\n}\n\n/**\n * The name of the GKE cluster in which this program is running. Check that {@link onGke()} is\n * true before calling this, or it may throw exceptions.\n */\nexport async function clusterName(): Promise<string> {\n return metadata.instance<string>(CLUSTER_NAME_METADATA_ATTR);\n}\n\n/**\n * The location of the cluster and whether the cluster is zonal or regional. Check that {@link\n * onGke()} is true before calling this, or it may throw exceptions.\n */\nexport async function availabilityZoneOrRegion(): Promise<{\n type: 'zone' | 'region';\n value: string;\n}> {\n const clusterLocation = await metadata.instance<string>(\n CLUSTER_LOCATION_METADATA_ATTR\n );\n switch (countChar(clusterLocation, '-')) {\n case 1:\n return { type: 'region', value: clusterLocation };\n case 2:\n return { type: 'zone', value: clusterLocation };\n default:\n throw new Error(\n `unrecognized format for cluster location: ${clusterLocation}`\n );\n }\n}\n\nfunction countChar(s: string, char: string): number {\n let count = 0;\n for (let i = 0; i < s.length; i++) {\n if (s[i] === char) {\n count += 1;\n }\n }\n return count;\n}\n"]}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
7
|
exports.gcpDetector = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/detectors/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/detectors/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6CAA4C;AAAnC,0GAAA,WAAW,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { gcpDetector } from './GcpDetector';\n"]}
|
package/build/src/index.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
7
|
exports.resetIsAvailableCache = exports.gcpDetector = void 0;
|
package/build/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAA0C;AAAjC,wGAAA,WAAW,OAAA;AAEpB,iCAAiC;AACjC,6CAAqD;AAA5C,qHAAA,qBAAqB,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { gcpDetector } from './detectors';\n\n// Internal - used for tests only\nexport { resetIsAvailableCache } from 'gcp-metadata';\n"]}
|
package/build/src/semconv.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
7
|
exports.CLOUD_PROVIDER_VALUE_GCP = exports.CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE = exports.CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE = exports.CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN = exports.CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS = exports.CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE = exports.ATTR_K8S_CLUSTER_NAME = exports.ATTR_HOST_TYPE = exports.ATTR_HOST_NAME = exports.ATTR_HOST_ID = exports.ATTR_FAAS_VERSION = exports.ATTR_FAAS_NAME = exports.ATTR_FAAS_INSTANCE = exports.ATTR_CLOUD_REGION = exports.ATTR_CLOUD_PROVIDER = exports.ATTR_CLOUD_PLATFORM = exports.ATTR_CLOUD_AVAILABILITY_ZONE = exports.ATTR_CLOUD_ACCOUNT_ID = void 0;
|
package/build/src/semconv.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH;;;;;;;GAOG;AACU,QAAA,qBAAqB,GAAG,kBAA2B,CAAC;AAEjE;;;;;;;;GAQG;AACU,QAAA,4BAA4B,GAAG,yBAAkC,CAAC;AAE/E;;;;;;GAMG;AACU,QAAA,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;GAIG;AACU,QAAA,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;;;;;;GASG;AACU,QAAA,iBAAiB,GAAG,cAAuB,CAAC;AAEzD;;;;;;;;GAQG;AACU,QAAA,kBAAkB,GAAG,eAAwB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACU,QAAA,cAAc,GAAG,WAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,iBAAiB,GAAG,cAAuB,CAAC;AAEzD;;;;;;GAMG;AACU,QAAA,YAAY,GAAG,SAAkB,CAAC;AAE/C;;;;;;GAMG;AACU,QAAA,cAAc,GAAG,WAAoB,CAAC;AAEnD;;;;;;GAMG;AACU,QAAA,cAAc,GAAG,WAAoB,CAAC;AAEnD;;;;;;GAMG;AACU,QAAA,qBAAqB,GAAG,kBAA2B,CAAC;AAEjE;;;;;;GAMG;AACU,QAAA,mCAAmC,GAAG,gBAAyB,CAAC;AAE7E;;;;;;GAMG;AACU,QAAA,wCAAwC,GACnD,qBAA8B,CAAC;AAEjC;;;;;;GAMG;AACU,QAAA,kCAAkC,GAAG,eAAwB,CAAC;AAE3E;;;;;;GAMG;AACU,QAAA,uCAAuC,GAClD,oBAA6B,CAAC;AAEhC;;;;;;GAMG;AACU,QAAA,0CAA0C,GACrD,uBAAgC,CAAC;AAEnC;;;;;;GAMG;AACU,QAAA,wBAAwB,GAAG,KAAc,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * The cloud account ID the resource is assigned to.\n *\n * @example 111111111111\n * @example opentelemetry\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_ACCOUNT_ID = 'cloud.account.id' as const;\n\n/**\n * Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.\n *\n * @example us-east-1c\n *\n * @note Availability zones are called \"zones\" on Alibaba Cloud and Google Cloud.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_AVAILABILITY_ZONE = 'cloud.availability_zone' as const;\n\n/**\n * The cloud platform in use.\n *\n * @note The prefix of the service **SHOULD** match the one specified in `cloud.provider`.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_PLATFORM = 'cloud.platform' as const;\n\n/**\n * Name of the cloud provider.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_PROVIDER = 'cloud.provider' as const;\n\n/**\n * The geographical region within a cloud provider. When associated with a resource, this attribute specifies the region where the resource operates. When calling services or APIs deployed on a cloud, this attribute identifies the region where the called destination is deployed.\n *\n * @example us-central1\n * @example us-east-1\n *\n * @note Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_REGION = 'cloud.region' as const;\n\n/**\n * The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version.\n *\n * @example 2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de\n *\n * @note - **AWS Lambda:** Use the (full) log stream name.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_INSTANCE = 'faas.instance' as const;\n\n/**\n * The name of the single function that this runtime instance executes.\n *\n * @example my-function\n * @example myazurefunctionapp/some-function-name\n *\n * @note This is the name of the function as configured/deployed on the FaaS\n * platform and is usually different from the name of the callback\n * function (which may be stored in the\n * [`code.namespace`/`code.function.name`](/docs/general/attributes.md#source-code-attributes)\n * span attributes).\n *\n * For some cloud providers, the above definition is ambiguous. The following\n * definition of function name **MUST** be used for this attribute\n * (and consequently the span name) for the listed cloud providers/products:\n *\n * - **Azure:** The full name `<FUNCAPP>/<FUNC>`, i.e., function app name\n * followed by a forward slash followed by the function name (this form\n * can also be seen in the resource JSON for the function).\n * This means that a span attribute **MUST** be used, as an Azure function\n * app can host multiple functions that would usually share\n * a TracerProvider (see also the `cloud.resource_id` attribute).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_NAME = 'faas.name' as const;\n\n/**\n * The immutable version of the function being executed.\n *\n * @example 26\n * @example pinkfroid-00002\n *\n * @note Depending on the cloud provider and platform, use:\n *\n * - **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html)\n * (an integer represented as a decimal string).\n * - **Google Cloud Run (Services):** The [revision](https://cloud.google.com/run/docs/managing/revisions)\n * (i.e., the function name plus the revision suffix).\n * - **Google Cloud Functions:** The value of the\n * [`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically).\n * - **Azure Functions:** Not applicable. Do not set this attribute.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_VERSION = 'faas.version' as const;\n\n/**\n * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the `machine-id`. See the table below for the sources to use to determine the `machine-id` based on operating system.\n *\n * @example fdbf79e8af94cb7f9e8df36789187052\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HOST_ID = 'host.id' as const;\n\n/**\n * Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user.\n *\n * @example opentelemetry-test\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HOST_NAME = 'host.name' as const;\n\n/**\n * Type of host. For Cloud, this must be the machine type.\n *\n * @example n1-standard-1\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HOST_TYPE = 'host.type' as const;\n\n/**\n * The name of the cluster.\n *\n * @example opentelemetry-cluster\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_K8S_CLUSTER_NAME = 'k8s.cluster.name' as const;\n\n/**\n * Enum value \"gcp_app_engine\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud App Engine (GAE)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE = 'gcp_app_engine' as const;\n\n/**\n * Enum value \"gcp_cloud_functions\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Functions (GCF)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS =\n 'gcp_cloud_functions' as const;\n\n/**\n * Enum value \"gcp_cloud_run\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Run\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN = 'gcp_cloud_run' as const;\n\n/**\n * Enum value \"gcp_compute_engine\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Compute Engine (GCE)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE =\n 'gcp_compute_engine' as const;\n\n/**\n * Enum value \"gcp_kubernetes_engine\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Kubernetes Engine (GKE)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE =\n 'gcp_kubernetes_engine' as const;\n\n/**\n * Enum value \"gcp\" for attribute {@link ATTR_CLOUD_PROVIDER}.\n *\n * Google Cloud Platform\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PROVIDER_VALUE_GCP = 'gcp' as const;\n"]}
|
|
1
|
+
{"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AAEH;;;;;;;GAOG;AACU,QAAA,qBAAqB,GAAG,kBAA2B,CAAC;AAEjE;;;;;;;;GAQG;AACU,QAAA,4BAA4B,GAAG,yBAAkC,CAAC;AAE/E;;;;;;GAMG;AACU,QAAA,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;GAIG;AACU,QAAA,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;;;;;;GASG;AACU,QAAA,iBAAiB,GAAG,cAAuB,CAAC;AAEzD;;;;;;;;GAQG;AACU,QAAA,kBAAkB,GAAG,eAAwB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACU,QAAA,cAAc,GAAG,WAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,iBAAiB,GAAG,cAAuB,CAAC;AAEzD;;;;;;GAMG;AACU,QAAA,YAAY,GAAG,SAAkB,CAAC;AAE/C;;;;;;GAMG;AACU,QAAA,cAAc,GAAG,WAAoB,CAAC;AAEnD;;;;;;GAMG;AACU,QAAA,cAAc,GAAG,WAAoB,CAAC;AAEnD;;;;;;GAMG;AACU,QAAA,qBAAqB,GAAG,kBAA2B,CAAC;AAEjE;;;;;;GAMG;AACU,QAAA,mCAAmC,GAAG,gBAAyB,CAAC;AAE7E;;;;;;GAMG;AACU,QAAA,wCAAwC,GACnD,qBAA8B,CAAC;AAEjC;;;;;;GAMG;AACU,QAAA,kCAAkC,GAAG,eAAwB,CAAC;AAE3E;;;;;;GAMG;AACU,QAAA,uCAAuC,GAClD,oBAA6B,CAAC;AAEhC;;;;;;GAMG;AACU,QAAA,0CAA0C,GACrD,uBAAgC,CAAC;AAEnC;;;;;;GAMG;AACU,QAAA,wBAAwB,GAAG,KAAc,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * The cloud account ID the resource is assigned to.\n *\n * @example 111111111111\n * @example opentelemetry\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_ACCOUNT_ID = 'cloud.account.id' as const;\n\n/**\n * Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.\n *\n * @example us-east-1c\n *\n * @note Availability zones are called \"zones\" on Alibaba Cloud and Google Cloud.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_AVAILABILITY_ZONE = 'cloud.availability_zone' as const;\n\n/**\n * The cloud platform in use.\n *\n * @note The prefix of the service **SHOULD** match the one specified in `cloud.provider`.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_PLATFORM = 'cloud.platform' as const;\n\n/**\n * Name of the cloud provider.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_PROVIDER = 'cloud.provider' as const;\n\n/**\n * The geographical region within a cloud provider. When associated with a resource, this attribute specifies the region where the resource operates. When calling services or APIs deployed on a cloud, this attribute identifies the region where the called destination is deployed.\n *\n * @example us-central1\n * @example us-east-1\n *\n * @note Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_CLOUD_REGION = 'cloud.region' as const;\n\n/**\n * The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version.\n *\n * @example 2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de\n *\n * @note - **AWS Lambda:** Use the (full) log stream name.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_INSTANCE = 'faas.instance' as const;\n\n/**\n * The name of the single function that this runtime instance executes.\n *\n * @example my-function\n * @example myazurefunctionapp/some-function-name\n *\n * @note This is the name of the function as configured/deployed on the FaaS\n * platform and is usually different from the name of the callback\n * function (which may be stored in the\n * [`code.namespace`/`code.function.name`](/docs/general/attributes.md#source-code-attributes)\n * span attributes).\n *\n * For some cloud providers, the above definition is ambiguous. The following\n * definition of function name **MUST** be used for this attribute\n * (and consequently the span name) for the listed cloud providers/products:\n *\n * - **Azure:** The full name `<FUNCAPP>/<FUNC>`, i.e., function app name\n * followed by a forward slash followed by the function name (this form\n * can also be seen in the resource JSON for the function).\n * This means that a span attribute **MUST** be used, as an Azure function\n * app can host multiple functions that would usually share\n * a TracerProvider (see also the `cloud.resource_id` attribute).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_NAME = 'faas.name' as const;\n\n/**\n * The immutable version of the function being executed.\n *\n * @example 26\n * @example pinkfroid-00002\n *\n * @note Depending on the cloud provider and platform, use:\n *\n * - **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html)\n * (an integer represented as a decimal string).\n * - **Google Cloud Run (Services):** The [revision](https://cloud.google.com/run/docs/managing/revisions)\n * (i.e., the function name plus the revision suffix).\n * - **Google Cloud Functions:** The value of the\n * [`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically).\n * - **Azure Functions:** Not applicable. Do not set this attribute.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_VERSION = 'faas.version' as const;\n\n/**\n * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the `machine-id`. See the table below for the sources to use to determine the `machine-id` based on operating system.\n *\n * @example fdbf79e8af94cb7f9e8df36789187052\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HOST_ID = 'host.id' as const;\n\n/**\n * Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user.\n *\n * @example opentelemetry-test\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HOST_NAME = 'host.name' as const;\n\n/**\n * Type of host. For Cloud, this must be the machine type.\n *\n * @example n1-standard-1\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HOST_TYPE = 'host.type' as const;\n\n/**\n * The name of the cluster.\n *\n * @example opentelemetry-cluster\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_K8S_CLUSTER_NAME = 'k8s.cluster.name' as const;\n\n/**\n * Enum value \"gcp_app_engine\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud App Engine (GAE)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE = 'gcp_app_engine' as const;\n\n/**\n * Enum value \"gcp_cloud_functions\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Functions (GCF)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS =\n 'gcp_cloud_functions' as const;\n\n/**\n * Enum value \"gcp_cloud_run\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Run\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN = 'gcp_cloud_run' as const;\n\n/**\n * Enum value \"gcp_compute_engine\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Compute Engine (GCE)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE =\n 'gcp_compute_engine' as const;\n\n/**\n * Enum value \"gcp_kubernetes_engine\" for attribute {@link ATTR_CLOUD_PLATFORM}.\n *\n * Google Cloud Kubernetes Engine (GKE)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE =\n 'gcp_kubernetes_engine' as const;\n\n/**\n * Enum value \"gcp\" for attribute {@link ATTR_CLOUD_PROVIDER}.\n *\n * Google Cloud Platform\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const CLOUD_PROVIDER_VALUE_GCP = 'gcp' as const;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/resource-detector-gcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"description": "OpenTelemetry SDK resource detector for GCP",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"module": "build/esm/index.js",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@opentelemetry/api": "^1.0.0",
|
|
47
|
-
"@opentelemetry/contrib-test-utils": "^0.
|
|
48
|
-
"@opentelemetry/instrumentation-http": "^0.
|
|
47
|
+
"@opentelemetry/contrib-test-utils": "^0.63.0",
|
|
48
|
+
"@opentelemetry/instrumentation-http": "^0.216.0",
|
|
49
49
|
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
50
50
|
"bignumber.js": "9.3.1"
|
|
51
51
|
},
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
},
|
|
60
60
|
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/resource-detector-gcp#readme",
|
|
61
61
|
"sideEffects": false,
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "03ed3a3a4ab3f9fd481ba81dddb72b3f8e7dae30"
|
|
63
63
|
}
|