feat: Complete zCode CLI X with Telegram bot integration

- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation

🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
This commit is contained in:
admin
2026-05-05 09:01:26 +00:00
Unverified
parent 4a7035dd92
commit 875c7f9b91
24688 changed files with 3224957 additions and 221 deletions

View File

@@ -0,0 +1,46 @@
import type { Attributes } from '@opentelemetry/api';
import type { RawResourceAttribute } from './types';
/**
* An interface that represents a resource. A Resource describes the entity for which signals (metrics or trace) are
* collected.
*
* This interface is NOT user-implementable. Valid ways to obtain a {@link Resource} are by using either of these functions
* - {@link resourceFromAttributes}
* - {@link emptyResource}
* - {@link defaultResource}
* - {@link detectResources}
*/
export interface Resource {
/**
* Check if async attributes have resolved. This is useful to avoid awaiting
* waitForAsyncAttributes (which will introduce asynchronous behavior) when not necessary.
*
* @returns true if the resource "attributes" property is not yet settled to its final value
*/
readonly asyncAttributesPending?: boolean;
/**
* @returns the Resource's attributes.
*/
readonly attributes: Attributes;
/**
* @returns the Resource's schema URL or undefined if not set.
*/
readonly schemaUrl?: string;
/**
* Returns a promise that will never be rejected. Resolves when all async attributes have finished being added to
* this Resource's attributes. This is useful in exporters to block until resource detection
* has finished.
*/
waitForAsyncAttributes?(): Promise<void>;
/**
* Returns a new, merged {@link Resource} by merging the current Resource
* with the other Resource. In case of a collision, other Resource takes
* precedence.
*
* @param other the Resource that will be merged with this.
* @returns the newly merged Resource.
*/
merge(other: Resource | null): Resource;
getRawAttributes(): RawResourceAttribute[];
}
//# sourceMappingURL=Resource.d.ts.map

View File

@@ -0,0 +1,6 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
export {};
//# sourceMappingURL=Resource.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../../src/Resource.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes } from '@opentelemetry/api';\nimport type { RawResourceAttribute } from './types';\n\n/**\n * An interface that represents a resource. A Resource describes the entity for which signals (metrics or trace) are\n * collected.\n *\n * This interface is NOT user-implementable. Valid ways to obtain a {@link Resource} are by using either of these functions\n * - {@link resourceFromAttributes}\n * - {@link emptyResource}\n * - {@link defaultResource}\n * - {@link detectResources}\n */\nexport interface Resource {\n /**\n * Check if async attributes have resolved. This is useful to avoid awaiting\n * waitForAsyncAttributes (which will introduce asynchronous behavior) when not necessary.\n *\n * @returns true if the resource \"attributes\" property is not yet settled to its final value\n */\n readonly asyncAttributesPending?: boolean;\n\n /**\n * @returns the Resource's attributes.\n */\n readonly attributes: Attributes;\n\n /**\n * @returns the Resource's schema URL or undefined if not set.\n */\n readonly schemaUrl?: string;\n\n /**\n * Returns a promise that will never be rejected. Resolves when all async attributes have finished being added to\n * this Resource's attributes. This is useful in exporters to block until resource detection\n * has finished.\n */\n waitForAsyncAttributes?(): Promise<void>;\n\n /**\n * Returns a new, merged {@link Resource} by merging the current Resource\n * with the other Resource. In case of a collision, other Resource takes\n * precedence.\n *\n * @param other the Resource that will be merged with this.\n * @returns the newly merged Resource.\n */\n merge(other: Resource | null): Resource;\n\n getRawAttributes(): RawResourceAttribute[];\n}\n"]}

View File

@@ -0,0 +1,7 @@
import type { Resource } from './Resource';
import type { DetectedResource, DetectedResourceAttributes, ResourceOptions } from './types';
export declare function resourceFromAttributes(attributes: DetectedResourceAttributes, options?: ResourceOptions): Resource;
export declare function resourceFromDetectedResource(detectedResource: DetectedResource, options?: ResourceOptions): Resource;
export declare function emptyResource(): Resource;
export declare function defaultResource(): Resource;
//# sourceMappingURL=ResourceImpl.d.ts.map

View File

@@ -0,0 +1,149 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { diag } from '@opentelemetry/api';
import { SDK_INFO } from '@opentelemetry/core';
import { ATTR_SERVICE_NAME, ATTR_TELEMETRY_SDK_LANGUAGE, ATTR_TELEMETRY_SDK_NAME, ATTR_TELEMETRY_SDK_VERSION, } from '@opentelemetry/semantic-conventions';
import { defaultServiceName } from './default-service-name';
import { isPromiseLike } from './utils';
class ResourceImpl {
_rawAttributes;
_asyncAttributesPending = false;
_schemaUrl;
_memoizedAttributes;
static FromAttributeList(attributes, options) {
const res = new ResourceImpl({}, options);
res._rawAttributes = guardedRawAttributes(attributes);
res._asyncAttributesPending =
attributes.filter(([_, val]) => isPromiseLike(val)).length > 0;
return res;
}
constructor(
/**
* A dictionary of attributes with string keys and values that provide
* information about the entity as numbers, strings or booleans
* TODO: Consider to add check/validation on attributes.
*/
resource, options) {
const attributes = resource.attributes ?? {};
this._rawAttributes = Object.entries(attributes).map(([k, v]) => {
if (isPromiseLike(v)) {
// side-effect
this._asyncAttributesPending = true;
}
return [k, v];
});
this._rawAttributes = guardedRawAttributes(this._rawAttributes);
this._schemaUrl = validateSchemaUrl(options?.schemaUrl);
}
get asyncAttributesPending() {
return this._asyncAttributesPending;
}
async waitForAsyncAttributes() {
if (!this.asyncAttributesPending) {
return;
}
for (let i = 0; i < this._rawAttributes.length; i++) {
const [k, v] = this._rawAttributes[i];
this._rawAttributes[i] = [k, isPromiseLike(v) ? await v : v];
}
this._asyncAttributesPending = false;
}
get attributes() {
if (this.asyncAttributesPending) {
diag.error('Accessing resource attributes before async attributes settled');
}
if (this._memoizedAttributes) {
return this._memoizedAttributes;
}
const attrs = {};
for (const [k, v] of this._rawAttributes) {
if (isPromiseLike(v)) {
diag.debug(`Unsettled resource attribute ${k} skipped`);
continue;
}
if (v != null) {
attrs[k] ??= v;
}
}
// only memoize output if all attributes are settled
if (!this._asyncAttributesPending) {
this._memoizedAttributes = attrs;
}
return attrs;
}
getRawAttributes() {
return this._rawAttributes;
}
get schemaUrl() {
return this._schemaUrl;
}
merge(resource) {
if (resource == null)
return this;
// Order is important
// Spec states incoming attributes override existing attributes
const mergedSchemaUrl = mergeSchemaUrl(this, resource);
const mergedOptions = mergedSchemaUrl
? { schemaUrl: mergedSchemaUrl }
: undefined;
return ResourceImpl.FromAttributeList([...resource.getRawAttributes(), ...this.getRawAttributes()], mergedOptions);
}
}
export function resourceFromAttributes(attributes, options) {
return ResourceImpl.FromAttributeList(Object.entries(attributes), options);
}
export function resourceFromDetectedResource(detectedResource, options) {
return new ResourceImpl(detectedResource, options);
}
export function emptyResource() {
return resourceFromAttributes({});
}
export function defaultResource() {
return resourceFromAttributes({
[ATTR_SERVICE_NAME]: defaultServiceName(),
[ATTR_TELEMETRY_SDK_LANGUAGE]: SDK_INFO[ATTR_TELEMETRY_SDK_LANGUAGE],
[ATTR_TELEMETRY_SDK_NAME]: SDK_INFO[ATTR_TELEMETRY_SDK_NAME],
[ATTR_TELEMETRY_SDK_VERSION]: SDK_INFO[ATTR_TELEMETRY_SDK_VERSION],
});
}
function guardedRawAttributes(attributes) {
return attributes.map(([k, v]) => {
if (isPromiseLike(v)) {
return [
k,
v.catch(err => {
diag.debug('promise rejection for resource attribute: %s - %s', k, err);
return undefined;
}),
];
}
return [k, v];
});
}
function validateSchemaUrl(schemaUrl) {
if (typeof schemaUrl === 'string' || schemaUrl === undefined) {
return schemaUrl;
}
diag.warn('Schema URL must be string or undefined, got %s. Schema URL will be ignored.', schemaUrl);
return undefined;
}
function mergeSchemaUrl(old, updating) {
const oldSchemaUrl = old?.schemaUrl;
const updatingSchemaUrl = updating?.schemaUrl;
const isOldEmpty = oldSchemaUrl === undefined || oldSchemaUrl === '';
const isUpdatingEmpty = updatingSchemaUrl === undefined || updatingSchemaUrl === '';
if (isOldEmpty) {
return updatingSchemaUrl;
}
if (isUpdatingEmpty) {
return oldSchemaUrl;
}
if (oldSchemaUrl === updatingSchemaUrl) {
return oldSchemaUrl;
}
diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.', oldSchemaUrl, updatingSchemaUrl);
return undefined;
}
//# sourceMappingURL=ResourceImpl.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
import type { ResourceDetector } from './types';
/**
* ResourceDetectionConfig provides an interface for configuring resource auto-detection.
*/
export interface ResourceDetectionConfig {
detectors?: Array<ResourceDetector>;
}
//# sourceMappingURL=config.d.ts.map

View File

@@ -0,0 +1,6 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
export {};
//# sourceMappingURL=config.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ResourceDetector } from './types';\n\n/**\n * ResourceDetectionConfig provides an interface for configuring resource auto-detection.\n */\nexport interface ResourceDetectionConfig {\n detectors?: Array<ResourceDetector>;\n}\n"]}

View File

@@ -0,0 +1,9 @@
/**
* Returns the default service name for OpenTelemetry resources.
* In Node.js environments, returns "unknown_service:<process.argv0>".
* In browser/edge environments, returns "unknown_service".
*/
export declare function defaultServiceName(): string;
/** @internal For testing purposes only */
export declare function _clearDefaultServiceNameCache(): void;
//# sourceMappingURL=default-service-name.d.ts.map

View File

@@ -0,0 +1,27 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
let serviceName;
/**
* Returns the default service name for OpenTelemetry resources.
* In Node.js environments, returns "unknown_service:<process.argv0>".
* In browser/edge environments, returns "unknown_service".
*/
export function defaultServiceName() {
if (serviceName === undefined) {
try {
const argv0 = globalThis.process.argv0;
serviceName = argv0 ? `unknown_service:${argv0}` : 'unknown_service';
}
catch {
serviceName = 'unknown_service';
}
}
return serviceName;
}
/** @internal For testing purposes only */
export function _clearDefaultServiceNameCache() {
serviceName = undefined;
}
//# sourceMappingURL=default-service-name.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"default-service-name.js","sourceRoot":"","sources":["../../src/default-service-name.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,IAAI,WAA+B,CAAC;AAEpC;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,WAAW,KAAK,SAAS,EAAE;QAC7B,IAAI;YACF,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC;YACvC,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,mBAAmB,KAAK,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC;SACtE;QAAC,MAAM;YACN,WAAW,GAAG,iBAAiB,CAAC;SACjC;KACF;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,0CAA0C;AAC1C,MAAM,UAAU,6BAA6B;IAC3C,WAAW,GAAG,SAAS,CAAC;AAC1B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nlet serviceName: string | undefined;\n\n/**\n * Returns the default service name for OpenTelemetry resources.\n * In Node.js environments, returns \"unknown_service:<process.argv0>\".\n * In browser/edge environments, returns \"unknown_service\".\n */\nexport function defaultServiceName(): string {\n if (serviceName === undefined) {\n try {\n const argv0 = globalThis.process.argv0;\n serviceName = argv0 ? `unknown_service:${argv0}` : 'unknown_service';\n } catch {\n serviceName = 'unknown_service';\n }\n }\n return serviceName;\n}\n\n/** @internal For testing purposes only */\nexport function _clearDefaultServiceNameCache(): void {\n serviceName = undefined;\n}\n"]}

View File

@@ -0,0 +1,9 @@
import type { Resource } from './Resource';
import type { ResourceDetectionConfig } from './config';
/**
* Runs all resource detectors and returns the results merged into a single Resource.
*
* @param config Configuration for resource detection
*/
export declare const detectResources: (config?: ResourceDetectionConfig) => Resource;
//# sourceMappingURL=detect-resources.d.ts.map

View File

@@ -0,0 +1,26 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { diag } from '@opentelemetry/api';
import { emptyResource, resourceFromDetectedResource } from './ResourceImpl';
/**
* Runs all resource detectors and returns the results merged into a single Resource.
*
* @param config Configuration for resource detection
*/
export const detectResources = (config = {}) => {
const resources = (config.detectors || []).map(d => {
try {
const resource = resourceFromDetectedResource(d.detect(config));
diag.debug(`${d.constructor.name} found resource.`, resource);
return resource;
}
catch (e) {
diag.debug(`${d.constructor.name} failed: ${e.message}`);
return emptyResource();
}
});
return resources.reduce((acc, resource) => acc.merge(resource), emptyResource());
};
//# sourceMappingURL=detect-resources.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detect-resources.js","sourceRoot":"","sources":["../../src/detect-resources.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAG7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,SAAkC,EAAE,EAC1B,EAAE;IACZ,MAAM,SAAS,GAAe,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QAC7D,IAAI;YACF,MAAM,QAAQ,GAAG,4BAA4B,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;YAChE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,IAAI,kBAAkB,EAAE,QAAQ,CAAC,CAAC;YAC9D,OAAO,QAAQ,CAAC;SACjB;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,IAAI,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACzD,OAAO,aAAa,EAAE,CAAC;SACxB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC,MAAM,CACrB,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EACtC,aAAa,EAAE,CAChB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { diag } from '@opentelemetry/api';\nimport type { Resource } from './Resource';\nimport { emptyResource, resourceFromDetectedResource } from './ResourceImpl';\nimport type { ResourceDetectionConfig } from './config';\n\n/**\n * Runs all resource detectors and returns the results merged into a single Resource.\n *\n * @param config Configuration for resource detection\n */\nexport const detectResources = (\n config: ResourceDetectionConfig = {}\n): Resource => {\n const resources: Resource[] = (config.detectors || []).map(d => {\n try {\n const resource = resourceFromDetectedResource(d.detect(config));\n diag.debug(`${d.constructor.name} found resource.`, resource);\n return resource;\n } catch (e) {\n diag.debug(`${d.constructor.name} failed: ${e.message}`);\n return emptyResource();\n }\n });\n\n return resources.reduce(\n (acc, resource) => acc.merge(resource),\n emptyResource()\n );\n};\n"]}

View File

@@ -0,0 +1,39 @@
import type { ResourceDetectionConfig } from '../config';
import type { DetectedResource, ResourceDetector } from '../types';
/**
* EnvDetector can be used to detect the presence of and create a Resource
* from the OTEL_RESOURCE_ATTRIBUTES environment variable.
*/
declare class EnvDetector implements ResourceDetector {
private readonly _MAX_LENGTH;
private readonly _COMMA_SEPARATOR;
private readonly _LABEL_KEY_VALUE_SPLITTER;
/**
* Returns a {@link Resource} populated with attributes from the
* OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async
* function to conform to the Detector interface.
*
* @param config The resource detection config
*/
detect(_config?: ResourceDetectionConfig): DetectedResource;
/**
* Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment
* variable.
*
* OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes in the
* format "key1=value1,key2=value2". The ',' and '=' characters in keys
* and values MUST be percent-encoded. Other characters MAY be percent-encoded.
*
* Per the spec, on any error (e.g., decoding failure), the entire environment
* variable value is discarded.
*
* @param rawEnvAttributes The resource attributes as a comma-separated list
* of key/value pairs.
* @returns The parsed resource attributes.
* @throws Error if parsing fails (caller handles by discarding all attributes)
*/
private _parseResourceAttributes;
}
export declare const envDetector: EnvDetector;
export {};
//# sourceMappingURL=EnvDetector.d.ts.map

View File

@@ -0,0 +1,100 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { diag } from '@opentelemetry/api';
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
import { getStringFromEnv } from '@opentelemetry/core';
/**
* EnvDetector can be used to detect the presence of and create a Resource
* from the OTEL_RESOURCE_ATTRIBUTES environment variable.
*/
class EnvDetector {
// Type, attribute keys, and attribute values should not exceed 256 characters.
_MAX_LENGTH = 255;
// OTEL_RESOURCE_ATTRIBUTES is a comma-separated list of attributes.
_COMMA_SEPARATOR = ',';
// OTEL_RESOURCE_ATTRIBUTES contains key value pair separated by '='.
_LABEL_KEY_VALUE_SPLITTER = '=';
/**
* Returns a {@link Resource} populated with attributes from the
* OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async
* function to conform to the Detector interface.
*
* @param config The resource detection config
*/
detect(_config) {
const attributes = {};
const rawAttributes = getStringFromEnv('OTEL_RESOURCE_ATTRIBUTES');
const serviceName = getStringFromEnv('OTEL_SERVICE_NAME');
if (rawAttributes) {
try {
const parsedAttributes = this._parseResourceAttributes(rawAttributes);
Object.assign(attributes, parsedAttributes);
}
catch (e) {
diag.debug(`EnvDetector failed: ${e instanceof Error ? e.message : e}`);
}
}
if (serviceName) {
attributes[ATTR_SERVICE_NAME] = serviceName;
}
return { attributes };
}
/**
* Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment
* variable.
*
* OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes in the
* format "key1=value1,key2=value2". The ',' and '=' characters in keys
* and values MUST be percent-encoded. Other characters MAY be percent-encoded.
*
* Per the spec, on any error (e.g., decoding failure), the entire environment
* variable value is discarded.
*
* @param rawEnvAttributes The resource attributes as a comma-separated list
* of key/value pairs.
* @returns The parsed resource attributes.
* @throws Error if parsing fails (caller handles by discarding all attributes)
*/
_parseResourceAttributes(rawEnvAttributes) {
if (!rawEnvAttributes)
return {};
const attributes = {};
const rawAttributes = rawEnvAttributes.split(this._COMMA_SEPARATOR);
for (const rawAttribute of rawAttributes) {
const keyValuePair = rawAttribute.split(this._LABEL_KEY_VALUE_SPLITTER);
// Per spec: ',' and '=' MUST be percent-encoded in keys and values.
// If we get != 2 parts, there's an unencoded '=' which is an error.
if (keyValuePair.length !== 2) {
throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${rawAttribute}". ` +
`Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);
}
const [rawKey, rawValue] = keyValuePair;
const key = rawKey.trim();
const value = rawValue.trim();
if (key.length === 0) {
throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${rawAttribute}".`);
}
let decodedKey;
let decodedValue;
try {
decodedKey = decodeURIComponent(key);
decodedValue = decodeURIComponent(value);
}
catch (e) {
throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${rawAttribute}": ${e instanceof Error ? e.message : e}`);
}
if (decodedKey.length > this._MAX_LENGTH) {
throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${decodedKey}".`);
}
if (decodedValue.length > this._MAX_LENGTH) {
throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${decodedKey}".`);
}
attributes[decodedKey] = decodedValue;
}
return attributes;
}
}
export const envDetector = new EnvDetector();
//# sourceMappingURL=EnvDetector.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
import type { DetectedResource, ResourceDetector } from '../types';
export declare class NoopDetector implements ResourceDetector {
detect(): DetectedResource;
}
export declare const noopDetector: NoopDetector;
//# sourceMappingURL=NoopDetector.d.ts.map

View File

@@ -0,0 +1,13 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
export class NoopDetector {
detect() {
return {
attributes: {},
};
}
}
export const noopDetector = new NoopDetector();
//# sourceMappingURL=NoopDetector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NoopDetector.js","sourceRoot":"","sources":["../../../src/detectors/NoopDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,OAAO,YAAY;IACvB,MAAM;QACJ,OAAO;YACL,UAAU,EAAE,EAAE;SACf,CAAC;IACJ,CAAC;CACF;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { DetectedResource, ResourceDetector } from '../types';\n\nexport class NoopDetector implements ResourceDetector {\n detect(): DetectedResource {\n return {\n attributes: {},\n };\n }\n}\n\nexport const noopDetector = new NoopDetector();\n"]}

View File

@@ -0,0 +1,4 @@
export { envDetector } from './EnvDetector';
export { hostDetector, osDetector, processDetector, serviceInstanceIdDetector, } from './platform';
export { noopDetector } from './NoopDetector';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,8 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
export { envDetector } from './EnvDetector';
export { hostDetector, osDetector, processDetector, serviceInstanceIdDetector, } from './platform';
export { noopDetector } from './NoopDetector';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/detectors/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,UAAU,EACV,eAAe,EACf,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { envDetector } from './EnvDetector';\nexport {\n hostDetector,\n osDetector,\n processDetector,\n serviceInstanceIdDetector,\n} from './platform';\nexport { noopDetector } from './NoopDetector';\n"]}

View File

@@ -0,0 +1,2 @@
export declare const hostDetector: import("../../NoopDetector").NoopDetector;
//# sourceMappingURL=HostDetector.d.ts.map

View File

@@ -0,0 +1,7 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { noopDetector } from '../../NoopDetector';
export const hostDetector = noopDetector;
//# sourceMappingURL=HostDetector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"HostDetector.js","sourceRoot":"","sources":["../../../../../src/detectors/platform/browser/HostDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { noopDetector } from '../../NoopDetector';\n\nexport const hostDetector = noopDetector;\n"]}

View File

@@ -0,0 +1,2 @@
export declare const osDetector: import("../../NoopDetector").NoopDetector;
//# sourceMappingURL=OSDetector.d.ts.map

View File

@@ -0,0 +1,7 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { noopDetector } from '../../NoopDetector';
export const osDetector = noopDetector;
//# sourceMappingURL=OSDetector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"OSDetector.js","sourceRoot":"","sources":["../../../../../src/detectors/platform/browser/OSDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { noopDetector } from '../../NoopDetector';\n\nexport const osDetector = noopDetector;\n"]}

View File

@@ -0,0 +1,2 @@
export declare const processDetector: import("../../NoopDetector").NoopDetector;
//# sourceMappingURL=ProcessDetector.d.ts.map

View File

@@ -0,0 +1,7 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { noopDetector } from '../../NoopDetector';
export const processDetector = noopDetector;
//# sourceMappingURL=ProcessDetector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ProcessDetector.js","sourceRoot":"","sources":["../../../../../src/detectors/platform/browser/ProcessDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { noopDetector } from '../../NoopDetector';\n\nexport const processDetector = noopDetector;\n"]}

View File

@@ -0,0 +1,5 @@
/**
* @experimental
*/
export declare const serviceInstanceIdDetector: import("../../NoopDetector").NoopDetector;
//# sourceMappingURL=ServiceInstanceIdDetector.d.ts.map

View File

@@ -0,0 +1,10 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { noopDetector } from '../../NoopDetector';
/**
* @experimental
*/
export const serviceInstanceIdDetector = noopDetector;
//# sourceMappingURL=ServiceInstanceIdDetector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ServiceInstanceIdDetector.js","sourceRoot":"","sources":["../../../../../src/detectors/platform/browser/ServiceInstanceIdDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,YAAY,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { noopDetector } from '../../NoopDetector';\n\n/**\n * @experimental\n */\nexport const serviceInstanceIdDetector = noopDetector;\n"]}

View File

@@ -0,0 +1,5 @@
export { hostDetector } from './HostDetector';
export { osDetector } from './OSDetector';
export { processDetector } from './ProcessDetector';
export { serviceInstanceIdDetector } from './ServiceInstanceIdDetector';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,9 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
export { hostDetector } from './HostDetector';
export { osDetector } from './OSDetector';
export { processDetector } from './ProcessDetector';
export { serviceInstanceIdDetector } from './ServiceInstanceIdDetector';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/detectors/platform/browser/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { hostDetector } from './HostDetector';\nexport { osDetector } from './OSDetector';\nexport { processDetector } from './ProcessDetector';\nexport { serviceInstanceIdDetector } from './ServiceInstanceIdDetector';\n"]}

View File

@@ -0,0 +1,2 @@
export { hostDetector, osDetector, processDetector, serviceInstanceIdDetector, } from './node';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,6 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
export { hostDetector, osDetector, processDetector, serviceInstanceIdDetector, } from './node';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/detectors/platform/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,YAAY,EACZ,UAAU,EACV,eAAe,EACf,yBAAyB,GAC1B,MAAM,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport {\n hostDetector,\n osDetector,\n processDetector,\n serviceInstanceIdDetector,\n} from './node';\n"]}

View File

@@ -0,0 +1,12 @@
import type { ResourceDetectionConfig } from '../../../config';
import type { DetectedResource, ResourceDetector } from '../../../types';
/**
* HostDetector detects the resources related to the host current process is
* running on. Currently only non-cloud-based attributes are included.
*/
declare class HostDetector implements ResourceDetector {
detect(_config?: ResourceDetectionConfig): DetectedResource;
}
export declare const hostDetector: HostDetector;
export {};
//# sourceMappingURL=HostDetector.d.ts.map

View File

@@ -0,0 +1,24 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { ATTR_HOST_ARCH, ATTR_HOST_ID, ATTR_HOST_NAME } from '../../../semconv';
import { arch, hostname } from 'os';
import { getMachineId } from './machine-id/getMachineId';
import { normalizeArch } from './utils';
/**
* HostDetector detects the resources related to the host current process is
* running on. Currently only non-cloud-based attributes are included.
*/
class HostDetector {
detect(_config) {
const attributes = {
[ATTR_HOST_NAME]: hostname(),
[ATTR_HOST_ARCH]: normalizeArch(arch()),
[ATTR_HOST_ID]: getMachineId(),
};
return { attributes };
}
}
export const hostDetector = new HostDetector();
//# sourceMappingURL=HostDetector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"HostDetector.js","sourceRoot":"","sources":["../../../../../src/detectors/platform/node/HostDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAOpC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC;;;GAGG;AACH,MAAM,YAAY;IAChB,MAAM,CAAC,OAAiC;QACtC,MAAM,UAAU,GAA+B;YAC7C,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE;YAC5B,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC,IAAI,EAAE,CAAC;YACvC,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE;SAC/B,CAAC;QAEF,OAAO,EAAE,UAAU,EAAE,CAAC;IACxB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ATTR_HOST_ARCH, ATTR_HOST_ID, ATTR_HOST_NAME } from '../../../semconv';\nimport { arch, hostname } from 'os';\nimport type { ResourceDetectionConfig } from '../../../config';\nimport type {\n DetectedResource,\n DetectedResourceAttributes,\n ResourceDetector,\n} from '../../../types';\nimport { getMachineId } from './machine-id/getMachineId';\nimport { normalizeArch } from './utils';\n\n/**\n * HostDetector detects the resources related to the host current process is\n * running on. Currently only non-cloud-based attributes are included.\n */\nclass HostDetector implements ResourceDetector {\n detect(_config?: ResourceDetectionConfig): DetectedResource {\n const attributes: DetectedResourceAttributes = {\n [ATTR_HOST_NAME]: hostname(),\n [ATTR_HOST_ARCH]: normalizeArch(arch()),\n [ATTR_HOST_ID]: getMachineId(),\n };\n\n return { attributes };\n }\n}\n\nexport const hostDetector = new HostDetector();\n"]}

View File

@@ -0,0 +1,12 @@
import type { ResourceDetectionConfig } from '../../../config';
import type { DetectedResource, ResourceDetector } from '../../../types';
/**
* OSDetector detects the resources related to the operating system (OS) on
* which the process represented by this resource is running.
*/
declare class OSDetector implements ResourceDetector {
detect(_config?: ResourceDetectionConfig): DetectedResource;
}
export declare const osDetector: OSDetector;
export {};
//# sourceMappingURL=OSDetector.d.ts.map

View File

@@ -0,0 +1,22 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { ATTR_OS_TYPE, ATTR_OS_VERSION } from '../../../semconv';
import { platform, release } from 'os';
import { normalizeType } from './utils';
/**
* OSDetector detects the resources related to the operating system (OS) on
* which the process represented by this resource is running.
*/
class OSDetector {
detect(_config) {
const attributes = {
[ATTR_OS_TYPE]: normalizeType(platform()),
[ATTR_OS_VERSION]: release(),
};
return { attributes };
}
}
export const osDetector = new OSDetector();
//# sourceMappingURL=OSDetector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"OSDetector.js","sourceRoot":"","sources":["../../../../../src/detectors/platform/node/OSDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAGvC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU;IACd,MAAM,CAAC,OAAiC;QACtC,MAAM,UAAU,GAAe;YAC7B,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC;YACzC,CAAC,eAAe,CAAC,EAAE,OAAO,EAAE;SAC7B,CAAC;QACF,OAAO,EAAE,UAAU,EAAE,CAAC;IACxB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes } from '@opentelemetry/api';\nimport { ATTR_OS_TYPE, ATTR_OS_VERSION } from '../../../semconv';\nimport { platform, release } from 'os';\nimport type { ResourceDetectionConfig } from '../../../config';\nimport type { DetectedResource, ResourceDetector } from '../../../types';\nimport { normalizeType } from './utils';\n\n/**\n * OSDetector detects the resources related to the operating system (OS) on\n * which the process represented by this resource is running.\n */\nclass OSDetector implements ResourceDetector {\n detect(_config?: ResourceDetectionConfig): DetectedResource {\n const attributes: Attributes = {\n [ATTR_OS_TYPE]: normalizeType(platform()),\n [ATTR_OS_VERSION]: release(),\n };\n return { attributes };\n }\n}\n\nexport const osDetector = new OSDetector();\n"]}

View File

@@ -0,0 +1,12 @@
import type { ResourceDetectionConfig } from '../../../config';
import type { DetectedResource, ResourceDetector } from '../../../types';
/**
* ProcessDetector will be used to detect the resources related current process running
* and being instrumented from the NodeJS Process module.
*/
declare class ProcessDetector implements ResourceDetector {
detect(_config?: ResourceDetectionConfig): DetectedResource;
}
export declare const processDetector: ProcessDetector;
export {};
//# sourceMappingURL=ProcessDetector.d.ts.map

View File

@@ -0,0 +1,41 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { diag } from '@opentelemetry/api';
import { ATTR_PROCESS_COMMAND, ATTR_PROCESS_COMMAND_ARGS, ATTR_PROCESS_EXECUTABLE_NAME, ATTR_PROCESS_EXECUTABLE_PATH, ATTR_PROCESS_OWNER, ATTR_PROCESS_PID, ATTR_PROCESS_RUNTIME_DESCRIPTION, ATTR_PROCESS_RUNTIME_NAME, ATTR_PROCESS_RUNTIME_VERSION, } from '../../../semconv';
import * as os from 'os';
/**
* ProcessDetector will be used to detect the resources related current process running
* and being instrumented from the NodeJS Process module.
*/
class ProcessDetector {
detect(_config) {
const attributes = {
[ATTR_PROCESS_PID]: process.pid,
[ATTR_PROCESS_EXECUTABLE_NAME]: process.title,
[ATTR_PROCESS_EXECUTABLE_PATH]: process.execPath,
[ATTR_PROCESS_COMMAND_ARGS]: [
process.argv[0],
...process.execArgv,
...process.argv.slice(1),
],
[ATTR_PROCESS_RUNTIME_VERSION]: process.versions.node,
[ATTR_PROCESS_RUNTIME_NAME]: 'nodejs',
[ATTR_PROCESS_RUNTIME_DESCRIPTION]: 'Node.js',
};
if (process.argv.length > 1) {
attributes[ATTR_PROCESS_COMMAND] = process.argv[1];
}
try {
const userInfo = os.userInfo();
attributes[ATTR_PROCESS_OWNER] = userInfo.username;
}
catch (e) {
diag.debug(`error obtaining process owner: ${e}`);
}
return { attributes };
}
}
export const processDetector = new ProcessDetector();
//# sourceMappingURL=ProcessDetector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ProcessDetector.js","sourceRoot":"","sources":["../../../../../src/detectors/platform/node/ProcessDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,4BAA4B,EAC5B,4BAA4B,EAC5B,kBAAkB,EAClB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAIzB;;;GAGG;AACH,MAAM,eAAe;IACnB,MAAM,CAAC,OAAiC;QACtC,MAAM,UAAU,GAAe;YAC7B,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,GAAG;YAC/B,CAAC,4BAA4B,CAAC,EAAE,OAAO,CAAC,KAAK;YAC7C,CAAC,4BAA4B,CAAC,EAAE,OAAO,CAAC,QAAQ;YAChD,CAAC,yBAAyB,CAAC,EAAE;gBAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;gBACf,GAAG,OAAO,CAAC,QAAQ;gBACnB,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;aACzB;YACD,CAAC,4BAA4B,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI;YACrD,CAAC,yBAAyB,CAAC,EAAE,QAAQ;YACrC,CAAC,gCAAgC,CAAC,EAAE,SAAS;SAC9C,CAAC;QAEF,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,UAAU,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACpD;QAED,IAAI;YACF,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;YAC/B,UAAU,CAAC,kBAAkB,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC;SACpD;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,KAAK,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAAC;SACnD;QAED,OAAO,EAAE,UAAU,EAAE,CAAC;IACxB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes } from '@opentelemetry/api';\nimport { diag } from '@opentelemetry/api';\nimport {\n ATTR_PROCESS_COMMAND,\n ATTR_PROCESS_COMMAND_ARGS,\n ATTR_PROCESS_EXECUTABLE_NAME,\n ATTR_PROCESS_EXECUTABLE_PATH,\n ATTR_PROCESS_OWNER,\n ATTR_PROCESS_PID,\n ATTR_PROCESS_RUNTIME_DESCRIPTION,\n ATTR_PROCESS_RUNTIME_NAME,\n ATTR_PROCESS_RUNTIME_VERSION,\n} from '../../../semconv';\nimport * as os from 'os';\nimport type { ResourceDetectionConfig } from '../../../config';\nimport type { DetectedResource, ResourceDetector } from '../../../types';\n\n/**\n * ProcessDetector will be used to detect the resources related current process running\n * and being instrumented from the NodeJS Process module.\n */\nclass ProcessDetector implements ResourceDetector {\n detect(_config?: ResourceDetectionConfig): DetectedResource {\n const attributes: Attributes = {\n [ATTR_PROCESS_PID]: process.pid,\n [ATTR_PROCESS_EXECUTABLE_NAME]: process.title,\n [ATTR_PROCESS_EXECUTABLE_PATH]: process.execPath,\n [ATTR_PROCESS_COMMAND_ARGS]: [\n process.argv[0],\n ...process.execArgv,\n ...process.argv.slice(1),\n ],\n [ATTR_PROCESS_RUNTIME_VERSION]: process.versions.node,\n [ATTR_PROCESS_RUNTIME_NAME]: 'nodejs',\n [ATTR_PROCESS_RUNTIME_DESCRIPTION]: 'Node.js',\n };\n\n if (process.argv.length > 1) {\n attributes[ATTR_PROCESS_COMMAND] = process.argv[1];\n }\n\n try {\n const userInfo = os.userInfo();\n attributes[ATTR_PROCESS_OWNER] = userInfo.username;\n } catch (e) {\n diag.debug(`error obtaining process owner: ${e}`);\n }\n\n return { attributes };\n }\n}\n\nexport const processDetector = new ProcessDetector();\n"]}

View File

@@ -0,0 +1,14 @@
import type { ResourceDetectionConfig } from '../../../config';
import type { DetectedResource, ResourceDetector } from '../../../types';
/**
* ServiceInstanceIdDetector detects the resources related to the service instance ID.
*/
declare class ServiceInstanceIdDetector implements ResourceDetector {
detect(_config?: ResourceDetectionConfig): DetectedResource;
}
/**
* @experimental
*/
export declare const serviceInstanceIdDetector: ServiceInstanceIdDetector;
export {};
//# sourceMappingURL=ServiceInstanceIdDetector.d.ts.map

View File

@@ -0,0 +1,23 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { ATTR_SERVICE_INSTANCE_ID } from '../../../semconv';
import { randomUUID } from 'crypto';
/**
* ServiceInstanceIdDetector detects the resources related to the service instance ID.
*/
class ServiceInstanceIdDetector {
detect(_config) {
return {
attributes: {
[ATTR_SERVICE_INSTANCE_ID]: randomUUID(),
},
};
}
}
/**
* @experimental
*/
export const serviceInstanceIdDetector = new ServiceInstanceIdDetector();
//# sourceMappingURL=ServiceInstanceIdDetector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ServiceInstanceIdDetector.js","sourceRoot":"","sources":["../../../../../src/detectors/platform/node/ServiceInstanceIdDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAIpC;;GAEG;AACH,MAAM,yBAAyB;IAC7B,MAAM,CAAC,OAAiC;QACtC,OAAO;YACL,UAAU,EAAE;gBACV,CAAC,wBAAwB,CAAC,EAAE,UAAU,EAAE;aACzC;SACF,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,yBAAyB,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ATTR_SERVICE_INSTANCE_ID } from '../../../semconv';\nimport { randomUUID } from 'crypto';\nimport type { ResourceDetectionConfig } from '../../../config';\nimport type { DetectedResource, ResourceDetector } from '../../../types';\n\n/**\n * ServiceInstanceIdDetector detects the resources related to the service instance ID.\n */\nclass ServiceInstanceIdDetector implements ResourceDetector {\n detect(_config?: ResourceDetectionConfig): DetectedResource {\n return {\n attributes: {\n [ATTR_SERVICE_INSTANCE_ID]: randomUUID(),\n },\n };\n }\n}\n\n/**\n * @experimental\n */\nexport const serviceInstanceIdDetector = new ServiceInstanceIdDetector();\n"]}

View File

@@ -0,0 +1,5 @@
export { hostDetector } from './HostDetector';
export { osDetector } from './OSDetector';
export { processDetector } from './ProcessDetector';
export { serviceInstanceIdDetector } from './ServiceInstanceIdDetector';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,9 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
export { hostDetector } from './HostDetector';
export { osDetector } from './OSDetector';
export { processDetector } from './ProcessDetector';
export { serviceInstanceIdDetector } from './ServiceInstanceIdDetector';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/detectors/platform/node/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { hostDetector } from './HostDetector';\nexport { osDetector } from './OSDetector';\nexport { processDetector } from './ProcessDetector';\nexport { serviceInstanceIdDetector } from './ServiceInstanceIdDetector';\n"]}

View File

@@ -0,0 +1,4 @@
/// <reference types="node" />
import * as child_process from 'child_process';
export declare const execAsync: typeof child_process.exec.__promisify__;
//# sourceMappingURL=execAsync.d.ts.map

View File

@@ -0,0 +1,8 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import * as child_process from 'child_process';
import * as util from 'util';
export const execAsync = util.promisify(child_process.exec);
//# sourceMappingURL=execAsync.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"execAsync.js","sourceRoot":"","sources":["../../../../../../src/detectors/platform/node/machine-id/execAsync.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,aAAa,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as child_process from 'child_process';\nimport * as util from 'util';\n\nexport const execAsync = util.promisify(child_process.exec);\n"]}

View File

@@ -0,0 +1,2 @@
export declare function getMachineId(): Promise<string | undefined>;
//# sourceMappingURL=getMachineId-bsd.d.ts.map

View File

@@ -0,0 +1,25 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { promises as fs } from 'fs';
import { execAsync } from './execAsync';
import { diag } from '@opentelemetry/api';
export async function getMachineId() {
try {
const result = await fs.readFile('/etc/hostid', { encoding: 'utf8' });
return result.trim();
}
catch (e) {
diag.debug(`error reading machine id: ${e}`);
}
try {
const result = await execAsync('kenv -q smbios.system.uuid');
return result.stdout.trim();
}
catch (e) {
diag.debug(`error reading machine id: ${e}`);
}
return undefined;
}
//# sourceMappingURL=getMachineId-bsd.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getMachineId-bsd.js","sourceRoot":"","sources":["../../../../../../src/detectors/platform/node/machine-id/getMachineId-bsd.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QACtE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;KACtB;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC;KAC9C;IAED,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,4BAA4B,CAAC,CAAC;QAC7D,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;KAC7B;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC;KAC9C;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { promises as fs } from 'fs';\nimport { execAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n try {\n const result = await fs.readFile('/etc/hostid', { encoding: 'utf8' });\n return result.trim();\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n try {\n const result = await execAsync('kenv -q smbios.system.uuid');\n return result.stdout.trim();\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n return undefined;\n}\n"]}

View File

@@ -0,0 +1,2 @@
export declare function getMachineId(): Promise<string | undefined>;
//# sourceMappingURL=getMachineId-darwin.d.ts.map

View File

@@ -0,0 +1,26 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { execAsync } from './execAsync';
import { diag } from '@opentelemetry/api';
export async function getMachineId() {
try {
const result = await execAsync('ioreg -rd1 -c "IOPlatformExpertDevice"');
const idLine = result.stdout
.split('\n')
.find(line => line.includes('IOPlatformUUID'));
if (!idLine) {
return undefined;
}
const parts = idLine.split('" = "');
if (parts.length === 2) {
return parts[1].slice(0, -1);
}
}
catch (e) {
diag.debug(`error reading machine id: ${e}`);
}
return undefined;
}
//# sourceMappingURL=getMachineId-darwin.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getMachineId-darwin.js","sourceRoot":"","sources":["../../../../../../src/detectors/platform/node/machine-id/getMachineId-darwin.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,wCAAwC,CAAC,CAAC;QAEzE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM;aACzB,KAAK,CAAC,IAAI,CAAC;aACX,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAEjD,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,SAAS,CAAC;SAClB;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SAC9B;KACF;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC;KAC9C;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { execAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n try {\n const result = await execAsync('ioreg -rd1 -c \"IOPlatformExpertDevice\"');\n\n const idLine = result.stdout\n .split('\\n')\n .find(line => line.includes('IOPlatformUUID'));\n\n if (!idLine) {\n return undefined;\n }\n\n const parts = idLine.split('\" = \"');\n if (parts.length === 2) {\n return parts[1].slice(0, -1);\n }\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n return undefined;\n}\n"]}

View File

@@ -0,0 +1,2 @@
export declare function getMachineId(): Promise<string | undefined>;
//# sourceMappingURL=getMachineId-linux.d.ts.map

View File

@@ -0,0 +1,20 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { promises as fs } from 'fs';
import { diag } from '@opentelemetry/api';
export async function getMachineId() {
const paths = ['/etc/machine-id', '/var/lib/dbus/machine-id'];
for (const path of paths) {
try {
const result = await fs.readFile(path, { encoding: 'utf8' });
return result.trim();
}
catch (e) {
diag.debug(`error reading machine id: ${e}`);
}
}
return undefined;
}
//# sourceMappingURL=getMachineId-linux.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getMachineId-linux.js","sourceRoot":"","sources":["../../../../../../src/detectors/platform/node/machine-id/getMachineId-linux.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,MAAM,KAAK,GAAG,CAAC,iBAAiB,EAAE,0BAA0B,CAAC,CAAC;IAE9D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;YAC7D,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;SACtB;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC;SAC9C;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { promises as fs } from 'fs';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n const paths = ['/etc/machine-id', '/var/lib/dbus/machine-id'];\n\n for (const path of paths) {\n try {\n const result = await fs.readFile(path, { encoding: 'utf8' });\n return result.trim();\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n }\n\n return undefined;\n}\n"]}

View File

@@ -0,0 +1,2 @@
export declare function getMachineId(): Promise<string | undefined>;
//# sourceMappingURL=getMachineId-unsupported.d.ts.map

View File

@@ -0,0 +1,10 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { diag } from '@opentelemetry/api';
export async function getMachineId() {
diag.debug('could not read machine-id: unsupported platform');
return undefined;
}
//# sourceMappingURL=getMachineId-unsupported.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getMachineId-unsupported.js","sourceRoot":"","sources":["../../../../../../src/detectors/platform/node/machine-id/getMachineId-unsupported.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,IAAI,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC9D,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n diag.debug('could not read machine-id: unsupported platform');\n return undefined;\n}\n"]}

View File

@@ -0,0 +1,2 @@
export declare function getMachineId(): Promise<string | undefined>;
//# sourceMappingURL=getMachineId-win.d.ts.map

View File

@@ -0,0 +1,26 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import * as process from 'process';
import { execAsync } from './execAsync';
import { diag } from '@opentelemetry/api';
export async function getMachineId() {
const args = 'QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid';
let command = '%windir%\\System32\\REG.exe';
if (process.arch === 'ia32' && 'PROCESSOR_ARCHITEW6432' in process.env) {
command = '%windir%\\sysnative\\cmd.exe /c ' + command;
}
try {
const result = await execAsync(`${command} ${args}`);
const parts = result.stdout.split('REG_SZ');
if (parts.length === 2) {
return parts[1].trim();
}
}
catch (e) {
diag.debug(`error reading machine id: ${e}`);
}
return undefined;
}
//# sourceMappingURL=getMachineId-win.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getMachineId-win.js","sourceRoot":"","sources":["../../../../../../src/detectors/platform/node/machine-id/getMachineId-win.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,MAAM,IAAI,GACR,4EAA4E,CAAC;IAC/E,IAAI,OAAO,GAAG,6BAA6B,CAAC;IAC5C,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,IAAI,wBAAwB,IAAI,OAAO,CAAC,GAAG,EAAE;QACtE,OAAO,GAAG,kCAAkC,GAAG,OAAO,CAAC;KACxD;IAED,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,GAAG,OAAO,IAAI,IAAI,EAAE,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACxB;KACF;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC;KAC9C;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as process from 'process';\nimport { execAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nexport async function getMachineId(): Promise<string | undefined> {\n const args =\n 'QUERY HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Cryptography /v MachineGuid';\n let command = '%windir%\\\\System32\\\\REG.exe';\n if (process.arch === 'ia32' && 'PROCESSOR_ARCHITEW6432' in process.env) {\n command = '%windir%\\\\sysnative\\\\cmd.exe /c ' + command;\n }\n\n try {\n const result = await execAsync(`${command} ${args}`);\n const parts = result.stdout.split('REG_SZ');\n if (parts.length === 2) {\n return parts[1].trim();\n }\n } catch (e) {\n diag.debug(`error reading machine id: ${e}`);\n }\n\n return undefined;\n}\n"]}

View File

@@ -0,0 +1,2 @@
export declare function getMachineId(): Promise<string | undefined>;
//# sourceMappingURL=getMachineId.d.ts.map

View File

@@ -0,0 +1,32 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
import * as process from 'process';
let getMachineIdImpl;
export async function getMachineId() {
if (!getMachineIdImpl) {
switch (process.platform) {
case 'darwin':
getMachineIdImpl = (await import('./getMachineId-darwin.js'))
.getMachineId;
break;
case 'linux':
getMachineIdImpl = (await import('./getMachineId-linux.js'))
.getMachineId;
break;
case 'freebsd':
getMachineIdImpl = (await import('./getMachineId-bsd.js')).getMachineId;
break;
case 'win32':
getMachineIdImpl = (await import('./getMachineId-win.js')).getMachineId;
break;
default:
getMachineIdImpl = (await import('./getMachineId-unsupported.js'))
.getMachineId;
break;
}
}
return getMachineIdImpl();
}
//# sourceMappingURL=getMachineId.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getMachineId.js","sourceRoot":"","sources":["../../../../../../src/detectors/platform/node/machine-id/getMachineId.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,IAAI,gBAAiE,CAAC;AAEtE,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,IAAI,CAAC,gBAAgB,EAAE;QACrB,QAAQ,OAAO,CAAC,QAAQ,EAAE;YACxB,KAAK,QAAQ;gBACX,gBAAgB,GAAG,CAAC,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC;qBAC1D,YAAY,CAAC;gBAChB,MAAM;YACR,KAAK,OAAO;gBACV,gBAAgB,GAAG,CAAC,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC;qBACzD,YAAY,CAAC;gBAChB,MAAM;YACR,KAAK,SAAS;gBACZ,gBAAgB,GAAG,CAAC,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC,YAAY,CAAC;gBACxE,MAAM;YACR,KAAK,OAAO;gBACV,gBAAgB,GAAG,CAAC,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC,YAAY,CAAC;gBACxE,MAAM;YACR;gBACE,gBAAgB,GAAG,CAAC,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC;qBAC/D,YAAY,CAAC;gBAChB,MAAM;SACT;KACF;IAED,OAAO,gBAAgB,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport * as process from 'process';\n\nlet getMachineIdImpl: undefined | (() => Promise<string | undefined>);\n\nexport async function getMachineId(): Promise<string | undefined> {\n if (!getMachineIdImpl) {\n switch (process.platform) {\n case 'darwin':\n getMachineIdImpl = (await import('./getMachineId-darwin.js'))\n .getMachineId;\n break;\n case 'linux':\n getMachineIdImpl = (await import('./getMachineId-linux.js'))\n .getMachineId;\n break;\n case 'freebsd':\n getMachineIdImpl = (await import('./getMachineId-bsd.js')).getMachineId;\n break;\n case 'win32':\n getMachineIdImpl = (await import('./getMachineId-win.js')).getMachineId;\n break;\n default:\n getMachineIdImpl = (await import('./getMachineId-unsupported.js'))\n .getMachineId;\n break;\n }\n }\n\n return getMachineIdImpl();\n}\n"]}

View File

@@ -0,0 +1,3 @@
export declare const normalizeArch: (nodeArchString: string) => string;
export declare const normalizeType: (nodePlatform: string) => string;
//# sourceMappingURL=utils.d.ts.map

View File

@@ -0,0 +1,31 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
export const normalizeArch = (nodeArchString) => {
// Maps from https://nodejs.org/api/os.html#osarch to arch values in spec:
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/host.md
switch (nodeArchString) {
case 'arm':
return 'arm32';
case 'ppc':
return 'ppc32';
case 'x64':
return 'amd64';
default:
return nodeArchString;
}
};
export const normalizeType = (nodePlatform) => {
// Maps from https://nodejs.org/api/os.html#osplatform to arch values in spec:
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/os.md
switch (nodePlatform) {
case 'sunos':
return 'solaris';
case 'win32':
return 'windows';
default:
return nodePlatform;
}
};
//# sourceMappingURL=utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/detectors/platform/node/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,cAAsB,EAAU,EAAE;IAC9D,0EAA0E;IAC1E,8HAA8H;IAC9H,QAAQ,cAAc,EAAE;QACtB,KAAK,KAAK;YACR,OAAO,OAAO,CAAC;QACjB,KAAK,KAAK;YACR,OAAO,OAAO,CAAC;QACjB,KAAK,KAAK;YACR,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,cAAc,CAAC;KACzB;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,YAAoB,EAAU,EAAE;IAC5D,8EAA8E;IAC9E,4HAA4H;IAC5H,QAAQ,YAAY,EAAE;QACpB,KAAK,OAAO;YACV,OAAO,SAAS,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,YAAY,CAAC;KACvB;AACH,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport const normalizeArch = (nodeArchString: string): string => {\n // Maps from https://nodejs.org/api/os.html#osarch to arch values in spec:\n // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/host.md\n switch (nodeArchString) {\n case 'arm':\n return 'arm32';\n case 'ppc':\n return 'ppc32';\n case 'x64':\n return 'amd64';\n default:\n return nodeArchString;\n }\n};\n\nexport const normalizeType = (nodePlatform: string): string => {\n // Maps from https://nodejs.org/api/os.html#osplatform to arch values in spec:\n // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/os.md\n switch (nodePlatform) {\n case 'sunos':\n return 'solaris';\n case 'win32':\n return 'windows';\n default:\n return nodePlatform;\n }\n};\n"]}

View File

@@ -0,0 +1,8 @@
export type { ResourceDetectionConfig } from './config';
export { detectResources } from './detect-resources';
export { envDetector, hostDetector, osDetector, processDetector, serviceInstanceIdDetector, } from './detectors';
export type { Resource } from './Resource';
export { resourceFromAttributes, defaultResource, emptyResource, } from './ResourceImpl';
export { defaultServiceName } from './default-service-name';
export type { ResourceDetector, DetectedResource, DetectedResourceAttributes, RawResourceAttribute, MaybePromise, } from './types';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,9 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
export { detectResources } from './detect-resources';
export { envDetector, hostDetector, osDetector, processDetector, serviceInstanceIdDetector, } from './detectors';
export { resourceFromAttributes, defaultResource, emptyResource, } from './ResourceImpl';
export { defaultServiceName } from './default-service-name';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,eAAe,EACf,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport type { ResourceDetectionConfig } from './config';\nexport { detectResources } from './detect-resources';\nexport {\n envDetector,\n hostDetector,\n osDetector,\n processDetector,\n serviceInstanceIdDetector,\n} from './detectors';\nexport type { Resource } from './Resource';\nexport {\n resourceFromAttributes,\n defaultResource,\n emptyResource,\n} from './ResourceImpl';\nexport { defaultServiceName } from './default-service-name';\nexport type {\n ResourceDetector,\n DetectedResource,\n DetectedResourceAttributes,\n RawResourceAttribute,\n MaybePromise,\n} from './types';\n"]}

View File

@@ -0,0 +1,312 @@
/**
* The cloud account ID the resource is assigned to.
*
* @example 111111111111
* @example opentelemetry
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_CLOUD_ACCOUNT_ID: "cloud.account.id";
/**
* Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.
*
* @example us-east-1c
*
* @note Availability zones are called "zones" on Alibaba Cloud and Google Cloud.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_CLOUD_AVAILABILITY_ZONE: "cloud.availability_zone";
/**
* Name of the cloud provider.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_CLOUD_PROVIDER: "cloud.provider";
/**
* The geographical region the resource is running.
*
* @example us-central1
* @example us-east-1
*
* @note Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091).
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_CLOUD_REGION: "cloud.region";
/**
* Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/containers/run/#container-identification). The UUID might be abbreviated.
*
* @example a3bf90e006b2
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_CONTAINER_ID: "container.id";
/**
* Name of the image the container was built on.
*
* @example gcr.io/opentelemetry/operator
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_CONTAINER_IMAGE_NAME: "container.image.name";
/**
* Container image tags. An example can be found in [Docker Image Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). Should be only the `<tag>` section of the full name for example from `registry.example.com/my-org/my-image:<tag>`.
*
* @example ["v1.27.1", "3.5.7-0"]
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_CONTAINER_IMAGE_TAGS: "container.image.tags";
/**
* Container name used by container runtime.
*
* @example opentelemetry-autoconf
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_CONTAINER_NAME: "container.name";
/**
* The CPU architecture the host system is running on.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_HOST_ARCH: "host.arch";
/**
* 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.
*
* @example fdbf79e8af94cb7f9e8df36789187052
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_HOST_ID: "host.id";
/**
* VM image ID or host OS image ID. For Cloud, this value is from the provider.
*
* @example ami-07b06b442921831e5
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_HOST_IMAGE_ID: "host.image.id";
/**
* Name of the VM image or OS install the host was instantiated from.
*
* @example infra-ami-eks-worker-node-7d4ec78312
* @example CentOS-8-x86_64-1905
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_HOST_IMAGE_NAME: "host.image.name";
/**
* The version string of the VM image or host OS as defined in [Version Attributes](/docs/resource/README.md#version-attributes).
*
* @example 0.1
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_HOST_IMAGE_VERSION: "host.image.version";
/**
* 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.
*
* @example opentelemetry-test
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_HOST_NAME: "host.name";
/**
* Type of host. For Cloud, this must be the machine type.
*
* @example n1-standard-1
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_HOST_TYPE: "host.type";
/**
* The name of the cluster.
*
* @example opentelemetry-cluster
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_K8S_CLUSTER_NAME: "k8s.cluster.name";
/**
* The name of the Deployment.
*
* @example opentelemetry
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_K8S_DEPLOYMENT_NAME: "k8s.deployment.name";
/**
* The name of the namespace that the pod is running in.
*
* @example default
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_K8S_NAMESPACE_NAME: "k8s.namespace.name";
/**
* The name of the Pod.
*
* @example opentelemetry-pod-autoconf
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_K8S_POD_NAME: "k8s.pod.name";
/**
* The operating system type.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_OS_TYPE: "os.type";
/**
* The version string of the operating system as defined in [Version Attributes](/docs/resource/README.md#version-attributes).
*
* @example 14.2.1
* @example 18.04.1
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_OS_VERSION: "os.version";
/**
* 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`.
*
* @example cmd/otelcol
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_PROCESS_COMMAND: "process.command";
/**
* 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`.
*
* @example ["cmd/otecol", "--config=config.yaml"]
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_PROCESS_COMMAND_ARGS: "process.command_args";
/**
* 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`.
*
* @example otelcol
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_PROCESS_EXECUTABLE_NAME: "process.executable.name";
/**
* 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`.
*
* @example /usr/bin/cmd/otelcol
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_PROCESS_EXECUTABLE_PATH: "process.executable.path";
/**
* The username of the user that owns the process.
*
* @example root
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_PROCESS_OWNER: "process.owner";
/**
* Process identifier (PID).
*
* @example 1234
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_PROCESS_PID: "process.pid";
/**
* An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment.
*
* @example "Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0"
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_PROCESS_RUNTIME_DESCRIPTION: "process.runtime.description";
/**
* The name of the runtime of this process.
*
* @example OpenJDK Runtime Environment
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_PROCESS_RUNTIME_NAME: "process.runtime.name";
/**
* The version of the runtime of this process, as returned by the runtime without modification.
*
* @example "14.0.2"
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_PROCESS_RUNTIME_VERSION: "process.runtime.version";
/**
* The string ID of the service instance.
*
* @example 627cc493-f310-47de-96bd-71410b7dec09
*
* @note **MUST** be unique for each instance of the same `service.namespace,service.name` pair (in other words
* `service.namespace,service.name,service.instance.id` triplet **MUST** be globally unique). The ID helps to
* distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled
* service).
*
* Implementations, such as SDKs, are recommended to generate a random Version 1 or Version 4 [RFC
* 4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an inherent unique ID as the source of
* this value if stability is desirable. In that case, the ID **SHOULD** be used as source of a UUID Version 5 and
* **SHOULD** use the following UUID as the namespace: `4d63009a-8d0f-11ee-aad7-4c796ed8e320`.
*
* UUIDs are typically recommended, as only an opaque value for the purposes of identifying a service instance is
* needed. Similar to what can be seen in the man page for the
* [`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/latest/machine-id.html) file, the underlying
* data, such as pod name and namespace should be treated as confidential, being the user's choice to expose it
* or not via another resource attribute.
*
* For applications running behind an application server (like unicorn), we do not recommend using one identifier
* for all processes participating in the application. Instead, it's recommended each division (e.g. a worker
* thread in unicorn) to have its own instance.id.
*
* It's not recommended for a Collector to set `service.instance.id` if it can't unambiguously determine the
* service instance that is generating that telemetry. For instance, creating an UUID based on `pod.name` will
* likely be wrong, as the Collector might not know from which container within that pod the telemetry originated.
* However, Collectors can set the `service.instance.id` if they can unambiguously determine the service instance
* for that telemetry. This is typically the case for scraping receivers, as they know the target address and
* port.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_SERVICE_INSTANCE_ID: "service.instance.id";
/**
* A namespace for `service.name`.
*
* @example Shop
*
* @note A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_SERVICE_NAMESPACE: "service.namespace";
/**
* Additional description of the web engine (e.g. detailed version and edition information).
*
* @example WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_WEBENGINE_DESCRIPTION: "webengine.description";
/**
* The name of the web engine.
*
* @example WildFly
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_WEBENGINE_NAME: "webengine.name";
/**
* The version of the web engine.
*
* @example 21.0.0
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export declare const ATTR_WEBENGINE_VERSION: "webengine.version";
//# sourceMappingURL=semconv.d.ts.map

View File

@@ -0,0 +1,321 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
/*
* This file contains a copy of unstable semantic convention definitions
* used by this package.
* @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
*/
/**
* The cloud account ID the resource is assigned to.
*
* @example 111111111111
* @example opentelemetry
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_CLOUD_ACCOUNT_ID = 'cloud.account.id';
/**
* Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.
*
* @example us-east-1c
*
* @note Availability zones are called "zones" on Alibaba Cloud and Google Cloud.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_CLOUD_AVAILABILITY_ZONE = 'cloud.availability_zone';
/**
* Name of the cloud provider.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_CLOUD_PROVIDER = 'cloud.provider';
/**
* The geographical region the resource is running.
*
* @example us-central1
* @example us-east-1
*
* @note Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091).
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_CLOUD_REGION = 'cloud.region';
/**
* Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/containers/run/#container-identification). The UUID might be abbreviated.
*
* @example a3bf90e006b2
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_CONTAINER_ID = 'container.id';
/**
* Name of the image the container was built on.
*
* @example gcr.io/opentelemetry/operator
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_CONTAINER_IMAGE_NAME = 'container.image.name';
/**
* Container image tags. An example can be found in [Docker Image Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). Should be only the `<tag>` section of the full name for example from `registry.example.com/my-org/my-image:<tag>`.
*
* @example ["v1.27.1", "3.5.7-0"]
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_CONTAINER_IMAGE_TAGS = 'container.image.tags';
/**
* Container name used by container runtime.
*
* @example opentelemetry-autoconf
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_CONTAINER_NAME = 'container.name';
/**
* The CPU architecture the host system is running on.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_HOST_ARCH = 'host.arch';
/**
* 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.
*
* @example fdbf79e8af94cb7f9e8df36789187052
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_HOST_ID = 'host.id';
/**
* VM image ID or host OS image ID. For Cloud, this value is from the provider.
*
* @example ami-07b06b442921831e5
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_HOST_IMAGE_ID = 'host.image.id';
/**
* Name of the VM image or OS install the host was instantiated from.
*
* @example infra-ami-eks-worker-node-7d4ec78312
* @example CentOS-8-x86_64-1905
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_HOST_IMAGE_NAME = 'host.image.name';
/**
* The version string of the VM image or host OS as defined in [Version Attributes](/docs/resource/README.md#version-attributes).
*
* @example 0.1
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_HOST_IMAGE_VERSION = 'host.image.version';
/**
* 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.
*
* @example opentelemetry-test
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_HOST_NAME = 'host.name';
/**
* Type of host. For Cloud, this must be the machine type.
*
* @example n1-standard-1
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_HOST_TYPE = 'host.type';
/**
* The name of the cluster.
*
* @example opentelemetry-cluster
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_K8S_CLUSTER_NAME = 'k8s.cluster.name';
/**
* The name of the Deployment.
*
* @example opentelemetry
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_K8S_DEPLOYMENT_NAME = 'k8s.deployment.name';
/**
* The name of the namespace that the pod is running in.
*
* @example default
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_K8S_NAMESPACE_NAME = 'k8s.namespace.name';
/**
* The name of the Pod.
*
* @example opentelemetry-pod-autoconf
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_K8S_POD_NAME = 'k8s.pod.name';
/**
* The operating system type.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_OS_TYPE = 'os.type';
/**
* The version string of the operating system as defined in [Version Attributes](/docs/resource/README.md#version-attributes).
*
* @example 14.2.1
* @example 18.04.1
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_OS_VERSION = 'os.version';
/**
* 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`.
*
* @example cmd/otelcol
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_PROCESS_COMMAND = 'process.command';
/**
* 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`.
*
* @example ["cmd/otecol", "--config=config.yaml"]
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_PROCESS_COMMAND_ARGS = 'process.command_args';
/**
* 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`.
*
* @example otelcol
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_PROCESS_EXECUTABLE_NAME = 'process.executable.name';
/**
* 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`.
*
* @example /usr/bin/cmd/otelcol
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_PROCESS_EXECUTABLE_PATH = 'process.executable.path';
/**
* The username of the user that owns the process.
*
* @example root
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_PROCESS_OWNER = 'process.owner';
/**
* Process identifier (PID).
*
* @example 1234
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_PROCESS_PID = 'process.pid';
/**
* An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment.
*
* @example "Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0"
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_PROCESS_RUNTIME_DESCRIPTION = 'process.runtime.description';
/**
* The name of the runtime of this process.
*
* @example OpenJDK Runtime Environment
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_PROCESS_RUNTIME_NAME = 'process.runtime.name';
/**
* The version of the runtime of this process, as returned by the runtime without modification.
*
* @example "14.0.2"
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_PROCESS_RUNTIME_VERSION = 'process.runtime.version';
/**
* The string ID of the service instance.
*
* @example 627cc493-f310-47de-96bd-71410b7dec09
*
* @note **MUST** be unique for each instance of the same `service.namespace,service.name` pair (in other words
* `service.namespace,service.name,service.instance.id` triplet **MUST** be globally unique). The ID helps to
* distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled
* service).
*
* Implementations, such as SDKs, are recommended to generate a random Version 1 or Version 4 [RFC
* 4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an inherent unique ID as the source of
* this value if stability is desirable. In that case, the ID **SHOULD** be used as source of a UUID Version 5 and
* **SHOULD** use the following UUID as the namespace: `4d63009a-8d0f-11ee-aad7-4c796ed8e320`.
*
* UUIDs are typically recommended, as only an opaque value for the purposes of identifying a service instance is
* needed. Similar to what can be seen in the man page for the
* [`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/latest/machine-id.html) file, the underlying
* data, such as pod name and namespace should be treated as confidential, being the user's choice to expose it
* or not via another resource attribute.
*
* For applications running behind an application server (like unicorn), we do not recommend using one identifier
* for all processes participating in the application. Instead, it's recommended each division (e.g. a worker
* thread in unicorn) to have its own instance.id.
*
* It's not recommended for a Collector to set `service.instance.id` if it can't unambiguously determine the
* service instance that is generating that telemetry. For instance, creating an UUID based on `pod.name` will
* likely be wrong, as the Collector might not know from which container within that pod the telemetry originated.
* However, Collectors can set the `service.instance.id` if they can unambiguously determine the service instance
* for that telemetry. This is typically the case for scraping receivers, as they know the target address and
* port.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_SERVICE_INSTANCE_ID = 'service.instance.id';
/**
* A namespace for `service.name`.
*
* @example Shop
*
* @note A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace.
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_SERVICE_NAMESPACE = 'service.namespace';
/**
* Additional description of the web engine (e.g. detailed version and edition information).
*
* @example WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_WEBENGINE_DESCRIPTION = 'webengine.description';
/**
* The name of the web engine.
*
* @example WildFly
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_WEBENGINE_NAME = 'webengine.name';
/**
* The version of the web engine.
*
* @example 21.0.0
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_WEBENGINE_VERSION = 'webengine.version';
//# sourceMappingURL=semconv.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,44 @@
import type { AttributeValue } from '@opentelemetry/api';
import type { ResourceDetectionConfig } from './config';
/**
* Interface for a Resource Detector.
* A resource detector returns a set of detected resource attributes.
* A detected resource attribute may be an {@link AttributeValue} or a Promise of an AttributeValue.
*/
export interface ResourceDetector {
/**
* Detect resource attributes.
*
* @returns a {@link DetectedResource} object containing detected resource attributes
*/
detect(config?: ResourceDetectionConfig): DetectedResource;
}
export type DetectedResource = {
/**
* Detected resource attributes.
*/
attributes?: DetectedResourceAttributes;
};
/**
* An object representing detected resource attributes.
* Value may be {@link AttributeValue}s, a promise to an {@link AttributeValue}, or undefined.
*/
type DetectedResourceAttributeValue = MaybePromise<AttributeValue | undefined>;
/**
* An object representing detected resource attributes.
* Values may be {@link AttributeValue}s or a promise to an {@link AttributeValue}.
*/
export type DetectedResourceAttributes = Record<string, DetectedResourceAttributeValue>;
export type MaybePromise<T> = T | Promise<T>;
export type RawResourceAttribute = [
string,
MaybePromise<AttributeValue | undefined>
];
/**
* Options for creating a {@link Resource}.
*/
export type ResourceOptions = {
schemaUrl?: string;
};
export {};
//# sourceMappingURL=types.d.ts.map

View File

@@ -0,0 +1,6 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
export {};
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { AttributeValue } from '@opentelemetry/api';\nimport type { ResourceDetectionConfig } from './config';\n\n/**\n * Interface for a Resource Detector.\n * A resource detector returns a set of detected resource attributes.\n * A detected resource attribute may be an {@link AttributeValue} or a Promise of an AttributeValue.\n */\nexport interface ResourceDetector {\n /**\n * Detect resource attributes.\n *\n * @returns a {@link DetectedResource} object containing detected resource attributes\n */\n detect(config?: ResourceDetectionConfig): DetectedResource;\n}\n\nexport type DetectedResource = {\n /**\n * Detected resource attributes.\n */\n attributes?: DetectedResourceAttributes;\n};\n\n/**\n * An object representing detected resource attributes.\n * Value may be {@link AttributeValue}s, a promise to an {@link AttributeValue}, or undefined.\n */\ntype DetectedResourceAttributeValue = MaybePromise<AttributeValue | undefined>;\n\n/**\n * An object representing detected resource attributes.\n * Values may be {@link AttributeValue}s or a promise to an {@link AttributeValue}.\n */\nexport type DetectedResourceAttributes = Record<\n string,\n DetectedResourceAttributeValue\n>;\n\nexport type MaybePromise<T> = T | Promise<T>;\n\nexport type RawResourceAttribute = [\n string,\n MaybePromise<AttributeValue | undefined>,\n];\n\n/**\n * Options for creating a {@link Resource}.\n */\nexport type ResourceOptions = {\n schemaUrl?: string;\n};\n"]}

View File

@@ -0,0 +1,2 @@
export declare const isPromiseLike: <R>(val: unknown) => val is PromiseLike<R>;
//# sourceMappingURL=utils.d.ts.map

View File

@@ -0,0 +1,10 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
export const isPromiseLike = (val) => {
return (val !== null &&
typeof val === 'object' &&
typeof val.then === 'function');
};
//# sourceMappingURL=utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAI,GAAY,EAAyB,EAAE;IACtE,OAAO,CACL,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAQ,GAA+B,CAAC,IAAI,KAAK,UAAU,CAC5D,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const isPromiseLike = <R>(val: unknown): val is PromiseLike<R> => {\n return (\n val !== null &&\n typeof val === 'object' &&\n typeof (val as Partial<PromiseLike<R>>).then === 'function'\n );\n};\n"]}

View File

@@ -0,0 +1,2 @@
export declare const VERSION = "2.6.1";
//# sourceMappingURL=version.d.ts.map

View File

@@ -0,0 +1,7 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
// this is autogenerated file, see scripts/version-update.js
export const VERSION = '2.6.1';
//# sourceMappingURL=version.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '2.6.1';\n"]}

View File

@@ -0,0 +1,46 @@
import type { Attributes } from '@opentelemetry/api';
import type { RawResourceAttribute } from './types';
/**
* An interface that represents a resource. A Resource describes the entity for which signals (metrics or trace) are
* collected.
*
* This interface is NOT user-implementable. Valid ways to obtain a {@link Resource} are by using either of these functions
* - {@link resourceFromAttributes}
* - {@link emptyResource}
* - {@link defaultResource}
* - {@link detectResources}
*/
export interface Resource {
/**
* Check if async attributes have resolved. This is useful to avoid awaiting
* waitForAsyncAttributes (which will introduce asynchronous behavior) when not necessary.
*
* @returns true if the resource "attributes" property is not yet settled to its final value
*/
readonly asyncAttributesPending?: boolean;
/**
* @returns the Resource's attributes.
*/
readonly attributes: Attributes;
/**
* @returns the Resource's schema URL or undefined if not set.
*/
readonly schemaUrl?: string;
/**
* Returns a promise that will never be rejected. Resolves when all async attributes have finished being added to
* this Resource's attributes. This is useful in exporters to block until resource detection
* has finished.
*/
waitForAsyncAttributes?(): Promise<void>;
/**
* Returns a new, merged {@link Resource} by merging the current Resource
* with the other Resource. In case of a collision, other Resource takes
* precedence.
*
* @param other the Resource that will be merged with this.
* @returns the newly merged Resource.
*/
merge(other: Resource | null): Resource;
getRawAttributes(): RawResourceAttribute[];
}
//# sourceMappingURL=Resource.d.ts.map

View File

@@ -0,0 +1,6 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
export {};
//# sourceMappingURL=Resource.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../../src/Resource.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes } from '@opentelemetry/api';\nimport type { RawResourceAttribute } from './types';\n\n/**\n * An interface that represents a resource. A Resource describes the entity for which signals (metrics or trace) are\n * collected.\n *\n * This interface is NOT user-implementable. Valid ways to obtain a {@link Resource} are by using either of these functions\n * - {@link resourceFromAttributes}\n * - {@link emptyResource}\n * - {@link defaultResource}\n * - {@link detectResources}\n */\nexport interface Resource {\n /**\n * Check if async attributes have resolved. This is useful to avoid awaiting\n * waitForAsyncAttributes (which will introduce asynchronous behavior) when not necessary.\n *\n * @returns true if the resource \"attributes\" property is not yet settled to its final value\n */\n readonly asyncAttributesPending?: boolean;\n\n /**\n * @returns the Resource's attributes.\n */\n readonly attributes: Attributes;\n\n /**\n * @returns the Resource's schema URL or undefined if not set.\n */\n readonly schemaUrl?: string;\n\n /**\n * Returns a promise that will never be rejected. Resolves when all async attributes have finished being added to\n * this Resource's attributes. This is useful in exporters to block until resource detection\n * has finished.\n */\n waitForAsyncAttributes?(): Promise<void>;\n\n /**\n * Returns a new, merged {@link Resource} by merging the current Resource\n * with the other Resource. In case of a collision, other Resource takes\n * precedence.\n *\n * @param other the Resource that will be merged with this.\n * @returns the newly merged Resource.\n */\n merge(other: Resource | null): Resource;\n\n getRawAttributes(): RawResourceAttribute[];\n}\n"]}

View File

@@ -0,0 +1,7 @@
import type { Resource } from './Resource';
import type { DetectedResource, DetectedResourceAttributes, ResourceOptions } from './types';
export declare function resourceFromAttributes(attributes: DetectedResourceAttributes, options?: ResourceOptions): Resource;
export declare function resourceFromDetectedResource(detectedResource: DetectedResource, options?: ResourceOptions): Resource;
export declare function emptyResource(): Resource;
export declare function defaultResource(): Resource;
//# sourceMappingURL=ResourceImpl.d.ts.map

Some files were not shown because too many files have changed in this diff Show More