@opentelemetry/resource-detector-azure 0.5.0 → 0.6.1

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.
@@ -0,0 +1,11 @@
1
+ import { DetectorSync, IResource } from '@opentelemetry/resources';
2
+ /**
3
+ * The AzureAppServiceDetector can be used to detect if a process is running in an Azure App Service
4
+ * @returns a {@link Resource} populated with data about the environment or an empty Resource if detection fails.
5
+ */
6
+ declare class AzureAppServiceDetector implements DetectorSync {
7
+ detect(): IResource;
8
+ }
9
+ export declare const azureAppServiceDetector: AzureAppServiceDetector;
10
+ export {};
11
+ //# sourceMappingURL=AzureAppServiceDetector.d.ts.map
@@ -0,0 +1,71 @@
1
+ /*
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.
15
+ */
16
+ var __assign = (this && this.__assign) || function () {
17
+ __assign = Object.assign || function(t) {
18
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
19
+ s = arguments[i];
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
+ t[p] = s[p];
22
+ }
23
+ return t;
24
+ };
25
+ return __assign.apply(this, arguments);
26
+ };
27
+ var _a;
28
+ import { Resource } from '@opentelemetry/resources';
29
+ import { AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE, REGION_NAME, WEBSITE_HOME_STAMPNAME, WEBSITE_HOSTNAME, WEBSITE_INSTANCE_ID, WEBSITE_SITE_NAME, WEBSITE_SLOT_NAME, CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE, } from '../types';
30
+ import { SEMRESATTRS_CLOUD_REGION, SEMRESATTRS_DEPLOYMENT_ENVIRONMENT, SEMRESATTRS_HOST_ID, SEMRESATTRS_SERVICE_INSTANCE_ID, SEMRESATTRS_SERVICE_NAME, SEMRESATTRS_CLOUD_PROVIDER, SEMRESATTRS_CLOUD_PLATFORM, CLOUDPROVIDERVALUES_AZURE, CLOUDPLATFORMVALUES_AZURE_APP_SERVICE, } from '@opentelemetry/semantic-conventions';
31
+ import { getAzureResourceUri, isAzureFunction } from '../utils';
32
+ var APP_SERVICE_ATTRIBUTE_ENV_VARS = (_a = {},
33
+ _a[SEMRESATTRS_CLOUD_REGION] = REGION_NAME,
34
+ _a[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT] = WEBSITE_SLOT_NAME,
35
+ _a[SEMRESATTRS_HOST_ID] = WEBSITE_HOSTNAME,
36
+ _a[SEMRESATTRS_SERVICE_INSTANCE_ID] = WEBSITE_INSTANCE_ID,
37
+ _a[AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE] = WEBSITE_HOME_STAMPNAME,
38
+ _a);
39
+ /**
40
+ * The AzureAppServiceDetector can be used to detect if a process is running in an Azure App Service
41
+ * @returns a {@link Resource} populated with data about the environment or an empty Resource if detection fails.
42
+ */
43
+ var AzureAppServiceDetector = /** @class */ (function () {
44
+ function AzureAppServiceDetector() {
45
+ }
46
+ AzureAppServiceDetector.prototype.detect = function () {
47
+ var _a, _b, _c, _d, _e;
48
+ var attributes = {};
49
+ var websiteSiteName = process.env[WEBSITE_SITE_NAME];
50
+ if (websiteSiteName && !isAzureFunction()) {
51
+ attributes = __assign(__assign({}, attributes), (_a = {}, _a[SEMRESATTRS_SERVICE_NAME] = websiteSiteName, _a));
52
+ attributes = __assign(__assign({}, attributes), (_b = {}, _b[SEMRESATTRS_CLOUD_PROVIDER] = CLOUDPROVIDERVALUES_AZURE, _b));
53
+ attributes = __assign(__assign({}, attributes), (_c = {}, _c[SEMRESATTRS_CLOUD_PLATFORM] = CLOUDPLATFORMVALUES_AZURE_APP_SERVICE, _c));
54
+ var azureResourceUri = getAzureResourceUri(websiteSiteName);
55
+ if (azureResourceUri) {
56
+ attributes = __assign(__assign({}, attributes), (_d = {}, _d[CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE] = azureResourceUri, _d));
57
+ }
58
+ for (var _i = 0, _f = Object.entries(APP_SERVICE_ATTRIBUTE_ENV_VARS); _i < _f.length; _i++) {
59
+ var _g = _f[_i], key = _g[0], value = _g[1];
60
+ var envVar = process.env[value];
61
+ if (envVar) {
62
+ attributes = __assign(__assign({}, attributes), (_e = {}, _e[key] = envVar, _e));
63
+ }
64
+ }
65
+ }
66
+ return new Resource(attributes);
67
+ };
68
+ return AzureAppServiceDetector;
69
+ }());
70
+ export var azureAppServiceDetector = new AzureAppServiceDetector();
71
+ //# sourceMappingURL=AzureAppServiceDetector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AzureAppServiceDetector.js","sourceRoot":"","sources":["../../../src/detectors/AzureAppServiceDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;AAEH,OAAO,EAA2B,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EACL,0CAA0C,EAC1C,WAAW,EACX,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,oCAAoC,GACrC,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,wBAAwB,EACxB,kCAAkC,EAClC,mBAAmB,EACnB,+BAA+B,EAC/B,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,qCAAqC,GACtC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhE,IAAM,8BAA8B;IAClC,GAAC,wBAAwB,IAAG,WAAW;IACvC,GAAC,kCAAkC,IAAG,iBAAiB;IACvD,GAAC,mBAAmB,IAAG,gBAAgB;IACvC,GAAC,+BAA+B,IAAG,mBAAmB;IACtD,GAAC,0CAA0C,IAAG,sBAAsB;OACrE,CAAC;AAEF;;;GAGG;AACH;IAAA;IAqCA,CAAC;IApCC,wCAAM,GAAN;;QACE,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,IAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACvD,IAAI,eAAe,IAAI,CAAC,eAAe,EAAE,EAAE;YACzC,UAAU,yBACL,UAAU,gBACZ,wBAAwB,IAAG,eAAe,MAC5C,CAAC;YACF,UAAU,yBACL,UAAU,gBACZ,0BAA0B,IAAG,yBAAyB,MACxD,CAAC;YACF,UAAU,yBACL,UAAU,gBACZ,0BAA0B,IAAG,qCAAqC,MACpE,CAAC;YAEF,IAAM,gBAAgB,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAC;YAC9D,IAAI,gBAAgB,EAAE;gBACpB,UAAU,yBACL,UAAU,aACR,GAAC,oCAAoC,IAAG,gBAAgB,MAC9D,CAAC;aACH;YAED,KAA2B,UAE1B,EAF0B,KAAA,MAAM,CAAC,OAAO,CACvC,8BAA8B,CAC/B,EAF0B,cAE1B,EAF0B,IAE1B,EAAE;gBAFQ,IAAA,WAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;gBAGpB,IAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAClC,IAAI,MAAM,EAAE;oBACV,UAAU,yBAAQ,UAAU,aAAO,GAAC,GAAG,IAAG,MAAM,MAAI,CAAC;iBACtD;aACF;SACF;QACD,OAAO,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IACH,8BAAC;AAAD,CAAC,AArCD,IAqCC;AAED,MAAM,CAAC,IAAM,uBAAuB,GAAG,IAAI,uBAAuB,EAAE,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\nimport { DetectorSync, IResource, Resource } from '@opentelemetry/resources';\nimport {\n AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE,\n REGION_NAME,\n WEBSITE_HOME_STAMPNAME,\n WEBSITE_HOSTNAME,\n WEBSITE_INSTANCE_ID,\n WEBSITE_SITE_NAME,\n WEBSITE_SLOT_NAME,\n CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE,\n} from '../types';\nimport {\n SEMRESATTRS_CLOUD_REGION,\n SEMRESATTRS_DEPLOYMENT_ENVIRONMENT,\n SEMRESATTRS_HOST_ID,\n SEMRESATTRS_SERVICE_INSTANCE_ID,\n SEMRESATTRS_SERVICE_NAME,\n SEMRESATTRS_CLOUD_PROVIDER,\n SEMRESATTRS_CLOUD_PLATFORM,\n CLOUDPROVIDERVALUES_AZURE,\n CLOUDPLATFORMVALUES_AZURE_APP_SERVICE,\n} from '@opentelemetry/semantic-conventions';\nimport { getAzureResourceUri, isAzureFunction } from '../utils';\n\nconst APP_SERVICE_ATTRIBUTE_ENV_VARS = {\n [SEMRESATTRS_CLOUD_REGION]: REGION_NAME,\n [SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: WEBSITE_SLOT_NAME,\n [SEMRESATTRS_HOST_ID]: WEBSITE_HOSTNAME,\n [SEMRESATTRS_SERVICE_INSTANCE_ID]: WEBSITE_INSTANCE_ID,\n [AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE]: WEBSITE_HOME_STAMPNAME,\n};\n\n/**\n * The AzureAppServiceDetector can be used to detect if a process is running in an Azure App Service\n * @returns a {@link Resource} populated with data about the environment or an empty Resource if detection fails.\n */\nclass AzureAppServiceDetector implements DetectorSync {\n detect(): IResource {\n let attributes = {};\n const websiteSiteName = process.env[WEBSITE_SITE_NAME];\n if (websiteSiteName && !isAzureFunction()) {\n attributes = {\n ...attributes,\n [SEMRESATTRS_SERVICE_NAME]: websiteSiteName,\n };\n attributes = {\n ...attributes,\n [SEMRESATTRS_CLOUD_PROVIDER]: CLOUDPROVIDERVALUES_AZURE,\n };\n attributes = {\n ...attributes,\n [SEMRESATTRS_CLOUD_PLATFORM]: CLOUDPLATFORMVALUES_AZURE_APP_SERVICE,\n };\n\n const azureResourceUri = getAzureResourceUri(websiteSiteName);\n if (azureResourceUri) {\n attributes = {\n ...attributes,\n ...{ [CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE]: azureResourceUri },\n };\n }\n\n for (const [key, value] of Object.entries(\n APP_SERVICE_ATTRIBUTE_ENV_VARS\n )) {\n const envVar = process.env[value];\n if (envVar) {\n attributes = { ...attributes, ...{ [key]: envVar } };\n }\n }\n }\n return new Resource(attributes);\n }\n}\n\nexport const azureAppServiceDetector = new AzureAppServiceDetector();\n"]}
@@ -0,0 +1,11 @@
1
+ import { DetectorSync, IResource } from '@opentelemetry/resources';
2
+ /**
3
+ * The AzureFunctionsDetector can be used to detect if a process is running in Azure Functions
4
+ * @returns a {@link Resource} populated with data about the environment or an empty Resource if detection fails.
5
+ */
6
+ declare class AzureFunctionsDetector implements DetectorSync {
7
+ detect(): IResource;
8
+ }
9
+ export declare const azureFunctionsDetector: AzureFunctionsDetector;
10
+ export {};
11
+ //# sourceMappingURL=AzureFunctionsDetector.d.ts.map
@@ -0,0 +1,88 @@
1
+ /*
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.
15
+ */
16
+ var __assign = (this && this.__assign) || function () {
17
+ __assign = Object.assign || function(t) {
18
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
19
+ s = arguments[i];
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
+ t[p] = s[p];
22
+ }
23
+ return t;
24
+ };
25
+ return __assign.apply(this, arguments);
26
+ };
27
+ var _a;
28
+ import { Resource } from '@opentelemetry/resources';
29
+ import { SEMRESATTRS_FAAS_MAX_MEMORY, SEMRESATTRS_FAAS_INSTANCE, SEMRESATTRS_CLOUD_PROVIDER, SEMRESATTRS_CLOUD_PLATFORM, SEMRESATTRS_CLOUD_REGION, CLOUDPROVIDERVALUES_AZURE, CLOUDPLATFORMVALUES_AZURE_FUNCTIONS, SEMRESATTRS_SERVICE_NAME, SEMRESATTRS_PROCESS_PID, } from '@opentelemetry/semantic-conventions';
30
+ import { WEBSITE_SITE_NAME, WEBSITE_INSTANCE_ID, FUNCTIONS_MEM_LIMIT, REGION_NAME, CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE, } from '../types';
31
+ import { getAzureResourceUri, isAzureFunction } from '../utils';
32
+ var AZURE_FUNCTIONS_ATTRIBUTE_ENV_VARS = (_a = {},
33
+ _a[SEMRESATTRS_SERVICE_NAME] = WEBSITE_SITE_NAME,
34
+ _a[SEMRESATTRS_FAAS_INSTANCE] = WEBSITE_INSTANCE_ID,
35
+ _a[SEMRESATTRS_FAAS_MAX_MEMORY] = FUNCTIONS_MEM_LIMIT,
36
+ _a);
37
+ /**
38
+ * The AzureFunctionsDetector can be used to detect if a process is running in Azure Functions
39
+ * @returns a {@link Resource} populated with data about the environment or an empty Resource if detection fails.
40
+ */
41
+ var AzureFunctionsDetector = /** @class */ (function () {
42
+ function AzureFunctionsDetector() {
43
+ }
44
+ AzureFunctionsDetector.prototype.detect = function () {
45
+ var _a, _b, _c, _d, _e, _f;
46
+ var attributes = {};
47
+ var serviceName = process.env[WEBSITE_SITE_NAME];
48
+ /**
49
+ * Checks that we are operating within an Azure Function using the function version since WEBSITE_SITE_NAME
50
+ * will exist in Azure App Service as well and detectors should be mutually exclusive.
51
+ * If the function version is not present, we check for the website sku to determine if it is a function.
52
+ */
53
+ if (serviceName && isAzureFunction()) {
54
+ var functionInstance = process.env[WEBSITE_INSTANCE_ID];
55
+ var functionMemLimit = process.env[FUNCTIONS_MEM_LIMIT];
56
+ attributes = (_a = {},
57
+ _a[SEMRESATTRS_CLOUD_PROVIDER] = CLOUDPROVIDERVALUES_AZURE,
58
+ _a[SEMRESATTRS_CLOUD_PLATFORM] = CLOUDPLATFORMVALUES_AZURE_FUNCTIONS,
59
+ _a[SEMRESATTRS_CLOUD_REGION] = process.env[REGION_NAME],
60
+ _a[SEMRESATTRS_PROCESS_PID] = process.pid,
61
+ _a);
62
+ if (serviceName) {
63
+ attributes = __assign(__assign({}, attributes), (_b = {}, _b[SEMRESATTRS_SERVICE_NAME] = serviceName, _b));
64
+ }
65
+ if (functionInstance) {
66
+ attributes = __assign(__assign({}, attributes), (_c = {}, _c[SEMRESATTRS_FAAS_INSTANCE] = functionInstance, _c));
67
+ }
68
+ if (functionMemLimit) {
69
+ attributes = __assign(__assign({}, attributes), (_d = {}, _d[SEMRESATTRS_FAAS_MAX_MEMORY] = functionMemLimit, _d));
70
+ }
71
+ var azureResourceUri = getAzureResourceUri(serviceName);
72
+ if (azureResourceUri) {
73
+ attributes = __assign(__assign({}, attributes), (_e = {}, _e[CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE] = azureResourceUri, _e));
74
+ }
75
+ for (var _i = 0, _g = Object.entries(AZURE_FUNCTIONS_ATTRIBUTE_ENV_VARS); _i < _g.length; _i++) {
76
+ var _h = _g[_i], key = _h[0], value = _h[1];
77
+ var envVar = process.env[value];
78
+ if (envVar) {
79
+ attributes = __assign(__assign({}, attributes), (_f = {}, _f[key] = envVar, _f));
80
+ }
81
+ }
82
+ }
83
+ return new Resource(attributes);
84
+ };
85
+ return AzureFunctionsDetector;
86
+ }());
87
+ export var azureFunctionsDetector = new AzureFunctionsDetector();
88
+ //# sourceMappingURL=AzureFunctionsDetector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AzureFunctionsDetector.js","sourceRoot":"","sources":["../../../src/detectors/AzureFunctionsDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;AAEH,OAAO,EAA2B,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,mCAAmC,EACnC,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,oCAAoC,GACrC,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhE,IAAM,kCAAkC;IACtC,GAAC,wBAAwB,IAAG,iBAAiB;IAC7C,GAAC,yBAAyB,IAAG,mBAAmB;IAChD,GAAC,2BAA2B,IAAG,mBAAmB;OACnD,CAAC;AAEF;;;GAGG;AACH;IAAA;IA0DA,CAAC;IAzDC,uCAAM,GAAN;;QACE,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,IAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAEnD;;;;WAIG;QACH,IAAI,WAAW,IAAI,eAAe,EAAE,EAAE;YACpC,IAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YAC1D,IAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YAE1D,UAAU;gBACR,GAAC,0BAA0B,IAAG,yBAAyB;gBACvD,GAAC,0BAA0B,IAAG,mCAAmC;gBACjE,GAAC,wBAAwB,IAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;gBACpD,GAAC,uBAAuB,IAAG,OAAO,CAAC,GAAG;mBACvC,CAAC;YAEF,IAAI,WAAW,EAAE;gBACf,UAAU,yBACL,UAAU,gBACZ,wBAAwB,IAAG,WAAW,MACxC,CAAC;aACH;YACD,IAAI,gBAAgB,EAAE;gBACpB,UAAU,yBACL,UAAU,gBACZ,yBAAyB,IAAG,gBAAgB,MAC9C,CAAC;aACH;YACD,IAAI,gBAAgB,EAAE;gBACpB,UAAU,yBACL,UAAU,gBACZ,2BAA2B,IAAG,gBAAgB,MAChD,CAAC;aACH;YACD,IAAM,gBAAgB,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;YAC1D,IAAI,gBAAgB,EAAE;gBACpB,UAAU,yBACL,UAAU,aACR,GAAC,oCAAoC,IAAG,gBAAgB,MAC9D,CAAC;aACH;YAED,KAA2B,UAE1B,EAF0B,KAAA,MAAM,CAAC,OAAO,CACvC,kCAAkC,CACnC,EAF0B,cAE1B,EAF0B,IAE1B,EAAE;gBAFQ,IAAA,WAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;gBAGpB,IAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAClC,IAAI,MAAM,EAAE;oBACV,UAAU,yBAAQ,UAAU,aAAO,GAAC,GAAG,IAAG,MAAM,MAAI,CAAC;iBACtD;aACF;SACF;QACD,OAAO,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IACH,6BAAC;AAAD,CAAC,AA1DD,IA0DC;AAED,MAAM,CAAC,IAAM,sBAAsB,GAAG,IAAI,sBAAsB,EAAE,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\nimport { DetectorSync, IResource, Resource } from '@opentelemetry/resources';\n\nimport {\n SEMRESATTRS_FAAS_MAX_MEMORY,\n SEMRESATTRS_FAAS_INSTANCE,\n SEMRESATTRS_CLOUD_PROVIDER,\n SEMRESATTRS_CLOUD_PLATFORM,\n SEMRESATTRS_CLOUD_REGION,\n CLOUDPROVIDERVALUES_AZURE,\n CLOUDPLATFORMVALUES_AZURE_FUNCTIONS,\n SEMRESATTRS_SERVICE_NAME,\n SEMRESATTRS_PROCESS_PID,\n} from '@opentelemetry/semantic-conventions';\nimport {\n WEBSITE_SITE_NAME,\n WEBSITE_INSTANCE_ID,\n FUNCTIONS_MEM_LIMIT,\n REGION_NAME,\n CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE,\n} from '../types';\nimport { getAzureResourceUri, isAzureFunction } from '../utils';\n\nconst AZURE_FUNCTIONS_ATTRIBUTE_ENV_VARS = {\n [SEMRESATTRS_SERVICE_NAME]: WEBSITE_SITE_NAME,\n [SEMRESATTRS_FAAS_INSTANCE]: WEBSITE_INSTANCE_ID,\n [SEMRESATTRS_FAAS_MAX_MEMORY]: FUNCTIONS_MEM_LIMIT,\n};\n\n/**\n * The AzureFunctionsDetector can be used to detect if a process is running in Azure Functions\n * @returns a {@link Resource} populated with data about the environment or an empty Resource if detection fails.\n */\nclass AzureFunctionsDetector implements DetectorSync {\n detect(): IResource {\n let attributes = {};\n const serviceName = process.env[WEBSITE_SITE_NAME];\n\n /**\n * Checks that we are operating within an Azure Function using the function version since WEBSITE_SITE_NAME\n * will exist in Azure App Service as well and detectors should be mutually exclusive.\n * If the function version is not present, we check for the website sku to determine if it is a function.\n */\n if (serviceName && isAzureFunction()) {\n const functionInstance = process.env[WEBSITE_INSTANCE_ID];\n const functionMemLimit = process.env[FUNCTIONS_MEM_LIMIT];\n\n attributes = {\n [SEMRESATTRS_CLOUD_PROVIDER]: CLOUDPROVIDERVALUES_AZURE,\n [SEMRESATTRS_CLOUD_PLATFORM]: CLOUDPLATFORMVALUES_AZURE_FUNCTIONS,\n [SEMRESATTRS_CLOUD_REGION]: process.env[REGION_NAME],\n [SEMRESATTRS_PROCESS_PID]: process.pid,\n };\n\n if (serviceName) {\n attributes = {\n ...attributes,\n [SEMRESATTRS_SERVICE_NAME]: serviceName,\n };\n }\n if (functionInstance) {\n attributes = {\n ...attributes,\n [SEMRESATTRS_FAAS_INSTANCE]: functionInstance,\n };\n }\n if (functionMemLimit) {\n attributes = {\n ...attributes,\n [SEMRESATTRS_FAAS_MAX_MEMORY]: functionMemLimit,\n };\n }\n const azureResourceUri = getAzureResourceUri(serviceName);\n if (azureResourceUri) {\n attributes = {\n ...attributes,\n ...{ [CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE]: azureResourceUri },\n };\n }\n\n for (const [key, value] of Object.entries(\n AZURE_FUNCTIONS_ATTRIBUTE_ENV_VARS\n )) {\n const envVar = process.env[value];\n if (envVar) {\n attributes = { ...attributes, ...{ [key]: envVar } };\n }\n }\n }\n return new Resource(attributes);\n }\n}\n\nexport const azureFunctionsDetector = new AzureFunctionsDetector();\n"]}
@@ -0,0 +1,12 @@
1
+ import { DetectorSync, IResource, ResourceAttributes } from '@opentelemetry/resources';
2
+ /**
3
+ * The AzureVmDetector can be used to detect if a process is running in an Azure VM.
4
+ * @returns a {@link Resource} populated with data about the environment or an empty Resource if detection fails.
5
+ */
6
+ declare class AzureVmResourceDetector implements DetectorSync {
7
+ detect(): IResource;
8
+ getAzureVmMetadata(): Promise<ResourceAttributes>;
9
+ }
10
+ export declare const azureVmDetector: AzureVmResourceDetector;
11
+ export {};
12
+ //# sourceMappingURL=AzureVmDetector.d.ts.map
@@ -0,0 +1,141 @@
1
+ /*
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.
15
+ */
16
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ var __generator = (this && this.__generator) || function (thisArg, body) {
26
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
27
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
+ function verb(n) { return function (v) { return step([n, v]); }; }
29
+ function step(op) {
30
+ if (f) throw new TypeError("Generator is already executing.");
31
+ while (_) try {
32
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
+ if (y = 0, t) op = [op[0] & 2, t.value];
34
+ switch (op[0]) {
35
+ case 0: case 1: t = op; break;
36
+ case 4: _.label++; return { value: op[1], done: false };
37
+ case 5: _.label++; y = op[1]; op = [0]; continue;
38
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
+ default:
40
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
+ if (t[2]) _.ops.pop();
45
+ _.trys.pop(); continue;
46
+ }
47
+ op = body.call(thisArg, _);
48
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
+ }
51
+ };
52
+ import * as http from 'http';
53
+ import { context } from '@opentelemetry/api';
54
+ import { suppressTracing } from '@opentelemetry/core';
55
+ import { Resource, } from '@opentelemetry/resources';
56
+ import { CLOUDPLATFORMVALUES_AZURE_VM, CLOUDPROVIDERVALUES_AZURE, SEMRESATTRS_CLOUD_PLATFORM, SEMRESATTRS_CLOUD_PROVIDER, SEMRESATTRS_CLOUD_REGION, SEMRESATTRS_HOST_ID, SEMRESATTRS_HOST_NAME, SEMRESATTRS_HOST_TYPE, SEMRESATTRS_OS_VERSION, } from '@opentelemetry/semantic-conventions';
57
+ import { CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE, AZURE_VM_METADATA_HOST, AZURE_VM_METADATA_PATH, AZURE_VM_SCALE_SET_NAME_ATTRIBUTE, AZURE_VM_SKU_ATTRIBUTE, } from '../types';
58
+ /**
59
+ * The AzureVmDetector can be used to detect if a process is running in an Azure VM.
60
+ * @returns a {@link Resource} populated with data about the environment or an empty Resource if detection fails.
61
+ */
62
+ var AzureVmResourceDetector = /** @class */ (function () {
63
+ function AzureVmResourceDetector() {
64
+ }
65
+ AzureVmResourceDetector.prototype.detect = function () {
66
+ var _this = this;
67
+ var attributes = context.with(suppressTracing(context.active()), function () {
68
+ return _this.getAzureVmMetadata();
69
+ });
70
+ return new Resource({}, attributes);
71
+ };
72
+ AzureVmResourceDetector.prototype.getAzureVmMetadata = function () {
73
+ return __awaiter(this, void 0, void 0, function () {
74
+ var options, metadata, attributes;
75
+ var _a;
76
+ return __generator(this, function (_b) {
77
+ switch (_b.label) {
78
+ case 0:
79
+ options = {
80
+ host: AZURE_VM_METADATA_HOST,
81
+ path: AZURE_VM_METADATA_PATH,
82
+ method: 'GET',
83
+ timeout: 5000,
84
+ headers: {
85
+ Metadata: 'True',
86
+ },
87
+ };
88
+ return [4 /*yield*/, new Promise(function (resolve, reject) {
89
+ var timeoutId = setTimeout(function () {
90
+ req.destroy();
91
+ reject(new Error('Azure metadata service request timed out.'));
92
+ }, 1000);
93
+ var req = http.request(options, function (res) {
94
+ clearTimeout(timeoutId);
95
+ var statusCode = res.statusCode;
96
+ res.setEncoding('utf8');
97
+ var rawData = '';
98
+ res.on('data', function (chunk) { return (rawData += chunk); });
99
+ res.on('end', function () {
100
+ if (statusCode && statusCode >= 200 && statusCode < 300) {
101
+ try {
102
+ resolve(JSON.parse(rawData));
103
+ }
104
+ catch (error) {
105
+ reject(error);
106
+ }
107
+ }
108
+ else {
109
+ reject(new Error('Failed to load page, status code: ' + statusCode));
110
+ }
111
+ });
112
+ });
113
+ req.on('error', function (err) {
114
+ clearTimeout(timeoutId);
115
+ reject(err);
116
+ });
117
+ req.end();
118
+ })];
119
+ case 1:
120
+ metadata = _b.sent();
121
+ attributes = (_a = {},
122
+ _a[AZURE_VM_SCALE_SET_NAME_ATTRIBUTE] = metadata['vmScaleSetName'],
123
+ _a[AZURE_VM_SKU_ATTRIBUTE] = metadata['sku'],
124
+ _a[SEMRESATTRS_CLOUD_PLATFORM] = CLOUDPLATFORMVALUES_AZURE_VM,
125
+ _a[SEMRESATTRS_CLOUD_PROVIDER] = CLOUDPROVIDERVALUES_AZURE,
126
+ _a[SEMRESATTRS_CLOUD_REGION] = metadata['location'],
127
+ _a[CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE] = metadata['resourceId'],
128
+ _a[SEMRESATTRS_HOST_ID] = metadata['vmId'],
129
+ _a[SEMRESATTRS_HOST_NAME] = metadata['name'],
130
+ _a[SEMRESATTRS_HOST_TYPE] = metadata['vmSize'],
131
+ _a[SEMRESATTRS_OS_VERSION] = metadata['version'],
132
+ _a);
133
+ return [2 /*return*/, attributes];
134
+ }
135
+ });
136
+ });
137
+ };
138
+ return AzureVmResourceDetector;
139
+ }());
140
+ export var azureVmDetector = new AzureVmResourceDetector();
141
+ //# sourceMappingURL=AzureVmDetector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AzureVmDetector.js","sourceRoot":"","sources":["../../../src/detectors/AzureVmDetector.ts"],"names":[],"mappings":"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","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\nimport * as http from 'http';\n\nimport { context } from '@opentelemetry/api';\nimport { suppressTracing } from '@opentelemetry/core';\nimport {\n DetectorSync,\n IResource,\n Resource,\n ResourceAttributes,\n} from '@opentelemetry/resources';\nimport {\n CLOUDPLATFORMVALUES_AZURE_VM,\n CLOUDPROVIDERVALUES_AZURE,\n SEMRESATTRS_CLOUD_PLATFORM,\n SEMRESATTRS_CLOUD_PROVIDER,\n SEMRESATTRS_CLOUD_REGION,\n SEMRESATTRS_HOST_ID,\n SEMRESATTRS_HOST_NAME,\n SEMRESATTRS_HOST_TYPE,\n SEMRESATTRS_OS_VERSION,\n} from '@opentelemetry/semantic-conventions';\nimport {\n CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE,\n AZURE_VM_METADATA_HOST,\n AZURE_VM_METADATA_PATH,\n AZURE_VM_SCALE_SET_NAME_ATTRIBUTE,\n AZURE_VM_SKU_ATTRIBUTE,\n AzureVmMetadata,\n} from '../types';\n\n/**\n * The AzureVmDetector can be used to detect if a process is running in an Azure VM.\n * @returns a {@link Resource} populated with data about the environment or an empty Resource if detection fails.\n */\nclass AzureVmResourceDetector implements DetectorSync {\n detect(): IResource {\n const attributes = context.with(suppressTracing(context.active()), () =>\n this.getAzureVmMetadata()\n );\n return new Resource({}, attributes);\n }\n\n async getAzureVmMetadata(): Promise<ResourceAttributes> {\n const options = {\n host: AZURE_VM_METADATA_HOST,\n path: AZURE_VM_METADATA_PATH,\n method: 'GET',\n timeout: 5000,\n headers: {\n Metadata: 'True',\n },\n };\n const metadata: AzureVmMetadata = await new Promise((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n req.destroy();\n reject(new Error('Azure metadata service request timed out.'));\n }, 1000);\n\n const req = http.request(options, res => {\n clearTimeout(timeoutId);\n const { statusCode } = res;\n res.setEncoding('utf8');\n let rawData = '';\n res.on('data', chunk => (rawData += chunk));\n res.on('end', () => {\n if (statusCode && statusCode >= 200 && statusCode < 300) {\n try {\n resolve(JSON.parse(rawData));\n } catch (error) {\n reject(error);\n }\n } else {\n reject(\n new Error('Failed to load page, status code: ' + statusCode)\n );\n }\n });\n });\n req.on('error', err => {\n clearTimeout(timeoutId);\n reject(err);\n });\n req.end();\n });\n\n const attributes = {\n [AZURE_VM_SCALE_SET_NAME_ATTRIBUTE]: metadata['vmScaleSetName'],\n [AZURE_VM_SKU_ATTRIBUTE]: metadata['sku'],\n [SEMRESATTRS_CLOUD_PLATFORM]: CLOUDPLATFORMVALUES_AZURE_VM,\n [SEMRESATTRS_CLOUD_PROVIDER]: CLOUDPROVIDERVALUES_AZURE,\n [SEMRESATTRS_CLOUD_REGION]: metadata['location'],\n [CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE]: metadata['resourceId'],\n [SEMRESATTRS_HOST_ID]: metadata['vmId'],\n [SEMRESATTRS_HOST_NAME]: metadata['name'],\n [SEMRESATTRS_HOST_TYPE]: metadata['vmSize'],\n [SEMRESATTRS_OS_VERSION]: metadata['version'],\n };\n return attributes;\n }\n}\n\nexport const azureVmDetector = new AzureVmResourceDetector();\n"]}
@@ -0,0 +1,4 @@
1
+ export { azureAppServiceDetector } from './AzureAppServiceDetector';
2
+ export { azureFunctionsDetector } from './AzureFunctionsDetector';
3
+ export { azureVmDetector } from './AzureVmDetector';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,19 @@
1
+ /*
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.
15
+ */
16
+ export { azureAppServiceDetector } from './AzureAppServiceDetector';
17
+ export { azureFunctionsDetector } from './AzureFunctionsDetector';
18
+ export { azureVmDetector } from './AzureVmDetector';
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/detectors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,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\nexport { azureAppServiceDetector } from './AzureAppServiceDetector';\nexport { azureFunctionsDetector } from './AzureFunctionsDetector';\nexport { azureVmDetector } from './AzureVmDetector';\n"]}
@@ -0,0 +1,2 @@
1
+ export { azureAppServiceDetector, azureFunctionsDetector, azureVmDetector, } from './detectors';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,17 @@
1
+ /*
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.
15
+ */
16
+ export { azureAppServiceDetector, azureFunctionsDetector, azureVmDetector, } from './detectors';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,eAAe,GAChB,MAAM,aAAa,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\nexport {\n azureAppServiceDetector,\n azureFunctionsDetector,\n azureVmDetector,\n} from './detectors';\n"]}
@@ -0,0 +1,163 @@
1
+ export declare const AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE = "azure.app.service.stamp";
2
+ export declare const CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE = "cloud.resource_id";
3
+ export declare const REGION_NAME = "REGION_NAME";
4
+ export declare const WEBSITE_HOME_STAMPNAME = "WEBSITE_HOME_STAMPNAME";
5
+ export declare const WEBSITE_HOSTNAME = "WEBSITE_HOSTNAME";
6
+ export declare const WEBSITE_INSTANCE_ID = "WEBSITE_INSTANCE_ID";
7
+ export declare const WEBSITE_OWNER_NAME = "WEBSITE_OWNER_NAME";
8
+ export declare const WEBSITE_RESOURCE_GROUP = "WEBSITE_RESOURCE_GROUP";
9
+ export declare const WEBSITE_SITE_NAME = "WEBSITE_SITE_NAME";
10
+ export declare const WEBSITE_SLOT_NAME = "WEBSITE_SLOT_NAME";
11
+ export declare const WEBSITE_SKU = "WEBSITE_SKU";
12
+ export declare const FUNCTIONS_VERSION = "FUNCTIONS_EXTENSION_VERSION";
13
+ export declare const FUNCTIONS_MEM_LIMIT = "WEBSITE_MEMORY_LIMIT_MB";
14
+ export declare const AZURE_VM_METADATA_HOST = "169.254.169.254";
15
+ export declare const AZURE_VM_METADATA_PATH = "/metadata/instance/compute?api-version=2021-12-13&format=json";
16
+ export declare const AZURE_VM_SCALE_SET_NAME_ATTRIBUTE = "azure.vm.scaleset.name";
17
+ export declare const AZURE_VM_SKU_ATTRIBUTE = "azure.vm.sku";
18
+ export interface AzureVmMetadata {
19
+ azEnvironment?: string;
20
+ additionalCapabilities?: {
21
+ hibernationEnabled?: string;
22
+ };
23
+ hostGroup?: {
24
+ id?: string;
25
+ };
26
+ host?: {
27
+ id?: string;
28
+ };
29
+ extendedLocation?: {
30
+ type?: string;
31
+ name?: string;
32
+ };
33
+ evictionPolicy?: string;
34
+ isHostCompatibilityLayerVm?: string;
35
+ licenseType?: string;
36
+ location: string;
37
+ name: string;
38
+ offer?: string;
39
+ osProfile?: {
40
+ adminUsername?: string;
41
+ computerName?: string;
42
+ disablePasswordAuthentication?: string;
43
+ };
44
+ osType?: string;
45
+ placementGroupId?: string;
46
+ plan?: {
47
+ name?: string;
48
+ product?: string;
49
+ publisher?: string;
50
+ };
51
+ platformFaultDomain?: string;
52
+ platformSubFaultDomain?: string;
53
+ platformUpdateDomain?: string;
54
+ priority?: string;
55
+ provider?: string;
56
+ publicKeys?: [
57
+ {
58
+ keyData?: string;
59
+ path?: string;
60
+ },
61
+ {
62
+ keyData?: string;
63
+ path?: string;
64
+ }
65
+ ];
66
+ publisher?: string;
67
+ resourceGroupName?: string;
68
+ resourceId: string;
69
+ securityProfile?: {
70
+ secureBootEnabled?: string;
71
+ virtualTpmEnabled?: string;
72
+ encryptionAtHost?: string;
73
+ securityType?: string;
74
+ };
75
+ sku: string;
76
+ storageProfile?: {
77
+ dataDisks?: [
78
+ {
79
+ bytesPerSecondThrottle?: string;
80
+ caching?: string;
81
+ createOption?: string;
82
+ diskCapacityBytes?: string;
83
+ diskSizeGB?: string;
84
+ image?: {
85
+ uri?: string;
86
+ };
87
+ isSharedDisk?: string;
88
+ isUltraDisk?: string;
89
+ lun?: string;
90
+ managedDisk?: {
91
+ id?: string;
92
+ storageAccountType?: string;
93
+ };
94
+ name: string;
95
+ opsPerSecondThrottle?: string;
96
+ vhd?: {
97
+ uri?: string;
98
+ };
99
+ writeAcceleratorEnabled?: string;
100
+ }
101
+ ];
102
+ imageReference?: {
103
+ id?: string;
104
+ offer?: string;
105
+ publisher?: string;
106
+ sku?: string;
107
+ version?: string;
108
+ };
109
+ osDisk?: {
110
+ caching?: string;
111
+ createOption?: string;
112
+ diskSizeGB?: string;
113
+ diffDiskSettings?: {
114
+ option?: string;
115
+ };
116
+ encryptionSettings?: {
117
+ enabled?: string;
118
+ diskEncryptionKey?: {
119
+ sourceVault?: {
120
+ id?: string;
121
+ };
122
+ secretUrl?: string;
123
+ };
124
+ keyEncryptionKey?: {
125
+ sourceVault?: {
126
+ id?: string;
127
+ };
128
+ keyUrl?: string;
129
+ };
130
+ };
131
+ image?: {
132
+ uri?: string;
133
+ };
134
+ managedDisk?: {
135
+ id?: string;
136
+ storageAccountType?: string;
137
+ };
138
+ name?: string;
139
+ osType?: string;
140
+ vhd?: {
141
+ uri?: string;
142
+ };
143
+ writeAcceleratorEnabled?: string;
144
+ };
145
+ resourceDisk?: {
146
+ size?: string;
147
+ };
148
+ };
149
+ subscriptionId?: string;
150
+ tags?: string;
151
+ tagsList?: object[];
152
+ customData?: string;
153
+ userData?: string;
154
+ version: string;
155
+ virtualMachineScaleSet?: {
156
+ id?: string;
157
+ };
158
+ vmId: string;
159
+ vmScaleSetName: string;
160
+ vmSize: string;
161
+ zone?: string;
162
+ }
163
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,33 @@
1
+ /*
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.
15
+ */
16
+ export var AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE = 'azure.app.service.stamp';
17
+ export var CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE = 'cloud.resource_id';
18
+ export var REGION_NAME = 'REGION_NAME';
19
+ export var WEBSITE_HOME_STAMPNAME = 'WEBSITE_HOME_STAMPNAME';
20
+ export var WEBSITE_HOSTNAME = 'WEBSITE_HOSTNAME';
21
+ export var WEBSITE_INSTANCE_ID = 'WEBSITE_INSTANCE_ID';
22
+ export var WEBSITE_OWNER_NAME = 'WEBSITE_OWNER_NAME';
23
+ export var WEBSITE_RESOURCE_GROUP = 'WEBSITE_RESOURCE_GROUP';
24
+ export var WEBSITE_SITE_NAME = 'WEBSITE_SITE_NAME';
25
+ export var WEBSITE_SLOT_NAME = 'WEBSITE_SLOT_NAME';
26
+ export var WEBSITE_SKU = 'WEBSITE_SKU';
27
+ export var FUNCTIONS_VERSION = 'FUNCTIONS_EXTENSION_VERSION';
28
+ export var FUNCTIONS_MEM_LIMIT = 'WEBSITE_MEMORY_LIMIT_MB';
29
+ export var AZURE_VM_METADATA_HOST = '169.254.169.254';
30
+ export var AZURE_VM_METADATA_PATH = '/metadata/instance/compute?api-version=2021-12-13&format=json';
31
+ export var AZURE_VM_SCALE_SET_NAME_ATTRIBUTE = 'azure.vm.scaleset.name';
32
+ export var AZURE_VM_SKU_ATTRIBUTE = 'azure.vm.sku';
33
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAC,IAAM,0CAA0C,GACrD,yBAAyB,CAAC;AAC5B,MAAM,CAAC,IAAM,oCAAoC,GAAG,mBAAmB,CAAC;AACxE,MAAM,CAAC,IAAM,WAAW,GAAG,aAAa,CAAC;AACzC,MAAM,CAAC,IAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAC/D,MAAM,CAAC,IAAM,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,MAAM,CAAC,IAAM,mBAAmB,GAAG,qBAAqB,CAAC;AACzD,MAAM,CAAC,IAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,IAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAC/D,MAAM,CAAC,IAAM,iBAAiB,GAAG,mBAAmB,CAAC;AACrD,MAAM,CAAC,IAAM,iBAAiB,GAAG,mBAAmB,CAAC;AACrD,MAAM,CAAC,IAAM,WAAW,GAAG,aAAa,CAAC;AAEzC,MAAM,CAAC,IAAM,iBAAiB,GAAG,6BAA6B,CAAC;AAC/D,MAAM,CAAC,IAAM,mBAAmB,GAAG,yBAAyB,CAAC;AAE7D,MAAM,CAAC,IAAM,sBAAsB,GAAG,iBAAiB,CAAC;AACxD,MAAM,CAAC,IAAM,sBAAsB,GACjC,+DAA+D,CAAC;AAClE,MAAM,CAAC,IAAM,iCAAiC,GAAG,wBAAwB,CAAC;AAC1E,MAAM,CAAC,IAAM,sBAAsB,GAAG,cAAc,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\nexport const AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE =\n 'azure.app.service.stamp';\nexport const CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE = 'cloud.resource_id';\nexport const REGION_NAME = 'REGION_NAME';\nexport const WEBSITE_HOME_STAMPNAME = 'WEBSITE_HOME_STAMPNAME';\nexport const WEBSITE_HOSTNAME = 'WEBSITE_HOSTNAME';\nexport const WEBSITE_INSTANCE_ID = 'WEBSITE_INSTANCE_ID';\nexport const WEBSITE_OWNER_NAME = 'WEBSITE_OWNER_NAME';\nexport const WEBSITE_RESOURCE_GROUP = 'WEBSITE_RESOURCE_GROUP';\nexport const WEBSITE_SITE_NAME = 'WEBSITE_SITE_NAME';\nexport const WEBSITE_SLOT_NAME = 'WEBSITE_SLOT_NAME';\nexport const WEBSITE_SKU = 'WEBSITE_SKU';\n\nexport const FUNCTIONS_VERSION = 'FUNCTIONS_EXTENSION_VERSION';\nexport const FUNCTIONS_MEM_LIMIT = 'WEBSITE_MEMORY_LIMIT_MB';\n\nexport const AZURE_VM_METADATA_HOST = '169.254.169.254';\nexport const AZURE_VM_METADATA_PATH =\n '/metadata/instance/compute?api-version=2021-12-13&format=json';\nexport const AZURE_VM_SCALE_SET_NAME_ATTRIBUTE = 'azure.vm.scaleset.name';\nexport const AZURE_VM_SKU_ATTRIBUTE = 'azure.vm.sku';\n\nexport interface AzureVmMetadata {\n azEnvironment?: string;\n additionalCapabilities?: {\n hibernationEnabled?: string;\n };\n hostGroup?: {\n id?: string;\n };\n host?: {\n id?: string;\n };\n extendedLocation?: {\n type?: string;\n name?: string;\n };\n evictionPolicy?: string;\n isHostCompatibilityLayerVm?: string;\n licenseType?: string;\n location: string;\n name: string;\n offer?: string;\n osProfile?: {\n adminUsername?: string;\n computerName?: string;\n disablePasswordAuthentication?: string;\n };\n osType?: string;\n placementGroupId?: string;\n plan?: {\n name?: string;\n product?: string;\n publisher?: string;\n };\n platformFaultDomain?: string;\n platformSubFaultDomain?: string;\n platformUpdateDomain?: string;\n priority?: string;\n provider?: string;\n publicKeys?: [\n {\n keyData?: string;\n path?: string;\n },\n {\n keyData?: string;\n path?: string;\n }\n ];\n publisher?: string;\n resourceGroupName?: string;\n resourceId: string;\n securityProfile?: {\n secureBootEnabled?: string;\n virtualTpmEnabled?: string;\n encryptionAtHost?: string;\n securityType?: string;\n };\n sku: string;\n storageProfile?: {\n dataDisks?: [\n {\n bytesPerSecondThrottle?: string;\n caching?: string;\n createOption?: string;\n diskCapacityBytes?: string;\n diskSizeGB?: string;\n image?: {\n uri?: string;\n };\n isSharedDisk?: string;\n isUltraDisk?: string;\n lun?: string;\n managedDisk?: {\n id?: string;\n storageAccountType?: string;\n };\n name: string;\n opsPerSecondThrottle?: string;\n vhd?: {\n uri?: string;\n };\n writeAcceleratorEnabled?: string;\n }\n ];\n imageReference?: {\n id?: string;\n offer?: string;\n publisher?: string;\n sku?: string;\n version?: string;\n };\n osDisk?: {\n caching?: string;\n createOption?: string;\n diskSizeGB?: string;\n diffDiskSettings?: {\n option?: string;\n };\n encryptionSettings?: {\n enabled?: string;\n diskEncryptionKey?: {\n sourceVault?: {\n id?: string;\n };\n secretUrl?: string;\n };\n keyEncryptionKey?: {\n sourceVault?: {\n id?: string;\n };\n keyUrl?: string;\n };\n };\n image?: {\n uri?: string;\n };\n managedDisk?: {\n id?: string;\n storageAccountType?: string;\n };\n name?: string;\n osType?: string;\n vhd?: {\n uri?: string;\n };\n writeAcceleratorEnabled?: string;\n };\n resourceDisk?: {\n size?: string;\n };\n };\n subscriptionId?: string;\n tags?: string;\n tagsList?: object[];\n customData?: string;\n userData?: string;\n version: string;\n virtualMachineScaleSet?: {\n id?: string;\n };\n vmId: string;\n vmScaleSetName: string;\n vmSize: string;\n zone?: string;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare function getAzureResourceUri(websiteSiteName: string): string | undefined;
2
+ export declare function isAzureFunction(): boolean;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,33 @@
1
+ /*
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.
15
+ */
16
+ import { FUNCTIONS_VERSION, WEBSITE_OWNER_NAME, WEBSITE_RESOURCE_GROUP, WEBSITE_SKU, } from './types';
17
+ export function getAzureResourceUri(websiteSiteName) {
18
+ var websiteResourceGroup = process.env[WEBSITE_RESOURCE_GROUP];
19
+ var websiteOwnerName = process.env[WEBSITE_OWNER_NAME];
20
+ var subscriptionId = websiteOwnerName;
21
+ if (websiteOwnerName && websiteOwnerName.indexOf('+') !== -1) {
22
+ subscriptionId = websiteOwnerName.split('+')[0];
23
+ }
24
+ if (!subscriptionId && !websiteOwnerName) {
25
+ return undefined;
26
+ }
27
+ return "/subscriptions/" + subscriptionId + "/resourceGroups/" + websiteResourceGroup + "/providers/Microsoft.Web/sites/" + websiteSiteName;
28
+ }
29
+ export function isAzureFunction() {
30
+ return !!(process.env[FUNCTIONS_VERSION] ||
31
+ process.env[WEBSITE_SKU] === 'FlexConsumption');
32
+ }
33
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,GACZ,MAAM,SAAS,CAAC;AAEjB,MAAM,UAAU,mBAAmB,CACjC,eAAuB;IAEvB,IAAM,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACjE,IAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAEzD,IAAI,cAAc,GAAG,gBAAgB,CAAC;IACtC,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;QAC5D,cAAc,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KACjD;IAED,IAAI,CAAC,cAAc,IAAI,CAAC,gBAAgB,EAAE;QACxC,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,oBAAkB,cAAc,wBAAmB,oBAAoB,uCAAkC,eAAiB,CAAC;AACpI,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,CAAC,CACP,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,iBAAiB,CAC/C,CAAC;AACJ,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\nimport {\n FUNCTIONS_VERSION,\n WEBSITE_OWNER_NAME,\n WEBSITE_RESOURCE_GROUP,\n WEBSITE_SKU,\n} from './types';\n\nexport function getAzureResourceUri(\n websiteSiteName: string\n): string | undefined {\n const websiteResourceGroup = process.env[WEBSITE_RESOURCE_GROUP];\n const websiteOwnerName = process.env[WEBSITE_OWNER_NAME];\n\n let subscriptionId = websiteOwnerName;\n if (websiteOwnerName && websiteOwnerName.indexOf('+') !== -1) {\n subscriptionId = websiteOwnerName.split('+')[0];\n }\n\n if (!subscriptionId && !websiteOwnerName) {\n return undefined;\n }\n\n return `/subscriptions/${subscriptionId}/resourceGroups/${websiteResourceGroup}/providers/Microsoft.Web/sites/${websiteSiteName}`;\n}\n\nexport function isAzureFunction(): boolean {\n return !!(\n process.env[FUNCTIONS_VERSION] ||\n process.env[WEBSITE_SKU] === 'FlexConsumption'\n );\n}\n"]}
package/package.json CHANGED
@@ -1,20 +1,21 @@
1
1
  {
2
2
  "name": "@opentelemetry/resource-detector-azure",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "OpenTelemetry SDK resource detector for Azure",
5
5
  "main": "build/src/index.js",
6
+ "module": "build/esm/index.js",
6
7
  "types": "build/src/index.d.ts",
7
8
  "repository": "open-telemetry/opentelemetry-js-contrib",
8
9
  "scripts": {
9
- "clean": "rimraf build/*",
10
- "compile": "tsc -p .",
10
+ "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json",
11
+ "compile": "tsc --build tsconfig.json tsconfig.esm.json",
11
12
  "lint": "eslint . --ext .ts",
12
13
  "lint:fix": "eslint . --ext .ts --fix",
13
14
  "prewatch": "npm run precompile",
14
15
  "prepublishOnly": "npm run compile",
15
16
  "test": "nyc mocha 'test/**/*.test.ts'",
16
17
  "tdd": "npm run test -- --watch-extensions ts --watch",
17
- "watch": "tsc -w"
18
+ "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json"
18
19
  },
19
20
  "author": "OpenTelemetry Authors",
20
21
  "license": "Apache-2.0",
@@ -24,15 +25,18 @@
24
25
  "files": [
25
26
  "build/src/**/*.js",
26
27
  "build/src/**/*.js.map",
27
- "build/src/**/*.d.ts"
28
+ "build/src/**/*.d.ts",
29
+ "build/esm/**/*.js",
30
+ "build/esm/**/*.js.map",
31
+ "build/esm/**/*.d.ts"
28
32
  ],
29
33
  "publishConfig": {
30
34
  "access": "public"
31
35
  },
32
36
  "devDependencies": {
33
37
  "@opentelemetry/api": "^1.0.0",
34
- "@opentelemetry/contrib-test-utils": "^0.45.0",
35
- "@opentelemetry/instrumentation-http": "^0.57.0",
38
+ "@opentelemetry/contrib-test-utils": "^0.45.1",
39
+ "@opentelemetry/instrumentation-http": "^0.57.1",
36
40
  "@types/mocha": "8.2.3",
37
41
  "@types/node": "18.18.14",
38
42
  "@types/sinon": "10.0.20",
@@ -50,5 +54,6 @@
50
54
  "@opentelemetry/semantic-conventions": "^1.27.0"
51
55
  },
52
56
  "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/detectors/node/opentelemetry-resource-detector-azure#readme",
53
- "gitHead": "3ef5205e5353010184c69ff7b9f0f4830f0932de"
57
+ "sideEffects": false,
58
+ "gitHead": "1eb77007669bae87fe5664d68ba6533b95275d52"
54
59
  }