Skip to content

Commit 3153771

Browse files
committed
fixup! refactor(resource-detector-gcp): migrate away from getEnv()
1 parent efbf8bc commit 3153771

File tree

1 file changed

+3
-5
lines changed
  • detectors/node/opentelemetry-resource-detector-gcp/src/detectors

1 file changed

+3
-5
lines changed

detectors/node/opentelemetry-resource-detector-gcp/src/detectors/GcpDetector.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,10 @@ class GcpDetector implements DetectorSync {
9090
attributes: ResourceAttributes,
9191
clusterName: string
9292
): void {
93-
const env = getEnv();
94-
9593
attributes[SEMRESATTRS_K8S_CLUSTER_NAME] = clusterName;
96-
attributes[SEMRESATTRS_K8S_NAMESPACE_NAME] = env.NAMESPACE;
97-
attributes[SEMRESATTRS_K8S_POD_NAME] = env.HOSTNAME;
98-
attributes[SEMRESATTRS_CONTAINER_NAME] = env.CONTAINER_NAME;
94+
attributes[SEMRESATTRS_K8S_NAMESPACE_NAME] = process.env.NAMESPACE ?? '';
95+
attributes[SEMRESATTRS_K8S_POD_NAME] = process.env.HOSTNAME ?? '';
96+
attributes[SEMRESATTRS_CONTAINER_NAME] = process.env.CONTAINER_NAME ?? '';
9997
}
10098

10199
/** Gets project id from GCP project metadata. */

0 commit comments

Comments
 (0)