@opentelemetry/resource-detector-azure 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [2020] OpenTelemetry Authors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # OpenTelemetry Resource Detector for Azure
2
+
3
+ [![NPM Published Version][npm-img]][npm-url]
4
+ [![Apache License][license-image]][license-image]
5
+
6
+ [component owners](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/.github/component_owners.yml): @JacksonWeber
7
+
8
+ Resource detector for Azure.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install --save @opentelemetry/resource-detector-azure
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```typescript
19
+ import { detectResources } from '@opentelemetry/resources';
20
+ import { azureAppServiceDetector } from '@opentelemetry/resource-detector-azure';
21
+ const resource = detectResourcesSync({
22
+ detectors: [azureAppServiceDetector],
23
+ });
24
+
25
+ const tracerProvider = new NodeTracerProvider({ resource });
26
+ ```
27
+
28
+ ## Available Detectors
29
+
30
+ ### App Service Resource Detector
31
+
32
+ | Attribute | Description |
33
+ |-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
34
+ | azure.app.service.stamp | The specific "stamp" cluster within Azure where the App Service is running, e.g., "waws-prod-sn1-001". |
35
+ | cloud.platform | The cloud platform. Here, it's always "azure_app_service". |
36
+ | cloud.provider | The cloud service provider. In this context, it's always "azure". |
37
+ | cloud.resource_id | The Azure Resource Manager URI uniquely identifying the Azure App Service. Typically in the format "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Web/sites/{siteName}". |
38
+ | cloud.region | The Azure region where the App Service is hosted, e.g., "East US", "West Europe", etc. |
39
+ | deployment.environment | The deployment slot where the Azure App Service is running, such as "staging", "production", etc. |
40
+ | host.id | The primary hostname for the app, excluding any custom hostnames. |
41
+ | service.instance.id | The specific instance of the Azure App Service, useful in a scaled-out configuration. |
42
+ | service.name | The name of the Azure App Service. |
43
+
44
+ ### VM Resource Detector
45
+
46
+ | Attribute | Description |
47
+ |--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
48
+ | azure.vm.scaleset.name | The name of the Virtual Machine Scale Set if the VM is part of one. |
49
+ | azure.vm.sku | The SKU of the Azure Virtual Machine's operating system. For instance, for a VM running Windows Server 2019 Datacenter edition, this value would be "2019-Datacenter". |
50
+ | cloud.platform | The cloud platform, which is always set to "azure_vm" in this context. |
51
+ | cloud.provider | The cloud service provider, which is always set to "azure" in this context. |
52
+ | cloud.region | The Azure region where the Virtual Machine is hosted, such as "East US", "West Europe", etc. |
53
+ | cloud.resource_id | The Azure Resource Manager URI uniquely identifying the Azure Virtual Machine. It typically follows this format: "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/virtualMachines/{vmName}". |
54
+ | host.id | A unique identifier for the VM host, for instance, "02aab8a4-74ef-476e-8182-f6d2ba4166a6". |
55
+ | host.name | The name of the host machine. |
56
+ | host.type | The size of the VM instance, for example, "Standard_D2s_v3". |
57
+ | os.type | The type of operating system running on the VM, such as "Linux" or "Windows". |
58
+ | os.version | The version of the operating system running on the VM. |
59
+ | service.instance.id | An identifier for a specific instance of the service running on the Azure VM, for example, "02aab8a4-74ef-476e-8182-f6d2ba4166a6". |
60
+
61
+ ### Azure Functions Resource Detector
62
+
63
+ | Attribute | Description |
64
+ |-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
65
+ | cloud.platform | The cloud platform. Here, it's always "azure_functions". |
66
+ | cloud.provider | The cloud service provider. In this context, it's always "azure". |
67
+ | cloud.region | The Azure region where the Azure Function is hosted, e.g., "East US", "West Europe", etc. |
68
+ | faas.instance | The specific instance of the Azure App Service, useful in a scaled-out configuration. |
69
+ | faas.name | The name of the Azure App Service. |
70
+ | faas.version | The version of the Azure Function being executed, e.g., "~4". |
71
+ | faas.max_memory | The amount of memory available to the Azure Function expressed in MiB. |
72
+
73
+ ## Useful links
74
+
75
+ - For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
76
+ - For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
77
+ - For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
@@ -0,0 +1,12 @@
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
+ private getAzureResourceUri;
9
+ }
10
+ export declare const azureAppServiceDetector: AzureAppServiceDetector;
11
+ export {};
12
+ //# sourceMappingURL=AzureAppServiceDetector.d.ts.map
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.azureAppServiceDetector = void 0;
19
+ const resources_1 = require("@opentelemetry/resources");
20
+ const types_1 = require("../types");
21
+ const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
22
+ const APP_SERVICE_ATTRIBUTE_ENV_VARS = {
23
+ [semantic_conventions_1.SemanticResourceAttributes.CLOUD_REGION]: types_1.REGION_NAME,
24
+ [semantic_conventions_1.SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: types_1.WEBSITE_SLOT_NAME,
25
+ [semantic_conventions_1.SemanticResourceAttributes.HOST_ID]: types_1.WEBSITE_HOSTNAME,
26
+ [semantic_conventions_1.SemanticResourceAttributes.SERVICE_INSTANCE_ID]: types_1.WEBSITE_INSTANCE_ID,
27
+ [types_1.AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE]: types_1.WEBSITE_HOME_STAMPNAME,
28
+ };
29
+ /**
30
+ * The AzureAppServiceDetector can be used to detect if a process is running in an Azure App Service
31
+ * @returns a {@link Resource} populated with data about the environment or an empty Resource if detection fails.
32
+ */
33
+ class AzureAppServiceDetector {
34
+ detect() {
35
+ let attributes = {};
36
+ const websiteSiteName = process.env[types_1.WEBSITE_SITE_NAME];
37
+ if (websiteSiteName) {
38
+ attributes = Object.assign(Object.assign({}, attributes), { [semantic_conventions_1.SemanticResourceAttributes.SERVICE_NAME]: websiteSiteName });
39
+ attributes = Object.assign(Object.assign({}, attributes), { [semantic_conventions_1.SemanticResourceAttributes.CLOUD_PROVIDER]: semantic_conventions_1.CloudProviderValues.AZURE });
40
+ attributes = Object.assign(Object.assign({}, attributes), { [semantic_conventions_1.SemanticResourceAttributes.CLOUD_PLATFORM]: semantic_conventions_1.CloudPlatformValues.AZURE_APP_SERVICE });
41
+ const azureResourceUri = this.getAzureResourceUri(websiteSiteName);
42
+ if (azureResourceUri) {
43
+ attributes = Object.assign(Object.assign({}, attributes), { [types_1.CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE]: azureResourceUri });
44
+ }
45
+ for (const [key, value] of Object.entries(APP_SERVICE_ATTRIBUTE_ENV_VARS)) {
46
+ const envVar = process.env[value];
47
+ if (envVar) {
48
+ attributes = Object.assign(Object.assign({}, attributes), { [key]: envVar });
49
+ }
50
+ }
51
+ }
52
+ return new resources_1.Resource(attributes);
53
+ }
54
+ getAzureResourceUri(websiteSiteName) {
55
+ const websiteResourceGroup = process.env[types_1.WEBSITE_RESOURCE_GROUP];
56
+ const websiteOwnerName = process.env[types_1.WEBSITE_OWNER_NAME];
57
+ let subscriptionId = websiteOwnerName;
58
+ if (websiteOwnerName && websiteOwnerName.indexOf('+') !== -1) {
59
+ subscriptionId = websiteOwnerName.split('+')[0];
60
+ }
61
+ if (!subscriptionId && !websiteOwnerName) {
62
+ return undefined;
63
+ }
64
+ return `/subscriptions/${subscriptionId}/resourceGroups/${websiteResourceGroup}/providers/Microsoft.Web/sites/${websiteSiteName}`;
65
+ }
66
+ }
67
+ exports.azureAppServiceDetector = new AzureAppServiceDetector();
68
+ //# sourceMappingURL=AzureAppServiceDetector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AzureAppServiceDetector.js","sourceRoot":"","sources":["../../../src/detectors/AzureAppServiceDetector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,wDAA6E;AAC7E,oCAWkB;AAClB,8EAI6C;AAE7C,MAAM,8BAA8B,GAAG;IACrC,CAAC,iDAA0B,CAAC,YAAY,CAAC,EAAE,mBAAW;IACtD,CAAC,iDAA0B,CAAC,sBAAsB,CAAC,EAAE,yBAAiB;IACtE,CAAC,iDAA0B,CAAC,OAAO,CAAC,EAAE,wBAAgB;IACtD,CAAC,iDAA0B,CAAC,mBAAmB,CAAC,EAAE,2BAAmB;IACrE,CAAC,kDAA0C,CAAC,EAAE,8BAAsB;CACrE,CAAC;AAEF;;;GAGG;AACH,MAAM,uBAAuB;IAC3B,MAAM;QACJ,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAiB,CAAC,CAAC;QACvD,IAAI,eAAe,EAAE;YACnB,UAAU,mCACL,UAAU,KACb,CAAC,iDAA0B,CAAC,YAAY,CAAC,EAAE,eAAe,GAC3D,CAAC;YACF,UAAU,mCACL,UAAU,KACb,CAAC,iDAA0B,CAAC,cAAc,CAAC,EAAE,0CAAmB,CAAC,KAAK,GACvE,CAAC;YACF,UAAU,mCACL,UAAU,KACb,CAAC,iDAA0B,CAAC,cAAc,CAAC,EACzC,0CAAmB,CAAC,iBAAiB,GACxC,CAAC;YAEF,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC;YACnE,IAAI,gBAAgB,EAAE;gBACpB,UAAU,mCACL,UAAU,GACV,EAAE,CAAC,4CAAoC,CAAC,EAAE,gBAAgB,EAAE,CAChE,CAAC;aACH;YAED,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CACvC,8BAA8B,CAC/B,EAAE;gBACD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAClC,IAAI,MAAM,EAAE;oBACV,UAAU,mCAAQ,UAAU,GAAK,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAE,CAAC;iBACtD;aACF;SACF;QACD,OAAO,IAAI,oBAAQ,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAEO,mBAAmB,CAAC,eAAuB;QACjD,MAAM,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC,8BAAsB,CAAC,CAAC;QACjE,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,0BAAkB,CAAC,CAAC;QAEzD,IAAI,cAAc,GAAG,gBAAgB,CAAC;QACtC,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;YAC5D,cAAc,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,cAAc,IAAI,CAAC,gBAAgB,EAAE;YACxC,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,kBAAkB,cAAc,mBAAmB,oBAAoB,kCAAkC,eAAe,EAAE,CAAC;IACpI,CAAC;CACF;AAEY,QAAA,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_OWNER_NAME,\n WEBSITE_RESOURCE_GROUP,\n WEBSITE_SITE_NAME,\n WEBSITE_SLOT_NAME,\n CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE,\n} from '../types';\nimport {\n CloudProviderValues,\n CloudPlatformValues,\n SemanticResourceAttributes,\n} from '@opentelemetry/semantic-conventions';\n\nconst APP_SERVICE_ATTRIBUTE_ENV_VARS = {\n [SemanticResourceAttributes.CLOUD_REGION]: REGION_NAME,\n [SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: WEBSITE_SLOT_NAME,\n [SemanticResourceAttributes.HOST_ID]: WEBSITE_HOSTNAME,\n [SemanticResourceAttributes.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) {\n attributes = {\n ...attributes,\n [SemanticResourceAttributes.SERVICE_NAME]: websiteSiteName,\n };\n attributes = {\n ...attributes,\n [SemanticResourceAttributes.CLOUD_PROVIDER]: CloudProviderValues.AZURE,\n };\n attributes = {\n ...attributes,\n [SemanticResourceAttributes.CLOUD_PLATFORM]:\n CloudPlatformValues.AZURE_APP_SERVICE,\n };\n\n const azureResourceUri = this.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 private getAzureResourceUri(websiteSiteName: string): 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}\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,68 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.azureFunctionsDetector = void 0;
19
+ const resources_1 = require("@opentelemetry/resources");
20
+ const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
21
+ const types_1 = require("../types");
22
+ const AZURE_FUNCTIONS_ATTRIBUTE_ENV_VARS = {
23
+ [semantic_conventions_1.SemanticResourceAttributes.FAAS_NAME]: types_1.WEBSITE_SITE_NAME,
24
+ [semantic_conventions_1.SemanticResourceAttributes.FAAS_VERSION]: types_1.FUNCTIONS_VERSION,
25
+ [semantic_conventions_1.SemanticResourceAttributes.FAAS_INSTANCE]: types_1.WEBSITE_INSTANCE_ID,
26
+ [semantic_conventions_1.SemanticResourceAttributes.FAAS_MAX_MEMORY]: types_1.FUNCTIONS_MEM_LIMIT,
27
+ };
28
+ /**
29
+ * The AzureFunctionsDetector can be used to detect if a process is running in Azure Functions
30
+ * @returns a {@link Resource} populated with data about the environment or an empty Resource if detection fails.
31
+ */
32
+ class AzureFunctionsDetector {
33
+ detect() {
34
+ let attributes = {};
35
+ const functionName = process.env[types_1.WEBSITE_SITE_NAME];
36
+ if (functionName) {
37
+ const functionVersion = process.env[types_1.FUNCTIONS_VERSION];
38
+ const functionInstance = process.env[types_1.WEBSITE_INSTANCE_ID];
39
+ const functionMemLimit = process.env[types_1.FUNCTIONS_MEM_LIMIT];
40
+ attributes = {
41
+ [semantic_conventions_1.SemanticResourceAttributes.CLOUD_PROVIDER]: semantic_conventions_1.CloudProviderValues.AZURE,
42
+ [semantic_conventions_1.SemanticResourceAttributes.CLOUD_PLATFORM]: semantic_conventions_1.CloudPlatformValues.AZURE_FUNCTIONS,
43
+ [semantic_conventions_1.SemanticResourceAttributes.CLOUD_REGION]: process.env[types_1.REGION_NAME],
44
+ };
45
+ if (functionName) {
46
+ attributes = Object.assign(Object.assign({}, attributes), { [semantic_conventions_1.SemanticResourceAttributes.FAAS_NAME]: functionName });
47
+ }
48
+ if (functionVersion) {
49
+ attributes = Object.assign(Object.assign({}, attributes), { [semantic_conventions_1.SemanticResourceAttributes.FAAS_VERSION]: functionVersion });
50
+ }
51
+ if (functionInstance) {
52
+ attributes = Object.assign(Object.assign({}, attributes), { [semantic_conventions_1.SemanticResourceAttributes.FAAS_INSTANCE]: functionInstance });
53
+ }
54
+ if (functionMemLimit) {
55
+ attributes = Object.assign(Object.assign({}, attributes), { [semantic_conventions_1.SemanticResourceAttributes.FAAS_MAX_MEMORY]: functionMemLimit });
56
+ }
57
+ for (const [key, value] of Object.entries(AZURE_FUNCTIONS_ATTRIBUTE_ENV_VARS)) {
58
+ const envVar = process.env[value];
59
+ if (envVar) {
60
+ attributes = Object.assign(Object.assign({}, attributes), { [key]: envVar });
61
+ }
62
+ }
63
+ }
64
+ return new resources_1.Resource(attributes);
65
+ }
66
+ }
67
+ exports.azureFunctionsDetector = new AzureFunctionsDetector();
68
+ //# sourceMappingURL=AzureFunctionsDetector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AzureFunctionsDetector.js","sourceRoot":"","sources":["../../../src/detectors/AzureFunctionsDetector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,wDAA6E;AAE7E,8EAI6C;AAC7C,oCAMkB;AAElB,MAAM,kCAAkC,GAAG;IACzC,CAAC,iDAA0B,CAAC,SAAS,CAAC,EAAE,yBAAiB;IACzD,CAAC,iDAA0B,CAAC,YAAY,CAAC,EAAE,yBAAiB;IAC5D,CAAC,iDAA0B,CAAC,aAAa,CAAC,EAAE,2BAAmB;IAC/D,CAAC,iDAA0B,CAAC,eAAe,CAAC,EAAE,2BAAmB;CAClE,CAAC;AAEF;;;GAGG;AACH,MAAM,sBAAsB;IAC1B,MAAM;QACJ,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAiB,CAAC,CAAC;QACpD,IAAI,YAAY,EAAE;YAChB,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAiB,CAAC,CAAC;YACvD,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,2BAAmB,CAAC,CAAC;YAC1D,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,2BAAmB,CAAC,CAAC;YAE1D,UAAU,GAAG;gBACX,CAAC,iDAA0B,CAAC,cAAc,CAAC,EAAE,0CAAmB,CAAC,KAAK;gBACtE,CAAC,iDAA0B,CAAC,cAAc,CAAC,EACzC,0CAAmB,CAAC,eAAe;gBACrC,CAAC,iDAA0B,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAW,CAAC;aACpE,CAAC;YAEF,IAAI,YAAY,EAAE;gBAChB,UAAU,mCACL,UAAU,KACb,CAAC,iDAA0B,CAAC,SAAS,CAAC,EAAE,YAAY,GACrD,CAAC;aACH;YACD,IAAI,eAAe,EAAE;gBACnB,UAAU,mCACL,UAAU,KACb,CAAC,iDAA0B,CAAC,YAAY,CAAC,EAAE,eAAe,GAC3D,CAAC;aACH;YACD,IAAI,gBAAgB,EAAE;gBACpB,UAAU,mCACL,UAAU,KACb,CAAC,iDAA0B,CAAC,aAAa,CAAC,EAAE,gBAAgB,GAC7D,CAAC;aACH;YACD,IAAI,gBAAgB,EAAE;gBACpB,UAAU,mCACL,UAAU,KACb,CAAC,iDAA0B,CAAC,eAAe,CAAC,EAAE,gBAAgB,GAC/D,CAAC;aACH;YAED,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CACvC,kCAAkC,CACnC,EAAE;gBACD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAClC,IAAI,MAAM,EAAE;oBACV,UAAU,mCAAQ,UAAU,GAAK,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAE,CAAC;iBACtD;aACF;SACF;QACD,OAAO,IAAI,oBAAQ,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACF;AAEY,QAAA,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 CloudProviderValues,\n CloudPlatformValues,\n SemanticResourceAttributes,\n} from '@opentelemetry/semantic-conventions';\nimport {\n WEBSITE_SITE_NAME,\n FUNCTIONS_VERSION,\n WEBSITE_INSTANCE_ID,\n FUNCTIONS_MEM_LIMIT,\n REGION_NAME,\n} from '../types';\n\nconst AZURE_FUNCTIONS_ATTRIBUTE_ENV_VARS = {\n [SemanticResourceAttributes.FAAS_NAME]: WEBSITE_SITE_NAME,\n [SemanticResourceAttributes.FAAS_VERSION]: FUNCTIONS_VERSION,\n [SemanticResourceAttributes.FAAS_INSTANCE]: WEBSITE_INSTANCE_ID,\n [SemanticResourceAttributes.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 functionName = process.env[WEBSITE_SITE_NAME];\n if (functionName) {\n const functionVersion = process.env[FUNCTIONS_VERSION];\n const functionInstance = process.env[WEBSITE_INSTANCE_ID];\n const functionMemLimit = process.env[FUNCTIONS_MEM_LIMIT];\n\n attributes = {\n [SemanticResourceAttributes.CLOUD_PROVIDER]: CloudProviderValues.AZURE,\n [SemanticResourceAttributes.CLOUD_PLATFORM]:\n CloudPlatformValues.AZURE_FUNCTIONS,\n [SemanticResourceAttributes.CLOUD_REGION]: process.env[REGION_NAME],\n };\n\n if (functionName) {\n attributes = {\n ...attributes,\n [SemanticResourceAttributes.FAAS_NAME]: functionName,\n };\n }\n if (functionVersion) {\n attributes = {\n ...attributes,\n [SemanticResourceAttributes.FAAS_VERSION]: functionVersion,\n };\n }\n if (functionInstance) {\n attributes = {\n ...attributes,\n [SemanticResourceAttributes.FAAS_INSTANCE]: functionInstance,\n };\n }\n if (functionMemLimit) {\n attributes = {\n ...attributes,\n [SemanticResourceAttributes.FAAS_MAX_MEMORY]: functionMemLimit,\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,88 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.azureVmDetector = void 0;
19
+ const http = require("http");
20
+ const resources_1 = require("@opentelemetry/resources");
21
+ const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
22
+ const types_1 = require("../types");
23
+ /**
24
+ * The AzureVmDetector can be used to detect if a process is running in an Azure VM.
25
+ * @returns a {@link Resource} populated with data about the environment or an empty Resource if detection fails.
26
+ */
27
+ class AzureVmResourceDetector {
28
+ detect() {
29
+ return new resources_1.Resource({}, this.getAzureVmMetadata());
30
+ }
31
+ async getAzureVmMetadata() {
32
+ const options = {
33
+ host: types_1.AZURE_VM_METADATA_HOST,
34
+ path: types_1.AZURE_VM_METADATA_PATH,
35
+ method: 'GET',
36
+ timeout: 5000,
37
+ headers: {
38
+ Metadata: 'True',
39
+ },
40
+ };
41
+ const metadata = await new Promise((resolve, reject) => {
42
+ const timeoutId = setTimeout(() => {
43
+ req.destroy();
44
+ reject(new Error('Azure metadata service request timed out.'));
45
+ }, 1000);
46
+ const req = http.request(options, res => {
47
+ clearTimeout(timeoutId);
48
+ const { statusCode } = res;
49
+ res.setEncoding('utf8');
50
+ let rawData = '';
51
+ res.on('data', chunk => (rawData += chunk));
52
+ res.on('end', () => {
53
+ if (statusCode && statusCode >= 200 && statusCode < 300) {
54
+ try {
55
+ resolve(JSON.parse(rawData));
56
+ }
57
+ catch (error) {
58
+ reject(error);
59
+ }
60
+ }
61
+ else {
62
+ reject(new Error('Failed to load page, status code: ' + statusCode));
63
+ }
64
+ });
65
+ });
66
+ req.on('error', err => {
67
+ clearTimeout(timeoutId);
68
+ reject(err);
69
+ });
70
+ req.end();
71
+ });
72
+ const attributes = {
73
+ [types_1.AZURE_VM_SCALE_SET_NAME_ATTRIBUTE]: metadata['vmScaleSetName'],
74
+ [types_1.AZURE_VM_SKU_ATTRIBUTE]: metadata['sku'],
75
+ [semantic_conventions_1.SemanticResourceAttributes.CLOUD_PLATFORM]: semantic_conventions_1.CloudPlatformValues.AZURE_VM,
76
+ [semantic_conventions_1.SemanticResourceAttributes.CLOUD_PROVIDER]: semantic_conventions_1.CloudProviderValues.AZURE,
77
+ [semantic_conventions_1.SemanticResourceAttributes.CLOUD_REGION]: metadata['location'],
78
+ [types_1.CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE]: metadata['resourceId'],
79
+ [semantic_conventions_1.SemanticResourceAttributes.HOST_ID]: metadata['vmId'],
80
+ [semantic_conventions_1.SemanticResourceAttributes.HOST_NAME]: metadata['name'],
81
+ [semantic_conventions_1.SemanticResourceAttributes.HOST_TYPE]: metadata['vmSize'],
82
+ [semantic_conventions_1.SemanticResourceAttributes.OS_VERSION]: metadata['version'],
83
+ };
84
+ return attributes;
85
+ }
86
+ }
87
+ exports.azureVmDetector = new AzureVmResourceDetector();
88
+ //# sourceMappingURL=AzureVmDetector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AzureVmDetector.js","sourceRoot":"","sources":["../../../src/detectors/AzureVmDetector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,6BAA6B;AAC7B,wDAKkC;AAClC,8EAI6C;AAC7C,oCAOkB;AAElB;;;GAGG;AACH,MAAM,uBAAuB;IAC3B,MAAM;QACJ,OAAO,IAAI,oBAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,8BAAsB;YAC5B,IAAI,EAAE,8BAAsB;YAC5B,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,IAAI;YACb,OAAO,EAAE;gBACP,QAAQ,EAAE,MAAM;aACjB;SACF,CAAC;QACF,MAAM,QAAQ,GAAoB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtE,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;gBAChC,GAAG,CAAC,OAAO,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC,CAAC;YACjE,CAAC,EAAE,IAAI,CAAC,CAAC;YAET,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE;gBACtC,YAAY,CAAC,SAAS,CAAC,CAAC;gBACxB,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC;gBAC3B,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBACxB,IAAI,OAAO,GAAG,EAAE,CAAC;gBACjB,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC;gBAC5C,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;oBACjB,IAAI,UAAU,IAAI,UAAU,IAAI,GAAG,IAAI,UAAU,GAAG,GAAG,EAAE;wBACvD,IAAI;4BACF,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;yBAC9B;wBAAC,OAAO,KAAK,EAAE;4BACd,MAAM,CAAC,KAAK,CAAC,CAAC;yBACf;qBACF;yBAAM;wBACL,MAAM,CACJ,IAAI,KAAK,CAAC,oCAAoC,GAAG,UAAU,CAAC,CAC7D,CAAC;qBACH;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE;gBACpB,YAAY,CAAC,SAAS,CAAC,CAAC;gBACxB,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;YACH,GAAG,CAAC,GAAG,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG;YACjB,CAAC,yCAAiC,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC;YAC/D,CAAC,8BAAsB,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;YACzC,CAAC,iDAA0B,CAAC,cAAc,CAAC,EAAE,0CAAmB,CAAC,QAAQ;YACzE,CAAC,iDAA0B,CAAC,cAAc,CAAC,EAAE,0CAAmB,CAAC,KAAK;YACtE,CAAC,iDAA0B,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;YAC/D,CAAC,4CAAoC,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;YAC9D,CAAC,iDAA0B,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC;YACtD,CAAC,iDAA0B,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC;YACxD,CAAC,iDAA0B,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;YAC1D,CAAC,iDAA0B,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC;SAC7D,CAAC;QACF,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAEY,QAAA,eAAe,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 * as http from 'http';\nimport {\n DetectorSync,\n IResource,\n Resource,\n ResourceAttributes,\n} from '@opentelemetry/resources';\nimport {\n CloudPlatformValues,\n CloudProviderValues,\n SemanticResourceAttributes,\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 return new Resource({}, this.getAzureVmMetadata());\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 [SemanticResourceAttributes.CLOUD_PLATFORM]: CloudPlatformValues.AZURE_VM,\n [SemanticResourceAttributes.CLOUD_PROVIDER]: CloudProviderValues.AZURE,\n [SemanticResourceAttributes.CLOUD_REGION]: metadata['location'],\n [CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE]: metadata['resourceId'],\n [SemanticResourceAttributes.HOST_ID]: metadata['vmId'],\n [SemanticResourceAttributes.HOST_NAME]: metadata['name'],\n [SemanticResourceAttributes.HOST_TYPE]: metadata['vmSize'],\n [SemanticResourceAttributes.OS_VERSION]: metadata['version'],\n };\n return attributes;\n }\n}\n\nexport const azureVmDetector = new AzureVmResourceDetector();\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './AzureAppServiceDetector';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ __exportStar(require("./AzureAppServiceDetector"), exports);
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/detectors/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;AAEH,4DAA0C","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 * from './AzureAppServiceDetector';\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './detectors';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ __exportStar(require("./detectors"), exports);
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;AAEH,8CAA4B","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 * from './detectors';\n"]}
@@ -0,0 +1,162 @@
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 FUNCTIONS_VERSION = "FUNCTIONS_EXTENSION_VERSION";
12
+ export declare const FUNCTIONS_MEM_LIMIT = "WEBSITE_MEMORY_LIMIT_MB";
13
+ export declare const AZURE_VM_METADATA_HOST = "169.254.169.254";
14
+ export declare const AZURE_VM_METADATA_PATH = "/metadata/instance/compute?api-version=2021-12-13&format=json";
15
+ export declare const AZURE_VM_SCALE_SET_NAME_ATTRIBUTE = "azure.vm.scaleset.name";
16
+ export declare const AZURE_VM_SKU_ATTRIBUTE = "azure.vm.sku";
17
+ export interface AzureVmMetadata {
18
+ azEnvironment?: string;
19
+ additionalCapabilities?: {
20
+ hibernationEnabled?: string;
21
+ };
22
+ hostGroup?: {
23
+ id?: string;
24
+ };
25
+ host?: {
26
+ id?: string;
27
+ };
28
+ extendedLocation?: {
29
+ type?: string;
30
+ name?: string;
31
+ };
32
+ evictionPolicy?: string;
33
+ isHostCompatibilityLayerVm?: string;
34
+ licenseType?: string;
35
+ location: string;
36
+ name: string;
37
+ offer?: string;
38
+ osProfile?: {
39
+ adminUsername?: string;
40
+ computerName?: string;
41
+ disablePasswordAuthentication?: string;
42
+ };
43
+ osType?: string;
44
+ placementGroupId?: string;
45
+ plan?: {
46
+ name?: string;
47
+ product?: string;
48
+ publisher?: string;
49
+ };
50
+ platformFaultDomain?: string;
51
+ platformSubFaultDomain?: string;
52
+ platformUpdateDomain?: string;
53
+ priority?: string;
54
+ provider?: string;
55
+ publicKeys?: [
56
+ {
57
+ keyData?: string;
58
+ path?: string;
59
+ },
60
+ {
61
+ keyData?: string;
62
+ path?: string;
63
+ }
64
+ ];
65
+ publisher?: string;
66
+ resourceGroupName?: string;
67
+ resourceId: string;
68
+ securityProfile?: {
69
+ secureBootEnabled?: string;
70
+ virtualTpmEnabled?: string;
71
+ encryptionAtHost?: string;
72
+ securityType?: string;
73
+ };
74
+ sku: string;
75
+ storageProfile?: {
76
+ dataDisks?: [
77
+ {
78
+ bytesPerSecondThrottle?: string;
79
+ caching?: string;
80
+ createOption?: string;
81
+ diskCapacityBytes?: string;
82
+ diskSizeGB?: string;
83
+ image?: {
84
+ uri?: string;
85
+ };
86
+ isSharedDisk?: string;
87
+ isUltraDisk?: string;
88
+ lun?: string;
89
+ managedDisk?: {
90
+ id?: string;
91
+ storageAccountType?: string;
92
+ };
93
+ name: string;
94
+ opsPerSecondThrottle?: string;
95
+ vhd?: {
96
+ uri?: string;
97
+ };
98
+ writeAcceleratorEnabled?: string;
99
+ }
100
+ ];
101
+ imageReference?: {
102
+ id?: string;
103
+ offer?: string;
104
+ publisher?: string;
105
+ sku?: string;
106
+ version?: string;
107
+ };
108
+ osDisk?: {
109
+ caching?: string;
110
+ createOption?: string;
111
+ diskSizeGB?: string;
112
+ diffDiskSettings?: {
113
+ option?: string;
114
+ };
115
+ encryptionSettings?: {
116
+ enabled?: string;
117
+ diskEncryptionKey?: {
118
+ sourceVault?: {
119
+ id?: string;
120
+ };
121
+ secretUrl?: string;
122
+ };
123
+ keyEncryptionKey?: {
124
+ sourceVault?: {
125
+ id?: string;
126
+ };
127
+ keyUrl?: string;
128
+ };
129
+ };
130
+ image?: {
131
+ uri?: string;
132
+ };
133
+ managedDisk?: {
134
+ id?: string;
135
+ storageAccountType?: string;
136
+ };
137
+ name?: string;
138
+ osType?: string;
139
+ vhd?: {
140
+ uri?: string;
141
+ };
142
+ writeAcceleratorEnabled?: string;
143
+ };
144
+ resourceDisk?: {
145
+ size?: string;
146
+ };
147
+ };
148
+ subscriptionId?: string;
149
+ tags?: string;
150
+ tagsList?: object[];
151
+ customData?: string;
152
+ userData?: string;
153
+ version: string;
154
+ virtualMachineScaleSet?: {
155
+ id?: string;
156
+ };
157
+ vmId: string;
158
+ vmScaleSetName: string;
159
+ vmSize: string;
160
+ zone?: string;
161
+ }
162
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ 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;
19
+ exports.AZURE_APP_SERVICE_STAMP_RESOURCE_ATTRIBUTE = 'azure.app.service.stamp';
20
+ exports.CLOUD_RESOURCE_ID_RESOURCE_ATTRIBUTE = 'cloud.resource_id';
21
+ exports.REGION_NAME = 'REGION_NAME';
22
+ exports.WEBSITE_HOME_STAMPNAME = 'WEBSITE_HOME_STAMPNAME';
23
+ exports.WEBSITE_HOSTNAME = 'WEBSITE_HOSTNAME';
24
+ exports.WEBSITE_INSTANCE_ID = 'WEBSITE_INSTANCE_ID';
25
+ exports.WEBSITE_OWNER_NAME = 'WEBSITE_OWNER_NAME';
26
+ exports.WEBSITE_RESOURCE_GROUP = 'WEBSITE_RESOURCE_GROUP';
27
+ exports.WEBSITE_SITE_NAME = 'WEBSITE_SITE_NAME';
28
+ exports.WEBSITE_SLOT_NAME = 'WEBSITE_SLOT_NAME';
29
+ exports.FUNCTIONS_VERSION = 'FUNCTIONS_EXTENSION_VERSION';
30
+ exports.FUNCTIONS_MEM_LIMIT = 'WEBSITE_MEMORY_LIMIT_MB';
31
+ exports.AZURE_VM_METADATA_HOST = '169.254.169.254';
32
+ exports.AZURE_VM_METADATA_PATH = '/metadata/instance/compute?api-version=2021-12-13&format=json';
33
+ exports.AZURE_VM_SCALE_SET_NAME_ATTRIBUTE = 'azure.vm.scaleset.name';
34
+ exports.AZURE_VM_SKU_ATTRIBUTE = 'azure.vm.sku';
35
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEU,QAAA,0CAA0C,GACrD,yBAAyB,CAAC;AACf,QAAA,oCAAoC,GAAG,mBAAmB,CAAC;AAC3D,QAAA,WAAW,GAAG,aAAa,CAAC;AAC5B,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAClD,QAAA,gBAAgB,GAAG,kBAAkB,CAAC;AACtC,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAClD,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AACxC,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AAExC,QAAA,iBAAiB,GAAG,6BAA6B,CAAC;AAClD,QAAA,mBAAmB,GAAG,yBAAyB,CAAC;AAEhD,QAAA,sBAAsB,GAAG,iBAAiB,CAAC;AAC3C,QAAA,sBAAsB,GACjC,+DAA+D,CAAC;AACrD,QAAA,iCAAiC,GAAG,wBAAwB,CAAC;AAC7D,QAAA,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';\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"]}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@opentelemetry/resource-detector-azure",
3
+ "version": "0.1.0",
4
+ "description": "OpenTelemetry SDK resource detector for Azure",
5
+ "main": "build/src/index.js",
6
+ "types": "build/src/index.d.ts",
7
+ "repository": "open-telemetry/opentelemetry-js-contrib",
8
+ "scripts": {
9
+ "clean": "rimraf build/*",
10
+ "compile": "tsc -p .",
11
+ "lint": "eslint . --ext .ts",
12
+ "lint:fix": "eslint . --ext .ts --fix",
13
+ "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/resource-detector-azure --include-dependencies",
14
+ "prewatch": "npm run precompile",
15
+ "prepare": "npm run compile",
16
+ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
17
+ "tdd": "npm run test -- --watch-extensions ts --watch",
18
+ "watch": "tsc -w"
19
+ },
20
+ "author": "OpenTelemetry Authors",
21
+ "license": "Apache-2.0",
22
+ "engines": {
23
+ "node": ">=14"
24
+ },
25
+ "files": [
26
+ "build/src/**/*.js",
27
+ "build/src/**/*.js.map",
28
+ "build/src/**/*.d.ts",
29
+ "LICENSE",
30
+ "README.md"
31
+ ],
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "devDependencies": {
36
+ "@opentelemetry/api": "^1.0.0",
37
+ "@opentelemetry/contrib-test-utils": "^0.34.1",
38
+ "@types/mocha": "8.2.3",
39
+ "@types/node": "18.6.5",
40
+ "@types/sinon": "10.0.18",
41
+ "mocha": "7.2.0",
42
+ "nock": "13.3.3",
43
+ "nyc": "15.1.0",
44
+ "rimraf": "5.0.5",
45
+ "ts-mocha": "10.0.0",
46
+ "typescript": "4.4.4"
47
+ },
48
+ "dependencies": {
49
+ "@opentelemetry/resources": "^1.10.1",
50
+ "@opentelemetry/semantic-conventions": "^1.0.0"
51
+ },
52
+ "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/detectors/node/opentelemetry-resource-detector-azure#readme",
53
+ "gitHead": "1b0caa61972d969e3baea6a7db365e66dafe0c5d"
54
+ }