@graphql-hive/gateway 2.0.0-next-644c389eef9f770fab018ad7bfc5f099c0fbedda → 2.0.0-next-b87b2d63584346f34d952e49232538f2126fbd34

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +15 -22
  2. package/dist/bin.cjs +1 -1
  3. package/dist/bin.js +1 -1
  4. package/dist/{cli-CP9iY6tm.js → cli-BG8XaVLT.js} +6 -27
  5. package/dist/{cli-CPxULGJb.cjs → cli-DqXsx5Cd.cjs} +5 -26
  6. package/dist/index.cjs +14 -5
  7. package/dist/index.d.cts +16 -14
  8. package/dist/index.d.ts +16 -14
  9. package/dist/index.js +3 -2
  10. package/package.json +15 -45
  11. package/dist/execAsync-CZu27rRM.cjs +0 -44
  12. package/dist/execAsync-DmTy47v9.js +0 -21
  13. package/dist/getMachineId-bsd-B4KI42yf.js +0 -40
  14. package/dist/getMachineId-bsd-Bm_iwnsS.cjs +0 -42
  15. package/dist/getMachineId-darwin-BDexu45J.cjs +0 -43
  16. package/dist/getMachineId-darwin-c7bqIReD.js +0 -41
  17. package/dist/getMachineId-linux-D2g1lfzo.js +0 -33
  18. package/dist/getMachineId-linux-sJzq0whF.cjs +0 -35
  19. package/dist/getMachineId-unsupported-C6mI58qQ.js +0 -23
  20. package/dist/getMachineId-unsupported-Cmowwltd.cjs +0 -25
  21. package/dist/getMachineId-win-5mPgREt3.cjs +0 -63
  22. package/dist/getMachineId-win-CvE0ShWu.js +0 -41
  23. package/dist/index-61dm03o3.js +0 -279698
  24. package/dist/index-B44NjpxU.cjs +0 -843
  25. package/dist/index-DWaHa380.cjs +0 -279743
  26. package/dist/index-Dw4Doxg2.js +0 -821
  27. package/dist/opentelemetry/api.cjs +0 -12
  28. package/dist/opentelemetry/api.d.cts +0 -1
  29. package/dist/opentelemetry/api.d.ts +0 -1
  30. package/dist/opentelemetry/api.js +0 -1
  31. package/dist/opentelemetry/index.cjs +0 -12
  32. package/dist/opentelemetry/index.d.cts +0 -3
  33. package/dist/opentelemetry/index.d.ts +0 -3
  34. package/dist/opentelemetry/index.js +0 -1
  35. package/dist/opentelemetry/setup.cjs +0 -12
  36. package/dist/opentelemetry/setup.d.cts +0 -1
  37. package/dist/opentelemetry/setup.d.ts +0 -1
  38. package/dist/opentelemetry/setup.js +0 -1
@@ -1,821 +0,0 @@
1
- import { diag } from '@opentelemetry/api';
2
- import { SDK_INFO, getStringFromEnv } from '@opentelemetry/core';
3
- import * as require$$0 from 'os';
4
- import { arch, hostname, release, platform } from 'os';
5
- import * as process$1 from 'process';
6
- import { randomUUID } from 'crypto';
7
-
8
- /*
9
- * Copyright The OpenTelemetry Authors
10
- *
11
- * Licensed under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License.
13
- * You may obtain a copy of the License at
14
- *
15
- * https://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- * See the License for the specific language governing permissions and
21
- * limitations under the License.
22
- */
23
- //----------------------------------------------------------------------------------------------------------
24
- // DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/registry/stable/attributes.ts.j2
25
- //----------------------------------------------------------------------------------------------------------
26
- /**
27
- * ASP.NET Core exception middleware handling result
28
- *
29
- * @example handled
30
- * @example unhandled
31
- */
32
- /**
33
- * Logical name of the service.
34
- *
35
- * @example shoppingcart
36
- *
37
- * @note **MUST** be the same for all instances of horizontally scaled services. If the value was not specified, SDKs **MUST** fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value **MUST** be set to `unknown_service`.
38
- */
39
- var ATTR_SERVICE_NAME = 'service.name';
40
- /**
41
- * The language of the telemetry SDK.
42
- */
43
- var ATTR_TELEMETRY_SDK_LANGUAGE = 'telemetry.sdk.language';
44
- /**
45
- * The name of the telemetry SDK as defined above.
46
- *
47
- * @example opentelemetry
48
- *
49
- * @note The OpenTelemetry SDK **MUST** set the `telemetry.sdk.name` attribute to `opentelemetry`.
50
- * If another SDK, like a fork or a vendor-provided implementation, is used, this SDK **MUST** set the
51
- * `telemetry.sdk.name` attribute to the fully-qualified class or module name of this SDK's main entry point
52
- * or another suitable identifier depending on the language.
53
- * The identifier `opentelemetry` is reserved and **MUST NOT** be used in this case.
54
- * All custom identifiers **SHOULD** be stable across different versions of an implementation.
55
- */
56
- var ATTR_TELEMETRY_SDK_NAME = 'telemetry.sdk.name';
57
- /**
58
- * The version string of the telemetry SDK.
59
- *
60
- * @example 1.2.3
61
- */
62
- var ATTR_TELEMETRY_SDK_VERSION = 'telemetry.sdk.version';
63
-
64
- /*
65
- * Copyright The OpenTelemetry Authors
66
- *
67
- * Licensed under the Apache License, Version 2.0 (the "License");
68
- * you may not use this file except in compliance with the License.
69
- * You may obtain a copy of the License at
70
- *
71
- * https://www.apache.org/licenses/LICENSE-2.0
72
- *
73
- * Unless required by applicable law or agreed to in writing, software
74
- * distributed under the License is distributed on an "AS IS" BASIS,
75
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
76
- * See the License for the specific language governing permissions and
77
- * limitations under the License.
78
- */
79
- function defaultServiceName() {
80
- return `unknown_service:${process.argv0}`;
81
- }
82
-
83
- /*
84
- * Copyright The OpenTelemetry Authors
85
- *
86
- * Licensed under the Apache License, Version 2.0 (the "License");
87
- * you may not use this file except in compliance with the License.
88
- * You may obtain a copy of the License at
89
- *
90
- * https://www.apache.org/licenses/LICENSE-2.0
91
- *
92
- * Unless required by applicable law or agreed to in writing, software
93
- * distributed under the License is distributed on an "AS IS" BASIS,
94
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
95
- * See the License for the specific language governing permissions and
96
- * limitations under the License.
97
- */
98
- const isPromiseLike = (val) => {
99
- return (val !== null &&
100
- typeof val === 'object' &&
101
- typeof val.then === 'function');
102
- };
103
-
104
- /*
105
- * Copyright The OpenTelemetry Authors
106
- *
107
- * Licensed under the Apache License, Version 2.0 (the "License");
108
- * you may not use this file except in compliance with the License.
109
- * You may obtain a copy of the License at
110
- *
111
- * https://www.apache.org/licenses/LICENSE-2.0
112
- *
113
- * Unless required by applicable law or agreed to in writing, software
114
- * distributed under the License is distributed on an "AS IS" BASIS,
115
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
116
- * See the License for the specific language governing permissions and
117
- * limitations under the License.
118
- */
119
- class ResourceImpl {
120
- _rawAttributes;
121
- _asyncAttributesPending = false;
122
- _memoizedAttributes;
123
- static FromAttributeList(attributes) {
124
- const res = new ResourceImpl({});
125
- res._rawAttributes = guardedRawAttributes(attributes);
126
- res._asyncAttributesPending =
127
- attributes.filter(([_, val]) => isPromiseLike(val)).length > 0;
128
- return res;
129
- }
130
- constructor(
131
- /**
132
- * A dictionary of attributes with string keys and values that provide
133
- * information about the entity as numbers, strings or booleans
134
- * TODO: Consider to add check/validation on attributes.
135
- */
136
- resource) {
137
- const attributes = resource.attributes ?? {};
138
- this._rawAttributes = Object.entries(attributes).map(([k, v]) => {
139
- if (isPromiseLike(v)) {
140
- // side-effect
141
- this._asyncAttributesPending = true;
142
- }
143
- return [k, v];
144
- });
145
- this._rawAttributes = guardedRawAttributes(this._rawAttributes);
146
- }
147
- get asyncAttributesPending() {
148
- return this._asyncAttributesPending;
149
- }
150
- async waitForAsyncAttributes() {
151
- if (!this.asyncAttributesPending) {
152
- return;
153
- }
154
- for (let i = 0; i < this._rawAttributes.length; i++) {
155
- const [k, v] = this._rawAttributes[i];
156
- this._rawAttributes[i] = [k, isPromiseLike(v) ? await v : v];
157
- }
158
- this._asyncAttributesPending = false;
159
- }
160
- get attributes() {
161
- if (this.asyncAttributesPending) {
162
- diag.error('Accessing resource attributes before async attributes settled');
163
- }
164
- if (this._memoizedAttributes) {
165
- return this._memoizedAttributes;
166
- }
167
- const attrs = {};
168
- for (const [k, v] of this._rawAttributes) {
169
- if (isPromiseLike(v)) {
170
- diag.debug(`Unsettled resource attribute ${k} skipped`);
171
- continue;
172
- }
173
- if (v != null) {
174
- attrs[k] ??= v;
175
- }
176
- }
177
- // only memoize output if all attributes are settled
178
- if (!this._asyncAttributesPending) {
179
- this._memoizedAttributes = attrs;
180
- }
181
- return attrs;
182
- }
183
- getRawAttributes() {
184
- return this._rawAttributes;
185
- }
186
- merge(resource) {
187
- if (resource == null)
188
- return this;
189
- // Order is important
190
- // Spec states incoming attributes override existing attributes
191
- return ResourceImpl.FromAttributeList([
192
- ...resource.getRawAttributes(),
193
- ...this.getRawAttributes(),
194
- ]);
195
- }
196
- }
197
- function resourceFromAttributes(attributes) {
198
- return ResourceImpl.FromAttributeList(Object.entries(attributes));
199
- }
200
- function resourceFromDetectedResource(detectedResource) {
201
- return new ResourceImpl(detectedResource);
202
- }
203
- function emptyResource() {
204
- return resourceFromAttributes({});
205
- }
206
- function defaultResource() {
207
- return resourceFromAttributes({
208
- [ATTR_SERVICE_NAME]: defaultServiceName(),
209
- [ATTR_TELEMETRY_SDK_LANGUAGE]: SDK_INFO[ATTR_TELEMETRY_SDK_LANGUAGE],
210
- [ATTR_TELEMETRY_SDK_NAME]: SDK_INFO[ATTR_TELEMETRY_SDK_NAME],
211
- [ATTR_TELEMETRY_SDK_VERSION]: SDK_INFO[ATTR_TELEMETRY_SDK_VERSION],
212
- });
213
- }
214
- function guardedRawAttributes(attributes) {
215
- return attributes.map(([k, v]) => {
216
- if (isPromiseLike(v)) {
217
- return [
218
- k,
219
- v.catch(err => {
220
- diag.debug('promise rejection for resource attribute: %s - %s', k, err);
221
- return undefined;
222
- }),
223
- ];
224
- }
225
- return [k, v];
226
- });
227
- }
228
-
229
- /*
230
- * Copyright The OpenTelemetry Authors
231
- *
232
- * Licensed under the Apache License, Version 2.0 (the "License");
233
- * you may not use this file except in compliance with the License.
234
- * You may obtain a copy of the License at
235
- *
236
- * https://www.apache.org/licenses/LICENSE-2.0
237
- *
238
- * Unless required by applicable law or agreed to in writing, software
239
- * distributed under the License is distributed on an "AS IS" BASIS,
240
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
241
- * See the License for the specific language governing permissions and
242
- * limitations under the License.
243
- */
244
- /**
245
- * Runs all resource detectors and returns the results merged into a single Resource.
246
- *
247
- * @param config Configuration for resource detection
248
- */
249
- const detectResources = (config = {}) => {
250
- const resources = (config.detectors || []).map(d => {
251
- try {
252
- const resource = resourceFromDetectedResource(d.detect(config));
253
- diag.debug(`${d.constructor.name} found resource.`, resource);
254
- return resource;
255
- }
256
- catch (e) {
257
- diag.debug(`${d.constructor.name} failed: ${e.message}`);
258
- return emptyResource();
259
- }
260
- });
261
- return resources.reduce((acc, resource) => acc.merge(resource), emptyResource());
262
- };
263
-
264
- /*
265
- * Copyright The OpenTelemetry Authors
266
- *
267
- * Licensed under the Apache License, Version 2.0 (the "License");
268
- * you may not use this file except in compliance with the License.
269
- * You may obtain a copy of the License at
270
- *
271
- * https://www.apache.org/licenses/LICENSE-2.0
272
- *
273
- * Unless required by applicable law or agreed to in writing, software
274
- * distributed under the License is distributed on an "AS IS" BASIS,
275
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
276
- * See the License for the specific language governing permissions and
277
- * limitations under the License.
278
- */
279
- /**
280
- * EnvDetector can be used to detect the presence of and create a Resource
281
- * from the OTEL_RESOURCE_ATTRIBUTES environment variable.
282
- */
283
- class EnvDetector {
284
- // Type, attribute keys, and attribute values should not exceed 256 characters.
285
- _MAX_LENGTH = 255;
286
- // OTEL_RESOURCE_ATTRIBUTES is a comma-separated list of attributes.
287
- _COMMA_SEPARATOR = ',';
288
- // OTEL_RESOURCE_ATTRIBUTES contains key value pair separated by '='.
289
- _LABEL_KEY_VALUE_SPLITTER = '=';
290
- _ERROR_MESSAGE_INVALID_CHARS = 'should be a ASCII string with a length greater than 0 and not exceed ' +
291
- this._MAX_LENGTH +
292
- ' characters.';
293
- _ERROR_MESSAGE_INVALID_VALUE = 'should be a ASCII string with a length not exceed ' +
294
- this._MAX_LENGTH +
295
- ' characters.';
296
- /**
297
- * Returns a {@link Resource} populated with attributes from the
298
- * OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async
299
- * function to conform to the Detector interface.
300
- *
301
- * @param config The resource detection config
302
- */
303
- detect(_config) {
304
- const attributes = {};
305
- const rawAttributes = getStringFromEnv('OTEL_RESOURCE_ATTRIBUTES');
306
- const serviceName = getStringFromEnv('OTEL_SERVICE_NAME');
307
- if (rawAttributes) {
308
- try {
309
- const parsedAttributes = this._parseResourceAttributes(rawAttributes);
310
- Object.assign(attributes, parsedAttributes);
311
- }
312
- catch (e) {
313
- diag.debug(`EnvDetector failed: ${e.message}`);
314
- }
315
- }
316
- if (serviceName) {
317
- attributes[ATTR_SERVICE_NAME] = serviceName;
318
- }
319
- return { attributes };
320
- }
321
- /**
322
- * Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment
323
- * variable.
324
- *
325
- * OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes describing
326
- * the source in more detail, e.g. “key1=val1,key2=val2”. Domain names and
327
- * paths are accepted as attribute keys. Values may be quoted or unquoted in
328
- * general. If a value contains whitespace, =, or " characters, it must
329
- * always be quoted.
330
- *
331
- * @param rawEnvAttributes The resource attributes as a comma-separated list
332
- * of key/value pairs.
333
- * @returns The sanitized resource attributes.
334
- */
335
- _parseResourceAttributes(rawEnvAttributes) {
336
- if (!rawEnvAttributes)
337
- return {};
338
- const attributes = {};
339
- const rawAttributes = rawEnvAttributes.split(this._COMMA_SEPARATOR, -1);
340
- for (const rawAttribute of rawAttributes) {
341
- const keyValuePair = rawAttribute.split(this._LABEL_KEY_VALUE_SPLITTER, -1);
342
- if (keyValuePair.length !== 2) {
343
- continue;
344
- }
345
- let [key, value] = keyValuePair;
346
- // Leading and trailing whitespaces are trimmed.
347
- key = key.trim();
348
- value = value.trim().split(/^"|"$/).join('');
349
- if (!this._isValidAndNotEmpty(key)) {
350
- throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);
351
- }
352
- if (!this._isValid(value)) {
353
- throw new Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);
354
- }
355
- attributes[key] = decodeURIComponent(value);
356
- }
357
- return attributes;
358
- }
359
- /**
360
- * Determines whether the given String is a valid printable ASCII string with
361
- * a length not exceed _MAX_LENGTH characters.
362
- *
363
- * @param str The String to be validated.
364
- * @returns Whether the String is valid.
365
- */
366
- _isValid(name) {
367
- return name.length <= this._MAX_LENGTH && this._isBaggageOctetString(name);
368
- }
369
- // https://www.w3.org/TR/baggage/#definition
370
- _isBaggageOctetString(str) {
371
- for (let i = 0; i < str.length; i++) {
372
- const ch = str.charCodeAt(i);
373
- if (ch < 0x21 || ch === 0x2c || ch === 0x3b || ch === 0x5c || ch > 0x7e) {
374
- return false;
375
- }
376
- }
377
- return true;
378
- }
379
- /**
380
- * Determines whether the given String is a valid printable ASCII string with
381
- * a length greater than 0 and not exceed _MAX_LENGTH characters.
382
- *
383
- * @param str The String to be validated.
384
- * @returns Whether the String is valid and not empty.
385
- */
386
- _isValidAndNotEmpty(str) {
387
- return str.length > 0 && this._isValid(str);
388
- }
389
- }
390
- const envDetector = new EnvDetector();
391
-
392
- /*
393
- * Copyright The OpenTelemetry Authors
394
- *
395
- * Licensed under the Apache License, Version 2.0 (the "License");
396
- * you may not use this file except in compliance with the License.
397
- * You may obtain a copy of the License at
398
- *
399
- * https://www.apache.org/licenses/LICENSE-2.0
400
- *
401
- * Unless required by applicable law or agreed to in writing, software
402
- * distributed under the License is distributed on an "AS IS" BASIS,
403
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
404
- * See the License for the specific language governing permissions and
405
- * limitations under the License.
406
- */
407
- /*
408
- * This file contains a copy of unstable semantic convention definitions
409
- * used by this package.
410
- * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
411
- */
412
- /**
413
- * The cloud account ID the resource is assigned to.
414
- *
415
- * @example 111111111111
416
- * @example opentelemetry
417
- *
418
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
419
- */
420
- /**
421
- * The CPU architecture the host system is running on.
422
- *
423
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
424
- */
425
- const ATTR_HOST_ARCH = 'host.arch';
426
- /**
427
- * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the `machine-id`. See the table below for the sources to use to determine the `machine-id` based on operating system.
428
- *
429
- * @example fdbf79e8af94cb7f9e8df36789187052
430
- *
431
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
432
- */
433
- const ATTR_HOST_ID = 'host.id';
434
- /**
435
- * Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user.
436
- *
437
- * @example opentelemetry-test
438
- *
439
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
440
- */
441
- const ATTR_HOST_NAME = 'host.name';
442
- /**
443
- * The operating system type.
444
- *
445
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
446
- */
447
- const ATTR_OS_TYPE = 'os.type';
448
- /**
449
- * The version string of the operating system as defined in [Version Attributes](/docs/resource/README.md#version-attributes).
450
- *
451
- * @example 14.2.1
452
- * @example 18.04.1
453
- *
454
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
455
- */
456
- const ATTR_OS_VERSION = 'os.version';
457
- /**
458
- * The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`.
459
- *
460
- * @example cmd/otelcol
461
- *
462
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
463
- */
464
- const ATTR_PROCESS_COMMAND = 'process.command';
465
- /**
466
- * All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`.
467
- *
468
- * @example ["cmd/otecol", "--config=config.yaml"]
469
- *
470
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
471
- */
472
- const ATTR_PROCESS_COMMAND_ARGS = 'process.command_args';
473
- /**
474
- * The name of the process executable. On Linux based systems, this **SHOULD** be set to the base name of the target of `/proc/[pid]/exe`. On Windows, this **SHOULD** be set to the base name of `GetProcessImageFileNameW`.
475
- *
476
- * @example otelcol
477
- *
478
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
479
- */
480
- const ATTR_PROCESS_EXECUTABLE_NAME = 'process.executable.name';
481
- /**
482
- * The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`.
483
- *
484
- * @example /usr/bin/cmd/otelcol
485
- *
486
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
487
- */
488
- const ATTR_PROCESS_EXECUTABLE_PATH = 'process.executable.path';
489
- /**
490
- * The username of the user that owns the process.
491
- *
492
- * @example root
493
- *
494
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
495
- */
496
- const ATTR_PROCESS_OWNER = 'process.owner';
497
- /**
498
- * Process identifier (PID).
499
- *
500
- * @example 1234
501
- *
502
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
503
- */
504
- const ATTR_PROCESS_PID = 'process.pid';
505
- /**
506
- * An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment.
507
- *
508
- * @example "Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0"
509
- *
510
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
511
- */
512
- const ATTR_PROCESS_RUNTIME_DESCRIPTION = 'process.runtime.description';
513
- /**
514
- * The name of the runtime of this process.
515
- *
516
- * @example OpenJDK Runtime Environment
517
- *
518
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
519
- */
520
- const ATTR_PROCESS_RUNTIME_NAME = 'process.runtime.name';
521
- /**
522
- * The version of the runtime of this process, as returned by the runtime without modification.
523
- *
524
- * @example "14.0.2"
525
- *
526
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
527
- */
528
- const ATTR_PROCESS_RUNTIME_VERSION = 'process.runtime.version';
529
- /**
530
- * The string ID of the service instance.
531
- *
532
- * @example 627cc493-f310-47de-96bd-71410b7dec09
533
- *
534
- * @note **MUST** be unique for each instance of the same `service.namespace,service.name` pair (in other words
535
- * `service.namespace,service.name,service.instance.id` triplet **MUST** be globally unique). The ID helps to
536
- * distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled
537
- * service).
538
- *
539
- * Implementations, such as SDKs, are recommended to generate a random Version 1 or Version 4 [RFC
540
- * 4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an inherent unique ID as the source of
541
- * this value if stability is desirable. In that case, the ID **SHOULD** be used as source of a UUID Version 5 and
542
- * **SHOULD** use the following UUID as the namespace: `4d63009a-8d0f-11ee-aad7-4c796ed8e320`.
543
- *
544
- * UUIDs are typically recommended, as only an opaque value for the purposes of identifying a service instance is
545
- * needed. Similar to what can be seen in the man page for the
546
- * [`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/latest/machine-id.html) file, the underlying
547
- * data, such as pod name and namespace should be treated as confidential, being the user's choice to expose it
548
- * or not via another resource attribute.
549
- *
550
- * For applications running behind an application server (like unicorn), we do not recommend using one identifier
551
- * for all processes participating in the application. Instead, it's recommended each division (e.g. a worker
552
- * thread in unicorn) to have its own instance.id.
553
- *
554
- * It's not recommended for a Collector to set `service.instance.id` if it can't unambiguously determine the
555
- * service instance that is generating that telemetry. For instance, creating an UUID based on `pod.name` will
556
- * likely be wrong, as the Collector might not know from which container within that pod the telemetry originated.
557
- * However, Collectors can set the `service.instance.id` if they can unambiguously determine the service instance
558
- * for that telemetry. This is typically the case for scraping receivers, as they know the target address and
559
- * port.
560
- *
561
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
562
- */
563
- const ATTR_SERVICE_INSTANCE_ID = 'service.instance.id';
564
-
565
- /*
566
- * Copyright The OpenTelemetry Authors
567
- *
568
- * Licensed under the Apache License, Version 2.0 (the "License");
569
- * you may not use this file except in compliance with the License.
570
- * You may obtain a copy of the License at
571
- *
572
- * https://www.apache.org/licenses/LICENSE-2.0
573
- *
574
- * Unless required by applicable law or agreed to in writing, software
575
- * distributed under the License is distributed on an "AS IS" BASIS,
576
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
577
- * See the License for the specific language governing permissions and
578
- * limitations under the License.
579
- */
580
- let getMachineIdImpl;
581
- async function getMachineId() {
582
- if (!getMachineIdImpl) {
583
- switch (process$1.platform) {
584
- case 'darwin':
585
- getMachineIdImpl = (await import('./getMachineId-darwin-c7bqIReD.js'))
586
- .getMachineId;
587
- break;
588
- case 'linux':
589
- getMachineIdImpl = (await import('./getMachineId-linux-D2g1lfzo.js'))
590
- .getMachineId;
591
- break;
592
- case 'freebsd':
593
- getMachineIdImpl = (await import('./getMachineId-bsd-B4KI42yf.js')).getMachineId;
594
- break;
595
- case 'win32':
596
- getMachineIdImpl = (await import('./getMachineId-win-CvE0ShWu.js')).getMachineId;
597
- break;
598
- default:
599
- getMachineIdImpl = (await import('./getMachineId-unsupported-C6mI58qQ.js'))
600
- .getMachineId;
601
- break;
602
- }
603
- }
604
- return getMachineIdImpl();
605
- }
606
-
607
- /*
608
- * Copyright The OpenTelemetry Authors
609
- *
610
- * Licensed under the Apache License, Version 2.0 (the "License");
611
- * you may not use this file except in compliance with the License.
612
- * You may obtain a copy of the License at
613
- *
614
- * https://www.apache.org/licenses/LICENSE-2.0
615
- *
616
- * Unless required by applicable law or agreed to in writing, software
617
- * distributed under the License is distributed on an "AS IS" BASIS,
618
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
619
- * See the License for the specific language governing permissions and
620
- * limitations under the License.
621
- */
622
- const normalizeArch = (nodeArchString) => {
623
- // Maps from https://nodejs.org/api/os.html#osarch to arch values in spec:
624
- // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/host.md
625
- switch (nodeArchString) {
626
- case 'arm':
627
- return 'arm32';
628
- case 'ppc':
629
- return 'ppc32';
630
- case 'x64':
631
- return 'amd64';
632
- default:
633
- return nodeArchString;
634
- }
635
- };
636
- const normalizeType = (nodePlatform) => {
637
- // Maps from https://nodejs.org/api/os.html#osplatform to arch values in spec:
638
- // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/os.md
639
- switch (nodePlatform) {
640
- case 'sunos':
641
- return 'solaris';
642
- case 'win32':
643
- return 'windows';
644
- default:
645
- return nodePlatform;
646
- }
647
- };
648
-
649
- /*
650
- * Copyright The OpenTelemetry Authors
651
- *
652
- * Licensed under the Apache License, Version 2.0 (the "License");
653
- * you may not use this file except in compliance with the License.
654
- * You may obtain a copy of the License at
655
- *
656
- * https://www.apache.org/licenses/LICENSE-2.0
657
- *
658
- * Unless required by applicable law or agreed to in writing, software
659
- * distributed under the License is distributed on an "AS IS" BASIS,
660
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
661
- * See the License for the specific language governing permissions and
662
- * limitations under the License.
663
- */
664
- /**
665
- * HostDetector detects the resources related to the host current process is
666
- * running on. Currently only non-cloud-based attributes are included.
667
- */
668
- class HostDetector {
669
- detect(_config) {
670
- const attributes = {
671
- [ATTR_HOST_NAME]: hostname(),
672
- [ATTR_HOST_ARCH]: normalizeArch(arch()),
673
- [ATTR_HOST_ID]: getMachineId(),
674
- };
675
- return { attributes };
676
- }
677
- }
678
- const hostDetector = new HostDetector();
679
-
680
- /*
681
- * Copyright The OpenTelemetry Authors
682
- *
683
- * Licensed under the Apache License, Version 2.0 (the "License");
684
- * you may not use this file except in compliance with the License.
685
- * You may obtain a copy of the License at
686
- *
687
- * https://www.apache.org/licenses/LICENSE-2.0
688
- *
689
- * Unless required by applicable law or agreed to in writing, software
690
- * distributed under the License is distributed on an "AS IS" BASIS,
691
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
692
- * See the License for the specific language governing permissions and
693
- * limitations under the License.
694
- */
695
- /**
696
- * OSDetector detects the resources related to the operating system (OS) on
697
- * which the process represented by this resource is running.
698
- */
699
- class OSDetector {
700
- detect(_config) {
701
- const attributes = {
702
- [ATTR_OS_TYPE]: normalizeType(platform()),
703
- [ATTR_OS_VERSION]: release(),
704
- };
705
- return { attributes };
706
- }
707
- }
708
- const osDetector = new OSDetector();
709
-
710
- /*
711
- * Copyright The OpenTelemetry Authors
712
- *
713
- * Licensed under the Apache License, Version 2.0 (the "License");
714
- * you may not use this file except in compliance with the License.
715
- * You may obtain a copy of the License at
716
- *
717
- * https://www.apache.org/licenses/LICENSE-2.0
718
- *
719
- * Unless required by applicable law or agreed to in writing, software
720
- * distributed under the License is distributed on an "AS IS" BASIS,
721
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
722
- * See the License for the specific language governing permissions and
723
- * limitations under the License.
724
- */
725
- /**
726
- * ProcessDetector will be used to detect the resources related current process running
727
- * and being instrumented from the NodeJS Process module.
728
- */
729
- class ProcessDetector {
730
- detect(_config) {
731
- const attributes = {
732
- [ATTR_PROCESS_PID]: process.pid,
733
- [ATTR_PROCESS_EXECUTABLE_NAME]: process.title,
734
- [ATTR_PROCESS_EXECUTABLE_PATH]: process.execPath,
735
- [ATTR_PROCESS_COMMAND_ARGS]: [
736
- process.argv[0],
737
- ...process.execArgv,
738
- ...process.argv.slice(1),
739
- ],
740
- [ATTR_PROCESS_RUNTIME_VERSION]: process.versions.node,
741
- [ATTR_PROCESS_RUNTIME_NAME]: 'nodejs',
742
- [ATTR_PROCESS_RUNTIME_DESCRIPTION]: 'Node.js',
743
- };
744
- if (process.argv.length > 1) {
745
- attributes[ATTR_PROCESS_COMMAND] = process.argv[1];
746
- }
747
- try {
748
- const userInfo = require$$0.userInfo();
749
- attributes[ATTR_PROCESS_OWNER] = userInfo.username;
750
- }
751
- catch (e) {
752
- diag.debug(`error obtaining process owner: ${e}`);
753
- }
754
- return { attributes };
755
- }
756
- }
757
- const processDetector = new ProcessDetector();
758
-
759
- /*
760
- * Copyright The OpenTelemetry Authors
761
- *
762
- * Licensed under the Apache License, Version 2.0 (the "License");
763
- * you may not use this file except in compliance with the License.
764
- * You may obtain a copy of the License at
765
- *
766
- * https://www.apache.org/licenses/LICENSE-2.0
767
- *
768
- * Unless required by applicable law or agreed to in writing, software
769
- * distributed under the License is distributed on an "AS IS" BASIS,
770
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
771
- * See the License for the specific language governing permissions and
772
- * limitations under the License.
773
- */
774
- /**
775
- * ServiceInstanceIdDetector detects the resources related to the service instance ID.
776
- */
777
- class ServiceInstanceIdDetector {
778
- detect(_config) {
779
- return {
780
- attributes: {
781
- [ATTR_SERVICE_INSTANCE_ID]: randomUUID(),
782
- },
783
- };
784
- }
785
- }
786
- /**
787
- * @experimental
788
- */
789
- const serviceInstanceIdDetector = new ServiceInstanceIdDetector();
790
-
791
- /*
792
- * Copyright The OpenTelemetry Authors
793
- *
794
- * Licensed under the Apache License, Version 2.0 (the "License");
795
- * you may not use this file except in compliance with the License.
796
- * You may obtain a copy of the License at
797
- *
798
- * https://www.apache.org/licenses/LICENSE-2.0
799
- *
800
- * Unless required by applicable law or agreed to in writing, software
801
- * distributed under the License is distributed on an "AS IS" BASIS,
802
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
803
- * See the License for the specific language governing permissions and
804
- * limitations under the License.
805
- */
806
-
807
- var esm = /*#__PURE__*/Object.freeze({
808
- __proto__: null,
809
- defaultResource: defaultResource,
810
- defaultServiceName: defaultServiceName,
811
- detectResources: detectResources,
812
- emptyResource: emptyResource,
813
- envDetector: envDetector,
814
- hostDetector: hostDetector,
815
- osDetector: osDetector,
816
- processDetector: processDetector,
817
- resourceFromAttributes: resourceFromAttributes,
818
- serviceInstanceIdDetector: serviceInstanceIdDetector
819
- });
820
-
821
- export { esm as e };