@opentelemetry/resource-detector-gcp
Advanced tools
Comparing version 0.29.11 to 0.29.12
@@ -15,3 +15,3 @@ import { DetectorSync, ResourceDetectionConfig, IResource } from '@opentelemetry/resources'; | ||
*/ | ||
private _getAttribures; | ||
private _getAttributes; | ||
/** Add resource attributes for K8s */ | ||
@@ -18,0 +18,0 @@ private _addK8sAttributes; |
@@ -21,4 +21,5 @@ "use strict"; | ||
const api_1 = require("@opentelemetry/api"); | ||
const core_1 = require("@opentelemetry/core"); | ||
const resources_1 = require("@opentelemetry/resources"); | ||
const core_1 = require("@opentelemetry/core"); | ||
const core_2 = require("@opentelemetry/core"); | ||
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions"); | ||
@@ -32,3 +33,4 @@ /** | ||
detect(_config) { | ||
return new resources_1.Resource({}, this._getAttribures()); | ||
const attributes = api_1.context.with((0, core_1.suppressTracing)(api_1.context.active()), () => this._getAttributes()); | ||
return new resources_1.Resource({}, attributes); | ||
} | ||
@@ -41,3 +43,3 @@ /** | ||
*/ | ||
async _getAttribures() { | ||
async _getAttributes() { | ||
if (!(await gcpMetadata.isAvailable())) { | ||
@@ -60,3 +62,3 @@ api_1.diag.debug('GcpDetector failed: GCP Metadata unavailable.'); | ||
attributes[semantic_conventions_1.SEMRESATTRS_CLOUD_PROVIDER] = semantic_conventions_1.CLOUDPROVIDERVALUES_GCP; | ||
if ((0, core_1.getEnv)().KUBERNETES_SERVICE_HOST) | ||
if ((0, core_2.getEnv)().KUBERNETES_SERVICE_HOST) | ||
this._addK8sAttributes(attributes, clusterName); | ||
@@ -67,3 +69,3 @@ return attributes; | ||
_addK8sAttributes(attributes, clusterName) { | ||
const env = (0, core_1.getEnv)(); | ||
const env = (0, core_2.getEnv)(); | ||
attributes[semantic_conventions_1.SEMRESATTRS_K8S_CLUSTER_NAME] = clusterName; | ||
@@ -70,0 +72,0 @@ attributes[semantic_conventions_1.SEMRESATTRS_K8S_NAMESPACE_NAME] = env.NAMESPACE; |
{ | ||
"name": "@opentelemetry/resource-detector-gcp", | ||
"version": "0.29.11", | ||
"version": "0.29.12", | ||
"description": "OpenTelemetry SDK resource detector for GCP", | ||
@@ -44,3 +44,3 @@ "main": "build/src/index.js", | ||
"@types/mocha": "8.2.3", | ||
"@types/node": "18.6.5", | ||
"@types/node": "18.18.14", | ||
"@types/semver": "7.5.8", | ||
@@ -59,3 +59,3 @@ "mocha": "7.2.0", | ||
"@opentelemetry/core": "^1.0.0", | ||
"@opentelemetry/resources": "^1.0.0", | ||
"@opentelemetry/resources": "^1.10.0", | ||
"@opentelemetry/semantic-conventions": "^1.27.0", | ||
@@ -65,3 +65,3 @@ "gcp-metadata": "^6.0.0" | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/detectors/node/opentelemetry-resource-detector-gcp#readme", | ||
"gitHead": "9dc58afed8134f95908331bcff35c5d9ec46fe9a" | ||
"gitHead": "2512c78761ac985f189bf82c2608c4099affa660" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34700
215