@opentelemetry/resource-detector-gcp
Advanced tools
Comparing version 0.27.5 to 0.28.0
@@ -27,2 +27,4 @@ import { Detector, ResourceDetectionConfig, Resource } from '@opentelemetry/resources'; | ||
private _getClusterName; | ||
/** Gets hostname from GCP instance metadata. */ | ||
private _getHostname; | ||
} | ||
@@ -29,0 +31,0 @@ export declare const gcpDetector: GcpDetector; |
@@ -45,3 +45,3 @@ "use strict"; | ||
} | ||
const [projectId, instanceId, zoneId, clusterName] = await Promise.all([ | ||
const [projectId, instanceId, zoneId, clusterName, hostname] = await Promise.all([ | ||
this._getProjectId(), | ||
@@ -51,2 +51,3 @@ this._getInstanceId(), | ||
this._getClusterName(), | ||
this._getHostname(), | ||
]); | ||
@@ -56,2 +57,3 @@ const attributes = {}; | ||
attributes[semantic_conventions_1.SemanticResourceAttributes.HOST_ID] = instanceId; | ||
attributes[semantic_conventions_1.SemanticResourceAttributes.HOST_NAME] = hostname; | ||
attributes[semantic_conventions_1.SemanticResourceAttributes.CLOUD_AVAILABILITY_ZONE] = zoneId; | ||
@@ -113,4 +115,13 @@ attributes[semantic_conventions_1.SemanticResourceAttributes.CLOUD_PROVIDER] = | ||
} | ||
/** Gets hostname from GCP instance metadata. */ | ||
async _getHostname() { | ||
try { | ||
return await gcpMetadata.instance('hostname'); | ||
} | ||
catch (_a) { | ||
return ''; | ||
} | ||
} | ||
} | ||
exports.gcpDetector = new GcpDetector(); | ||
//# sourceMappingURL=GcpDetector.js.map |
{ | ||
"name": "@opentelemetry/resource-detector-gcp", | ||
"version": "0.27.5", | ||
"version": "0.28.0", | ||
"description": "OpenTelemetry SDK resource detector for GCP", | ||
@@ -68,3 +68,3 @@ "main": "build/src/index.js", | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/detectors/node/opentelemetry-resource-detector-gcp#readme", | ||
"gitHead": "63e0fc9b6b862f74304abf0343c506a5bd415191" | ||
"gitHead": "e3dfedccec7f249dcc637bf76db16e8d412538aa" | ||
} |
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
27242
216