🚀. Socket Launch Week Day 3:Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions.Learn more
Sign In

@opentelemetry/resources

Package Overview
Dependencies
Maintainers
4
Versions
189
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/resources - npm Package Compare versions

Comparing version
2.6.1
to
2.7.0
+3
-1
build/esm/detectors/EnvDetector.js

@@ -64,3 +64,5 @@ /*

const attributes = {};
const rawAttributes = rawEnvAttributes.split(this._COMMA_SEPARATOR);
const rawAttributes = rawEnvAttributes
.split(this._COMMA_SEPARATOR)
.filter(attr => attr.trim() !== ''); // Filter out empty entries
for (const rawAttribute of rawAttributes) {

@@ -67,0 +69,0 @@ const keyValuePair = rawAttribute.split(this._LABEL_KEY_VALUE_SPLITTER);

@@ -1,1 +0,1 @@

{"version":3,"file":"EnvDetector.js","sourceRoot":"","sources":["../../../src/detectors/EnvDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAGxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW;IACf,+EAA+E;IAC9D,WAAW,GAAG,GAAG,CAAC;IAEnC,oEAAoE;IACnD,gBAAgB,GAAG,GAAG,CAAC;IAExC,qEAAqE;IACpD,yBAAyB,GAAG,GAAG,CAAC;IAEjD;;;;;;OAMG;IACH,MAAM,CAAC,OAAiC;QACtC,MAAM,UAAU,GAAe,EAAE,CAAC;QAElC,MAAM,aAAa,GAAG,gBAAgB,CAAC,0BAA0B,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;QAE1D,IAAI,aAAa,EAAE;YACjB,IAAI;gBACF,MAAM,gBAAgB,GAAG,IAAI,CAAC,wBAAwB,CAAC,aAA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YACzB,IAAI;gBACF,UAAU,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;gBACrC,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;aAC1C;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,IAAI,KAAK,CACb,4DAA4D,YAAY,MAAM,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CACnH,CAAC;aACH;YAED,IAAI,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE;gBACxC,MAAM,IAAI,KAAK,CACb,+CAA+C,IAAI,CAAC,WAAW,iBAAiB,UAAU,IAAI,CAC/F,CAAC;aACH;YAED,IAAI,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE;gBAC1C,MAAM,IAAI,KAAK,CACb,iDAAiD,IAAI,CAAC,WAAW,wBAAwB,UAAU,IAAI,CACxG,CAAC;aACH;YAED,UAAU,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC;SACvC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,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 { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport type { ResourceDetectionConfig } from '../config';\nimport type { DetectedResource, ResourceDetector } from '../types';\nimport { getStringFromEnv } from '@opentelemetry/core';\n\n/**\n * EnvDetector can be used to detect the presence of and create a Resource\n * from the OTEL_RESOURCE_ATTRIBUTES environment variable.\n */\nclass EnvDetector implements ResourceDetector {\n // Type, attribute keys, and attribute values should not exceed 256 characters.\n private readonly _MAX_LENGTH = 255;\n\n // OTEL_RESOURCE_ATTRIBUTES is a comma-separated list of attributes.\n private readonly _COMMA_SEPARATOR = ',';\n\n // OTEL_RESOURCE_ATTRIBUTES contains key value pair separated by '='.\n private readonly _LABEL_KEY_VALUE_SPLITTER = '=';\n\n /**\n * Returns a {@link Resource} populated with attributes from the\n * OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async\n * function to conform to the Detector interface.\n *\n * @param config The resource detection config\n */\n detect(_config?: ResourceDetectionConfig): DetectedResource {\n const attributes: Attributes = {};\n\n const rawAttributes = getStringFromEnv('OTEL_RESOURCE_ATTRIBUTES');\n const serviceName = getStringFromEnv('OTEL_SERVICE_NAME');\n\n if (rawAttributes) {\n try {\n const parsedAttributes = this._parseResourceAttributes(rawAttributes);\n Object.assign(attributes, parsedAttributes);\n } catch (e) {\n diag.debug(`EnvDetector failed: ${e instanceof Error ? e.message : e}`);\n }\n }\n\n if (serviceName) {\n attributes[ATTR_SERVICE_NAME] = serviceName;\n }\n\n return { attributes };\n }\n\n /**\n * Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment\n * variable.\n *\n * OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes in the\n * format \"key1=value1,key2=value2\". The ',' and '=' characters in keys\n * and values MUST be percent-encoded. Other characters MAY be percent-encoded.\n *\n * Per the spec, on any error (e.g., decoding failure), the entire environment\n * variable value is discarded.\n *\n * @param rawEnvAttributes The resource attributes as a comma-separated list\n * of key/value pairs.\n * @returns The parsed resource attributes.\n * @throws Error if parsing fails (caller handles by discarding all attributes)\n */\n private _parseResourceAttributes(rawEnvAttributes?: string): Attributes {\n if (!rawEnvAttributes) return {};\n\n const attributes: Attributes = {};\n const rawAttributes: string[] = rawEnvAttributes.split(\n this._COMMA_SEPARATOR\n );\n\n for (const rawAttribute of rawAttributes) {\n const keyValuePair: string[] = rawAttribute.split(\n this._LABEL_KEY_VALUE_SPLITTER\n );\n\n // Per spec: ',' and '=' MUST be percent-encoded in keys and values.\n // If we get != 2 parts, there's an unencoded '=' which is an error.\n if (keyValuePair.length !== 2) {\n throw new Error(\n `Invalid format for OTEL_RESOURCE_ATTRIBUTES: \"${rawAttribute}\". ` +\n `Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`\n );\n }\n\n const [rawKey, rawValue] = keyValuePair;\n const key = rawKey.trim();\n const value = rawValue.trim();\n\n if (key.length === 0) {\n throw new Error(\n `Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in \"${rawAttribute}\".`\n );\n }\n\n let decodedKey: string;\n let decodedValue: string;\n try {\n decodedKey = decodeURIComponent(key);\n decodedValue = decodeURIComponent(value);\n } catch (e) {\n throw new Error(\n `Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry \"${rawAttribute}\": ${e instanceof Error ? e.message : e}`\n );\n }\n\n if (decodedKey.length > this._MAX_LENGTH) {\n throw new Error(\n `Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: \"${decodedKey}\".`\n );\n }\n\n if (decodedValue.length > this._MAX_LENGTH) {\n throw new Error(\n `Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key \"${decodedKey}\".`\n );\n }\n\n attributes[decodedKey] = decodedValue;\n }\n\n return attributes;\n }\n}\n\nexport const envDetector = new EnvDetector();\n"]}
{"version":3,"file":"EnvDetector.js","sourceRoot":"","sources":["../../../src/detectors/EnvDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAGxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW;IACf,+EAA+E;IAC9D,WAAW,GAAG,GAAG,CAAC;IAEnC,oEAAoE;IACnD,gBAAgB,GAAG,GAAG,CAAC;IAExC,qEAAqE;IACpD,yBAAyB,GAAG,GAAG,CAAC;IAEjD;;;;;;OAMG;IACH,MAAM,CAAC,OAAiC;QACtC,MAAM,UAAU,GAAe,EAAE,CAAC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AAE,QAAQ,CAAC,GAAG,YAAY,CAAC;YACxC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YAC1B,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;YAE9B,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;gBACpB,MAAM,IAAI,KAAK,CACb,6DAA6D,YAAY,IAAI,CAC9E,CAAC;aACH;YAED,IAAI,UAAkB,CAAC;YACvB,IAAI,YAAoB,CAAC;YACzB,IAAI;gBACF,UAAU,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;gBACrC,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;aAC1C;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,IAAI,KAAK,CACb,4DAA4D,YAAY,MAAM,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CACnH,CAAC;aACH;YAED,IAAI,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE;gBACxC,MAAM,IAAI,KAAK,CACb,+CAA+C,IAAI,CAAC,WAAW,iBAAiB,UAAU,IAAI,CAC/F,CAAC;aACH;YAED,IAAI,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE;gBAC1C,MAAM,IAAI,KAAK,CACb,iDAAiD,IAAI,CAAC,WAAW,wBAAwB,UAAU,IAAI,CACxG,CAAC;aACH;YAED,UAAU,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC;SACvC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,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 { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport type { ResourceDetectionConfig } from '../config';\nimport type { DetectedResource, ResourceDetector } from '../types';\nimport { getStringFromEnv } from '@opentelemetry/core';\n\n/**\n * EnvDetector can be used to detect the presence of and create a Resource\n * from the OTEL_RESOURCE_ATTRIBUTES environment variable.\n */\nclass EnvDetector implements ResourceDetector {\n // Type, attribute keys, and attribute values should not exceed 256 characters.\n private readonly _MAX_LENGTH = 255;\n\n // OTEL_RESOURCE_ATTRIBUTES is a comma-separated list of attributes.\n private readonly _COMMA_SEPARATOR = ',';\n\n // OTEL_RESOURCE_ATTRIBUTES contains key value pair separated by '='.\n private readonly _LABEL_KEY_VALUE_SPLITTER = '=';\n\n /**\n * Returns a {@link Resource} populated with attributes from the\n * OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async\n * function to conform to the Detector interface.\n *\n * @param config The resource detection config\n */\n detect(_config?: ResourceDetectionConfig): DetectedResource {\n const attributes: Attributes = {};\n\n const rawAttributes = getStringFromEnv('OTEL_RESOURCE_ATTRIBUTES');\n const serviceName = getStringFromEnv('OTEL_SERVICE_NAME');\n\n if (rawAttributes) {\n try {\n const parsedAttributes = this._parseResourceAttributes(rawAttributes);\n Object.assign(attributes, parsedAttributes);\n } catch (e) {\n diag.debug(`EnvDetector failed: ${e instanceof Error ? e.message : e}`);\n }\n }\n\n if (serviceName) {\n attributes[ATTR_SERVICE_NAME] = serviceName;\n }\n\n return { attributes };\n }\n\n /**\n * Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment\n * variable.\n *\n * OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes in the\n * format \"key1=value1,key2=value2\". The ',' and '=' characters in keys\n * and values MUST be percent-encoded. Other characters MAY be percent-encoded.\n *\n * Per the spec, on any error (e.g., decoding failure), the entire environment\n * variable value is discarded.\n *\n * @param rawEnvAttributes The resource attributes as a comma-separated list\n * of key/value pairs.\n * @returns The parsed resource attributes.\n * @throws Error if parsing fails (caller handles by discarding all attributes)\n */\n private _parseResourceAttributes(rawEnvAttributes?: string): Attributes {\n if (!rawEnvAttributes) return {};\n\n const attributes: Attributes = {};\n const rawAttributes: string[] = rawEnvAttributes\n .split(this._COMMA_SEPARATOR)\n .filter(attr => attr.trim() !== ''); // Filter out empty entries\n\n for (const rawAttribute of rawAttributes) {\n const keyValuePair: string[] = rawAttribute.split(\n this._LABEL_KEY_VALUE_SPLITTER\n );\n\n // Per spec: ',' and '=' MUST be percent-encoded in keys and values.\n // If we get != 2 parts, there's an unencoded '=' which is an error.\n if (keyValuePair.length !== 2) {\n throw new Error(\n `Invalid format for OTEL_RESOURCE_ATTRIBUTES: \"${rawAttribute}\". ` +\n `Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`\n );\n }\n\n const [rawKey, rawValue] = keyValuePair;\n const key = rawKey.trim();\n const value = rawValue.trim();\n\n if (key.length === 0) {\n throw new Error(\n `Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in \"${rawAttribute}\".`\n );\n }\n\n let decodedKey: string;\n let decodedValue: string;\n try {\n decodedKey = decodeURIComponent(key);\n decodedValue = decodeURIComponent(value);\n } catch (e) {\n throw new Error(\n `Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry \"${rawAttribute}\": ${e instanceof Error ? e.message : e}`\n );\n }\n\n if (decodedKey.length > this._MAX_LENGTH) {\n throw new Error(\n `Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: \"${decodedKey}\".`\n );\n }\n\n if (decodedValue.length > this._MAX_LENGTH) {\n throw new Error(\n `Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key \"${decodedKey}\".`\n );\n }\n\n attributes[decodedKey] = decodedValue;\n }\n\n return attributes;\n }\n}\n\nexport const envDetector = new EnvDetector();\n"]}

@@ -1,2 +0,2 @@

export declare const VERSION = "2.6.1";
export declare const VERSION = "2.7.0";
//# sourceMappingURL=version.d.ts.map

@@ -6,3 +6,3 @@ /*

// this is autogenerated file, see scripts/version-update.js
export const VERSION = '2.6.1';
export const VERSION = '2.7.0';
//# sourceMappingURL=version.js.map

@@ -1,1 +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"]}
{"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.7.0';\n"]}

@@ -64,3 +64,5 @@ /*

const attributes = {};
const rawAttributes = rawEnvAttributes.split(this._COMMA_SEPARATOR);
const rawAttributes = rawEnvAttributes
.split(this._COMMA_SEPARATOR)
.filter(attr => attr.trim() !== ''); // Filter out empty entries
for (const rawAttribute of rawAttributes) {

@@ -67,0 +69,0 @@ const keyValuePair = rawAttribute.split(this._LABEL_KEY_VALUE_SPLITTER);

@@ -1,1 +0,1 @@

{"version":3,"file":"EnvDetector.js","sourceRoot":"","sources":["../../../src/detectors/EnvDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAGxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW;IACf,+EAA+E;IAC9D,WAAW,GAAG,GAAG,CAAC;IAEnC,oEAAoE;IACnD,gBAAgB,GAAG,GAAG,CAAC;IAExC,qEAAqE;IACpD,yB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EAAE,QAAQ,CAAC,GAAG,YAAY,CAAC;YACxC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YAC1B,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;YAE9B,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;gBACpB,MAAM,IAAI,KAAK,CACb,6DAA6D,YAAY,IAAI,CAC9E,CAAC;aACH;YAED,IAAI,UAAkB,CAAC;YACvB,IAAI,YAAoB,CAAC;YACzB,IAAI;gBACF,UAAU,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;gBACrC,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;aAC1C;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,IAAI,KAAK,CACb,4DAA4D,YAAY,MAAM,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CACnH,CAAC;aACH;YAED,IAAI,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE;gBACxC,MAAM,IAAI,KAAK,CACb,+CAA+C,IAAI,CAAC,WAAW,iBAAiB,UAAU,IAAI,CAC/F,CAAC;aACH;YAED,IAAI,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE;gBAC1C,MAAM,IAAI,KAAK,CACb,iDAAiD,IAAI,CAAC,WAAW,wBAAwB,UAAU,IAAI,CACxG,CAAC;aACH;YAED,UAAU,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC;SACvC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,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 { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport type { ResourceDetectionConfig } from '../config';\nimport type { DetectedResource, ResourceDetector } from '../types';\nimport { getStringFromEnv } from '@opentelemetry/core';\n\n/**\n * EnvDetector can be used to detect the presence of and create a Resource\n * from the OTEL_RESOURCE_ATTRIBUTES environment variable.\n */\nclass EnvDetector implements ResourceDetector {\n // Type, attribute keys, and attribute values should not exceed 256 characters.\n private readonly _MAX_LENGTH = 255;\n\n // OTEL_RESOURCE_ATTRIBUTES is a comma-separated list of attributes.\n private readonly _COMMA_SEPARATOR = ',';\n\n // OTEL_RESOURCE_ATTRIBUTES contains key value pair separated by '='.\n private readonly _LABEL_KEY_VALUE_SPLITTER = '=';\n\n /**\n * Returns a {@link Resource} populated with attributes from the\n * OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async\n * function to conform to the Detector interface.\n *\n * @param config The resource detection config\n */\n detect(_config?: ResourceDetectionConfig): DetectedResource {\n const attributes: Attributes = {};\n\n const rawAttributes = getStringFromEnv('OTEL_RESOURCE_ATTRIBUTES');\n const serviceName = getStringFromEnv('OTEL_SERVICE_NAME');\n\n if (rawAttributes) {\n try {\n const parsedAttributes = this._parseResourceAttributes(rawAttributes);\n Object.assign(attributes, parsedAttributes);\n } catch (e) {\n diag.debug(`EnvDetector failed: ${e instanceof Error ? e.message : e}`);\n }\n }\n\n if (serviceName) {\n attributes[ATTR_SERVICE_NAME] = serviceName;\n }\n\n return { attributes };\n }\n\n /**\n * Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment\n * variable.\n *\n * OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes in the\n * format \"key1=value1,key2=value2\". The ',' and '=' characters in keys\n * and values MUST be percent-encoded. Other characters MAY be percent-encoded.\n *\n * Per the spec, on any error (e.g., decoding failure), the entire environment\n * variable value is discarded.\n *\n * @param rawEnvAttributes The resource attributes as a comma-separated list\n * of key/value pairs.\n * @returns The parsed resource attributes.\n * @throws Error if parsing fails (caller handles by discarding all attributes)\n */\n private _parseResourceAttributes(rawEnvAttributes?: string): Attributes {\n if (!rawEnvAttributes) return {};\n\n const attributes: Attributes = {};\n const rawAttributes: string[] = rawEnvAttributes.split(\n this._COMMA_SEPARATOR\n );\n\n for (const rawAttribute of rawAttributes) {\n const keyValuePair: string[] = rawAttribute.split(\n this._LABEL_KEY_VALUE_SPLITTER\n );\n\n // Per spec: ',' and '=' MUST be percent-encoded in keys and values.\n // If we get != 2 parts, there's an unencoded '=' which is an error.\n if (keyValuePair.length !== 2) {\n throw new Error(\n `Invalid format for OTEL_RESOURCE_ATTRIBUTES: \"${rawAttribute}\". ` +\n `Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`\n );\n }\n\n const [rawKey, rawValue] = keyValuePair;\n const key = rawKey.trim();\n const value = rawValue.trim();\n\n if (key.length === 0) {\n throw new Error(\n `Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in \"${rawAttribute}\".`\n );\n }\n\n let decodedKey: string;\n let decodedValue: string;\n try {\n decodedKey = decodeURIComponent(key);\n decodedValue = decodeURIComponent(value);\n } catch (e) {\n throw new Error(\n `Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry \"${rawAttribute}\": ${e instanceof Error ? e.message : e}`\n );\n }\n\n if (decodedKey.length > this._MAX_LENGTH) {\n throw new Error(\n `Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: \"${decodedKey}\".`\n );\n }\n\n if (decodedValue.length > this._MAX_LENGTH) {\n throw new Error(\n `Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key \"${decodedKey}\".`\n );\n }\n\n attributes[decodedKey] = decodedValue;\n }\n\n return attributes;\n }\n}\n\nexport const envDetector = new EnvDetector();\n"]}
{"version":3,"file":"EnvDetector.js","sourceRoot":"","sources":["../../../src/detectors/EnvDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCA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;YAED,UAAU,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC;SACvC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,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 { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport type { ResourceDetectionConfig } from '../config';\nimport type { DetectedResource, ResourceDetector } from '../types';\nimport { getStringFromEnv } from '@opentelemetry/core';\n\n/**\n * EnvDetector can be used to detect the presence of and create a Resource\n * from the OTEL_RESOURCE_ATTRIBUTES environment variable.\n */\nclass EnvDetector implements ResourceDetector {\n // Type, attribute keys, and attribute values should not exceed 256 characters.\n private readonly _MAX_LENGTH = 255;\n\n // OTEL_RESOURCE_ATTRIBUTES is a comma-separated list of attributes.\n private readonly _COMMA_SEPARATOR = ',';\n\n // OTEL_RESOURCE_ATTRIBUTES contains key value pair separated by '='.\n private readonly _LABEL_KEY_VALUE_SPLITTER = '=';\n\n /**\n * Returns a {@link Resource} populated with attributes from the\n * OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async\n * function to conform to the Detector interface.\n *\n * @param config The resource detection config\n */\n detect(_config?: ResourceDetectionConfig): DetectedResource {\n const attributes: Attributes = {};\n\n const rawAttributes = getStringFromEnv('OTEL_RESOURCE_ATTRIBUTES');\n const serviceName = getStringFromEnv('OTEL_SERVICE_NAME');\n\n if (rawAttributes) {\n try {\n const parsedAttributes = this._parseResourceAttributes(rawAttributes);\n Object.assign(attributes, parsedAttributes);\n } catch (e) {\n diag.debug(`EnvDetector failed: ${e instanceof Error ? e.message : e}`);\n }\n }\n\n if (serviceName) {\n attributes[ATTR_SERVICE_NAME] = serviceName;\n }\n\n return { attributes };\n }\n\n /**\n * Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment\n * variable.\n *\n * OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes in the\n * format \"key1=value1,key2=value2\". The ',' and '=' characters in keys\n * and values MUST be percent-encoded. Other characters MAY be percent-encoded.\n *\n * Per the spec, on any error (e.g., decoding failure), the entire environment\n * variable value is discarded.\n *\n * @param rawEnvAttributes The resource attributes as a comma-separated list\n * of key/value pairs.\n * @returns The parsed resource attributes.\n * @throws Error if parsing fails (caller handles by discarding all attributes)\n */\n private _parseResourceAttributes(rawEnvAttributes?: string): Attributes {\n if (!rawEnvAttributes) return {};\n\n const attributes: Attributes = {};\n const rawAttributes: string[] = rawEnvAttributes\n .split(this._COMMA_SEPARATOR)\n .filter(attr => attr.trim() !== ''); // Filter out empty entries\n\n for (const rawAttribute of rawAttributes) {\n const keyValuePair: string[] = rawAttribute.split(\n this._LABEL_KEY_VALUE_SPLITTER\n );\n\n // Per spec: ',' and '=' MUST be percent-encoded in keys and values.\n // If we get != 2 parts, there's an unencoded '=' which is an error.\n if (keyValuePair.length !== 2) {\n throw new Error(\n `Invalid format for OTEL_RESOURCE_ATTRIBUTES: \"${rawAttribute}\". ` +\n `Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`\n );\n }\n\n const [rawKey, rawValue] = keyValuePair;\n const key = rawKey.trim();\n const value = rawValue.trim();\n\n if (key.length === 0) {\n throw new Error(\n `Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in \"${rawAttribute}\".`\n );\n }\n\n let decodedKey: string;\n let decodedValue: string;\n try {\n decodedKey = decodeURIComponent(key);\n decodedValue = decodeURIComponent(value);\n } catch (e) {\n throw new Error(\n `Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry \"${rawAttribute}\": ${e instanceof Error ? e.message : e}`\n );\n }\n\n if (decodedKey.length > this._MAX_LENGTH) {\n throw new Error(\n `Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: \"${decodedKey}\".`\n );\n }\n\n if (decodedValue.length > this._MAX_LENGTH) {\n throw new Error(\n `Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key \"${decodedKey}\".`\n );\n }\n\n attributes[decodedKey] = decodedValue;\n }\n\n return attributes;\n }\n}\n\nexport const envDetector = new EnvDetector();\n"]}

@@ -1,2 +0,2 @@

export declare const VERSION = "2.6.1";
export declare const VERSION = "2.7.0";
//# sourceMappingURL=version.d.ts.map

@@ -6,3 +6,3 @@ /*

// this is autogenerated file, see scripts/version-update.js
export const VERSION = '2.6.1';
export const VERSION = '2.7.0';
//# sourceMappingURL=version.js.map

@@ -1,1 +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"]}
{"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.7.0';\n"]}

@@ -67,3 +67,5 @@ "use strict";

const attributes = {};
const rawAttributes = rawEnvAttributes.split(this._COMMA_SEPARATOR);
const rawAttributes = rawEnvAttributes
.split(this._COMMA_SEPARATOR)
.filter(attr => attr.trim() !== ''); // Filter out empty entries
for (const rawAttribute of rawAttributes) {

@@ -70,0 +72,0 @@ const keyValuePair = rawAttribute.split(this._LABEL_KEY_VALUE_SPLITTER);

@@ -1,1 +0,1 @@

{"version":3,"file":"EnvDetector.js","sourceRoot":"","sources":["../../../src/detectors/EnvDetector.ts"],"names":[],"mappings":";AA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AAEY,QAAA,WAAW,GAAG,IAAI,WAAW,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 { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport type { ResourceDetectionConfig } from '../config';\nimport type { DetectedResource, ResourceDetector } from '../types';\nimport { getStringFromEnv } from '@opentelemetry/core';\n\n/**\n * EnvDetector can be used to detect the presence of and create a Resource\n * from the OTEL_RESOURCE_ATTRIBUTES environment variable.\n */\nclass EnvDetector implements ResourceDetector {\n // Type, attribute keys, and attribute values should not exceed 256 characters.\n private readonly _MAX_LENGTH = 255;\n\n // OTEL_RESOURCE_ATTRIBUTES is a comma-separated list of attributes.\n private readonly _COMMA_SEPARATOR = ',';\n\n // OTEL_RESOURCE_ATTRIBUTES contains key value pair separated by '='.\n private readonly _LABEL_KEY_VALUE_SPLITTER = '=';\n\n /**\n * Returns a {@link Resource} populated with attributes from the\n * OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async\n * function to conform to the Detector interface.\n *\n * @param config The resource detection config\n */\n detect(_config?: ResourceDetectionConfig): DetectedResource {\n const attributes: Attributes = {};\n\n const rawAttributes = getStringFromEnv('OTEL_RESOURCE_ATTRIBUTES');\n const serviceName = getStringFromEnv('OTEL_SERVICE_NAME');\n\n if (rawAttributes) {\n try {\n const parsedAttributes = this._parseResourceAttributes(rawAttributes);\n Object.assign(attributes, parsedAttributes);\n } catch (e) {\n diag.debug(`EnvDetector failed: ${e instanceof Error ? e.message : e}`);\n }\n }\n\n if (serviceName) {\n attributes[ATTR_SERVICE_NAME] = serviceName;\n }\n\n return { attributes };\n }\n\n /**\n * Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment\n * variable.\n *\n * OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes in the\n * format \"key1=value1,key2=value2\". The ',' and '=' characters in keys\n * and values MUST be percent-encoded. Other characters MAY be percent-encoded.\n *\n * Per the spec, on any error (e.g., decoding failure), the entire environment\n * variable value is discarded.\n *\n * @param rawEnvAttributes The resource attributes as a comma-separated list\n * of key/value pairs.\n * @returns The parsed resource attributes.\n * @throws Error if parsing fails (caller handles by discarding all attributes)\n */\n private _parseResourceAttributes(rawEnvAttributes?: string): Attributes {\n if (!rawEnvAttributes) return {};\n\n const attributes: Attributes = {};\n const rawAttributes: string[] = rawEnvAttributes.split(\n this._COMMA_SEPARATOR\n );\n\n for (const rawAttribute of rawAttributes) {\n const keyValuePair: string[] = rawAttribute.split(\n this._LABEL_KEY_VALUE_SPLITTER\n );\n\n // Per spec: ',' and '=' MUST be percent-encoded in keys and values.\n // If we get != 2 parts, there's an unencoded '=' which is an error.\n if (keyValuePair.length !== 2) {\n throw new Error(\n `Invalid format for OTEL_RESOURCE_ATTRIBUTES: \"${rawAttribute}\". ` +\n `Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`\n );\n }\n\n const [rawKey, rawValue] = keyValuePair;\n const key = rawKey.trim();\n const value = rawValue.trim();\n\n if (key.length === 0) {\n throw new Error(\n `Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in \"${rawAttribute}\".`\n );\n }\n\n let decodedKey: string;\n let decodedValue: string;\n try {\n decodedKey = decodeURIComponent(key);\n decodedValue = decodeURIComponent(value);\n } catch (e) {\n throw new Error(\n `Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry \"${rawAttribute}\": ${e instanceof Error ? e.message : e}`\n );\n }\n\n if (decodedKey.length > this._MAX_LENGTH) {\n throw new Error(\n `Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: \"${decodedKey}\".`\n );\n }\n\n if (decodedValue.length > this._MAX_LENGTH) {\n throw new Error(\n `Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key \"${decodedKey}\".`\n );\n }\n\n attributes[decodedKey] = decodedValue;\n }\n\n return attributes;\n }\n}\n\nexport const envDetector = new EnvDetector();\n"]}
{"version":3,"file":"EnvDetector.js","sourceRoot":"","sources":["../../../src/detectors/EnvDetector.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,4CAA0C;AAC1C,8EAAwE;AAGxE,8CAAuD;AAEvD;;;GAGG;AACH,MAAM,WAAW;IACf,+EAA+E;IAC9D,WAAW,GAAG,GAAG,CAAC;IAEnC,oEAAoE;IACnD,gBAAgB,GAAG,GAAG,CAAC;IAExC,qEAAqE;IACpD,yBAAyB,GAAG,GAAG,CAAC;IAEjD;;;;;;OAMG;IACH,MAAM,CAAC,OAAiC;QACtC,MAAM,UAAU,GAAe,EAAE,CAAC;QAElC,MAAM,aAAa,GAAG,IAAA,uBAAgB,EAAC,0BAA0B,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,IAAA,uBAAgB,EAAC,mBAAmB,CAAC,CAAC;QAE1D,IAAI,aAAa,EAAE;YACjB,IAAI;gBACF,MAAM,gBAAgB,GAAG,IAAI,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;gBACtE,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;aAC7C;YAAC,OAAO,CAAC,EAAE;gBACV,UAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aACzE;SACF;QAED,IAAI,WAAW,EAAE;YACf,UAAU,CAAC,wCAAiB,CAAC,GAAG,WAAW,CAAC;SAC7C;QAED,OAAO,EAAE,UAAU,EAAE,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACK,wBAAwB,CAAC,gBAAyB;QACxD,IAAI,CAAC,gBAAgB;YAAE,OAAO,EAAE,CAAC;QAEjC,MAAM,UAAU,GAAe,EAAE,CAAC;QAClC,MAAM,aAAa,GAAa,gBAAgB;aAC7C,KAAK,CAAC,IAAI,CAAC,gBAA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AAC,WAAW,EAAE;gBAC1C,MAAM,IAAI,KAAK,CACb,iDAAiD,IAAI,CAAC,WAAW,wBAAwB,UAAU,IAAI,CACxG,CAAC;aACH;YAED,UAAU,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC;SACvC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAEY,QAAA,WAAW,GAAG,IAAI,WAAW,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 { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport type { ResourceDetectionConfig } from '../config';\nimport type { DetectedResource, ResourceDetector } from '../types';\nimport { getStringFromEnv } from '@opentelemetry/core';\n\n/**\n * EnvDetector can be used to detect the presence of and create a Resource\n * from the OTEL_RESOURCE_ATTRIBUTES environment variable.\n */\nclass EnvDetector implements ResourceDetector {\n // Type, attribute keys, and attribute values should not exceed 256 characters.\n private readonly _MAX_LENGTH = 255;\n\n // OTEL_RESOURCE_ATTRIBUTES is a comma-separated list of attributes.\n private readonly _COMMA_SEPARATOR = ',';\n\n // OTEL_RESOURCE_ATTRIBUTES contains key value pair separated by '='.\n private readonly _LABEL_KEY_VALUE_SPLITTER = '=';\n\n /**\n * Returns a {@link Resource} populated with attributes from the\n * OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async\n * function to conform to the Detector interface.\n *\n * @param config The resource detection config\n */\n detect(_config?: ResourceDetectionConfig): DetectedResource {\n const attributes: Attributes = {};\n\n const rawAttributes = getStringFromEnv('OTEL_RESOURCE_ATTRIBUTES');\n const serviceName = getStringFromEnv('OTEL_SERVICE_NAME');\n\n if (rawAttributes) {\n try {\n const parsedAttributes = this._parseResourceAttributes(rawAttributes);\n Object.assign(attributes, parsedAttributes);\n } catch (e) {\n diag.debug(`EnvDetector failed: ${e instanceof Error ? e.message : e}`);\n }\n }\n\n if (serviceName) {\n attributes[ATTR_SERVICE_NAME] = serviceName;\n }\n\n return { attributes };\n }\n\n /**\n * Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment\n * variable.\n *\n * OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes in the\n * format \"key1=value1,key2=value2\". The ',' and '=' characters in keys\n * and values MUST be percent-encoded. Other characters MAY be percent-encoded.\n *\n * Per the spec, on any error (e.g., decoding failure), the entire environment\n * variable value is discarded.\n *\n * @param rawEnvAttributes The resource attributes as a comma-separated list\n * of key/value pairs.\n * @returns The parsed resource attributes.\n * @throws Error if parsing fails (caller handles by discarding all attributes)\n */\n private _parseResourceAttributes(rawEnvAttributes?: string): Attributes {\n if (!rawEnvAttributes) return {};\n\n const attributes: Attributes = {};\n const rawAttributes: string[] = rawEnvAttributes\n .split(this._COMMA_SEPARATOR)\n .filter(attr => attr.trim() !== ''); // Filter out empty entries\n\n for (const rawAttribute of rawAttributes) {\n const keyValuePair: string[] = rawAttribute.split(\n this._LABEL_KEY_VALUE_SPLITTER\n );\n\n // Per spec: ',' and '=' MUST be percent-encoded in keys and values.\n // If we get != 2 parts, there's an unencoded '=' which is an error.\n if (keyValuePair.length !== 2) {\n throw new Error(\n `Invalid format for OTEL_RESOURCE_ATTRIBUTES: \"${rawAttribute}\". ` +\n `Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`\n );\n }\n\n const [rawKey, rawValue] = keyValuePair;\n const key = rawKey.trim();\n const value = rawValue.trim();\n\n if (key.length === 0) {\n throw new Error(\n `Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in \"${rawAttribute}\".`\n );\n }\n\n let decodedKey: string;\n let decodedValue: string;\n try {\n decodedKey = decodeURIComponent(key);\n decodedValue = decodeURIComponent(value);\n } catch (e) {\n throw new Error(\n `Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry \"${rawAttribute}\": ${e instanceof Error ? e.message : e}`\n );\n }\n\n if (decodedKey.length > this._MAX_LENGTH) {\n throw new Error(\n `Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: \"${decodedKey}\".`\n );\n }\n\n if (decodedValue.length > this._MAX_LENGTH) {\n throw new Error(\n `Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key \"${decodedKey}\".`\n );\n }\n\n attributes[decodedKey] = decodedValue;\n }\n\n return attributes;\n }\n}\n\nexport const envDetector = new EnvDetector();\n"]}

@@ -1,2 +0,2 @@

export declare const VERSION = "2.6.1";
export declare const VERSION = "2.7.0";
//# sourceMappingURL=version.d.ts.map

@@ -9,3 +9,3 @@ "use strict";

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '2.6.1';
exports.VERSION = '2.7.0';
//# sourceMappingURL=version.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4DAA4D;AAC/C,QAAA,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"]}
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4DAA4D;AAC/C,QAAA,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.7.0';\n"]}
{
"name": "@opentelemetry/resources",
"version": "2.6.1",
"version": "2.7.0",
"description": "OpenTelemetry SDK resources",

@@ -85,3 +85,3 @@ "main": "build/src/index.js",

"dependencies": {
"@opentelemetry/core": "2.6.1",
"@opentelemetry/core": "2.7.0",
"@opentelemetry/semantic-conventions": "^1.29.0"

@@ -91,3 +91,3 @@ },

"sideEffects": false,
"gitHead": "7e74509a4d848e94b2970bb5262dd3e8efeed0a2"
"gitHead": "a0476eef3cb973bfcc0c2e41f868dd7b484c2ed8"
}