@opentelemetry/resource-detector-azure
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -38,4 +38,3 @@ "use strict"; | ||
const websiteSiteName = process.env[types_1.WEBSITE_SITE_NAME]; | ||
const isAzureFunction = !!process.env[types_1.FUNCTIONS_VERSION]; | ||
if (websiteSiteName && !isAzureFunction) { | ||
if (websiteSiteName && !(0, utils_1.isAzureFunction)()) { | ||
attributes = Object.assign(Object.assign({}, attributes), { [semantic_conventions_1.SEMRESATTRS_SERVICE_NAME]: websiteSiteName }); | ||
@@ -42,0 +41,0 @@ attributes = Object.assign(Object.assign({}, attributes), { [semantic_conventions_1.SEMRESATTRS_CLOUD_PROVIDER]: semantic_conventions_1.CLOUDPROVIDERVALUES_AZURE }); |
@@ -36,8 +36,8 @@ "use strict"; | ||
const serviceName = process.env[types_1.WEBSITE_SITE_NAME]; | ||
const functionVersion = process.env[types_1.FUNCTIONS_VERSION]; | ||
/** | ||
* Checks that we are operating within an Azure Function using the function version since WEBSITE_SITE_NAME | ||
* will exist in Azure App Service as well and detectors should be mutually exclusive. | ||
* If the function version is not present, we check for the website sku to determine if it is a function. | ||
*/ | ||
if (serviceName && functionVersion) { | ||
if (serviceName && (0, utils_1.isAzureFunction)()) { | ||
const functionInstance = process.env[types_1.WEBSITE_INSTANCE_ID]; | ||
@@ -44,0 +44,0 @@ const functionMemLimit = process.env[types_1.FUNCTIONS_MEM_LIMIT]; |
@@ -11,2 +11,3 @@ export declare const AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE = "azure.app.service.stamp"; | ||
export declare const WEBSITE_SLOT_NAME = "WEBSITE_SLOT_NAME"; | ||
export declare const WEBSITE_SKU = "WEBSITE_SKU"; | ||
export declare const FUNCTIONS_VERSION = "FUNCTIONS_EXTENSION_VERSION"; | ||
@@ -13,0 +14,0 @@ export declare const FUNCTIONS_MEM_LIMIT = "WEBSITE_MEMORY_LIMIT_MB"; |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AZURE_VM_SKU_ATTRIBUTE = exports.AZURE_VM_SCALE_SET_NAME_ATTRIBUTE = exports.AZURE_VM_METADATA_PATH = exports.AZURE_VM_METADATA_HOST = exports.FUNCTIONS_MEM_LIMIT = exports.FUNCTIONS_VERSION = exports.WEBSITE_SLOT_NAME = exports.WEBSITE_SITE_NAME = exports.WEBSITE_RESOURCE_GROUP = exports.WEBSITE_OWNER_NAME = exports.WEBSITE_INSTANCE_ID = exports.WEBSITE_HOSTNAME = exports.WEBSITE_HOME_STAMPNAME = exports.REGION_NAME = exports.CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE = exports.AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE = void 0; | ||
exports.AZURE_VM_SKU_ATTRIBUTE = exports.AZURE_VM_SCALE_SET_NAME_ATTRIBUTE = exports.AZURE_VM_METADATA_PATH = exports.AZURE_VM_METADATA_HOST = exports.FUNCTIONS_MEM_LIMIT = exports.FUNCTIONS_VERSION = exports.WEBSITE_SKU = exports.WEBSITE_SLOT_NAME = exports.WEBSITE_SITE_NAME = exports.WEBSITE_RESOURCE_GROUP = exports.WEBSITE_OWNER_NAME = exports.WEBSITE_INSTANCE_ID = exports.WEBSITE_HOSTNAME = exports.WEBSITE_HOME_STAMPNAME = exports.REGION_NAME = exports.CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE = exports.AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE = void 0; | ||
exports.AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE = 'azure.app.service.stamp'; | ||
@@ -30,2 +30,3 @@ exports.CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE = 'cloud.resource_id'; | ||
exports.WEBSITE_SLOT_NAME = 'WEBSITE_SLOT_NAME'; | ||
exports.WEBSITE_SKU = 'WEBSITE_SKU'; | ||
exports.FUNCTIONS_VERSION = 'FUNCTIONS_EXTENSION_VERSION'; | ||
@@ -32,0 +33,0 @@ exports.FUNCTIONS_MEM_LIMIT = 'WEBSITE_MEMORY_LIMIT_MB'; |
export declare function getAzureResourceUri(websiteSiteName: string): string | undefined; | ||
export declare function isAzureFunction(): boolean; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getAzureResourceUri = void 0; | ||
exports.isAzureFunction = exports.getAzureResourceUri = void 0; | ||
const types_1 = require("./types"); | ||
@@ -34,2 +34,7 @@ function getAzureResourceUri(websiteSiteName) { | ||
exports.getAzureResourceUri = getAzureResourceUri; | ||
function isAzureFunction() { | ||
return !!(process.env[types_1.FUNCTIONS_VERSION] || | ||
process.env[types_1.WEBSITE_SKU] === 'FlexConsumption'); | ||
} | ||
exports.isAzureFunction = isAzureFunction; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@opentelemetry/resource-detector-azure", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"description": "OpenTelemetry SDK resource detector for Azure", | ||
@@ -54,3 +54,3 @@ "main": "build/src/index.js", | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/detectors/node/opentelemetry-resource-detector-azure#readme", | ||
"gitHead": "0af1b70f7c3c9763c85ac51fa5e334c1e1512020" | ||
"gitHead": "93e7aab9a38e22c9ef6c0a9053f817e7e52a687c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
71845
547