@opentelemetry/otlp-grpc-exporter-base
Advanced tools
Comparing version 0.57.2 to 0.200.0-dev.0
@@ -22,5 +22,4 @@ "use strict"; | ||
metadata: () => { | ||
var _a; | ||
// metadata resolution strategy is merge, so we can return empty here, and it will not override the rest of the settings. | ||
return (_a = config.metadata) !== null && _a !== void 0 ? _a : (0, grpc_exporter_transport_1.createEmptyMetadata)(); | ||
return config.metadata ?? (0, grpc_exporter_transport_1.createEmptyMetadata)(); | ||
}, | ||
@@ -27,0 +26,0 @@ compression: config.compression, |
@@ -25,3 +25,2 @@ "use strict"; | ||
function validateAndNormalizeUrl(url) { | ||
var _a; | ||
url = url.trim(); | ||
@@ -39,3 +38,3 @@ const hasProtocol = url.match(/^([\w]{1,8}):\/\//); | ||
} | ||
if (target.protocol !== '' && !((_a = target.protocol) === null || _a === void 0 ? void 0 : _a.match(/^(http)s?:$/))) { | ||
if (target.protocol !== '' && !target.protocol?.match(/^(http)s?:$/)) { | ||
api_1.diag.warn('URL protocol should be http(s)://. Using http://.'); | ||
@@ -56,21 +55,32 @@ } | ||
function mergeOtlpGrpcConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration) { | ||
var _a, _b, _c, _d, _e; | ||
const rawUrl = (_b = (_a = userProvidedConfiguration.url) !== null && _a !== void 0 ? _a : fallbackConfiguration.url) !== null && _b !== void 0 ? _b : defaultConfiguration.url; | ||
return Object.assign(Object.assign({}, (0, otlp_exporter_base_1.mergeOtlpSharedConfigurationWithDefaults)(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration)), { metadata: () => { | ||
var _a, _b, _c, _d; | ||
const rawUrl = userProvidedConfiguration.url ?? | ||
fallbackConfiguration.url ?? | ||
defaultConfiguration.url; | ||
return { | ||
...(0, otlp_exporter_base_1.mergeOtlpSharedConfigurationWithDefaults)(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration), | ||
metadata: () => { | ||
const metadata = defaultConfiguration.metadata(); | ||
overrideMetadataEntriesIfNotPresent(metadata, | ||
// clone to ensure we don't modify what the user gave us in case they hold on to the returned reference | ||
(_b = (_a = userProvidedConfiguration.metadata) === null || _a === void 0 ? void 0 : _a.call(userProvidedConfiguration).clone()) !== null && _b !== void 0 ? _b : (0, grpc_exporter_transport_1.createEmptyMetadata)()); | ||
overrideMetadataEntriesIfNotPresent(metadata, (_d = (_c = fallbackConfiguration.metadata) === null || _c === void 0 ? void 0 : _c.call(fallbackConfiguration)) !== null && _d !== void 0 ? _d : (0, grpc_exporter_transport_1.createEmptyMetadata)()); | ||
userProvidedConfiguration.metadata?.().clone() ?? (0, grpc_exporter_transport_1.createEmptyMetadata)()); | ||
overrideMetadataEntriesIfNotPresent(metadata, fallbackConfiguration.metadata?.() ?? (0, grpc_exporter_transport_1.createEmptyMetadata)()); | ||
return metadata; | ||
}, url: validateAndNormalizeUrl(rawUrl), credentials: (_e = (_c = userProvidedConfiguration.credentials) !== null && _c !== void 0 ? _c : (_d = fallbackConfiguration.credentials) === null || _d === void 0 ? void 0 : _d.call(fallbackConfiguration, rawUrl)) !== null && _e !== void 0 ? _e : defaultConfiguration.credentials(rawUrl) }); | ||
}, | ||
url: validateAndNormalizeUrl(rawUrl), | ||
credentials: userProvidedConfiguration.credentials ?? | ||
fallbackConfiguration.credentials?.(rawUrl) ?? | ||
defaultConfiguration.credentials(rawUrl), | ||
}; | ||
} | ||
exports.mergeOtlpGrpcConfigurationWithDefaults = mergeOtlpGrpcConfigurationWithDefaults; | ||
function getOtlpGrpcDefaultConfiguration() { | ||
return Object.assign(Object.assign({}, (0, otlp_exporter_base_1.getSharedConfigurationDefaults)()), { metadata: () => { | ||
return { | ||
...(0, otlp_exporter_base_1.getSharedConfigurationDefaults)(), | ||
metadata: () => { | ||
const metadata = (0, grpc_exporter_transport_1.createEmptyMetadata)(); | ||
metadata.set('User-Agent', `OTel-OTLP-Exporter-JavaScript/${version_1.VERSION}`); | ||
return metadata; | ||
}, url: 'http://localhost:4317', credentials: (url) => { | ||
}, | ||
url: 'http://localhost:4317', | ||
credentials: (url) => { | ||
if (url.startsWith('http://')) { | ||
@@ -82,5 +92,6 @@ return () => (0, grpc_exporter_transport_1.createInsecureCredentials)(); | ||
} | ||
} }); | ||
}, | ||
}; | ||
} | ||
exports.getOtlpGrpcDefaultConfiguration = getOtlpGrpcDefaultConfiguration; | ||
//# sourceMappingURL=otlp-grpc-configuration.js.map |
@@ -20,7 +20,6 @@ "use strict"; | ||
function getMetadataFromEnv(signalIdentifier) { | ||
var _a, _b; | ||
const signalSpecificRawHeaders = (_a = process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`]) === null || _a === void 0 ? void 0 : _a.trim(); | ||
const nonSignalSpecificRawHeaders = (_b = process.env['OTEL_EXPORTER_OTLP_HEADERS']) === null || _b === void 0 ? void 0 : _b.trim(); | ||
const signalSpecificHeaders = core_1.baggageUtils.parseKeyPairsIntoRecord(signalSpecificRawHeaders); | ||
const nonSignalSpecificHeaders = core_1.baggageUtils.parseKeyPairsIntoRecord(nonSignalSpecificRawHeaders); | ||
const signalSpecificRawHeaders = process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`]?.trim(); | ||
const nonSignalSpecificRawHeaders = process.env['OTEL_EXPORTER_OTLP_HEADERS']?.trim(); | ||
const signalSpecificHeaders = (0, core_1.parseKeyPairsIntoRecord)(signalSpecificRawHeaders); | ||
const nonSignalSpecificHeaders = (0, core_1.parseKeyPairsIntoRecord)(nonSignalSpecificRawHeaders); | ||
if (Object.keys(signalSpecificHeaders).length === 0 && | ||
@@ -55,5 +54,4 @@ Object.keys(nonSignalSpecificHeaders).length === 0) { | ||
// - https://example.test:4317 -> use secure credentials from environment (or provided via code) | ||
var _a, _b; | ||
const specificEndpoint = (_a = process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_ENDPOINT`]) === null || _a === void 0 ? void 0 : _a.trim(); | ||
const nonSpecificEndpoint = (_b = process.env[`OTEL_EXPORTER_OTLP_ENDPOINT`]) === null || _b === void 0 ? void 0 : _b.trim(); | ||
const specificEndpoint = process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_ENDPOINT`]?.trim(); | ||
const nonSpecificEndpoint = process.env[`OTEL_EXPORTER_OTLP_ENDPOINT`]?.trim(); | ||
return fallbackIfNullishOrBlank(specificEndpoint, nonSpecificEndpoint); | ||
@@ -82,11 +80,13 @@ } | ||
function getInsecureSettingFromEnv(signalIdentifier) { | ||
var _a, _b; | ||
const signalSpecificInsecureValue = (_a = process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_INSECURE`]) === null || _a === void 0 ? void 0 : _a.toLowerCase().trim(); | ||
const nonSignalSpecificInsecureValue = (_b = process.env[`OTEL_EXPORTER_OTLP_INSECURE`]) === null || _b === void 0 ? void 0 : _b.toLowerCase().trim(); | ||
const signalSpecificInsecureValue = process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_INSECURE`] | ||
?.toLowerCase() | ||
.trim(); | ||
const nonSignalSpecificInsecureValue = process.env[`OTEL_EXPORTER_OTLP_INSECURE`] | ||
?.toLowerCase() | ||
.trim(); | ||
return (fallbackIfNullishOrBlank(signalSpecificInsecureValue, nonSignalSpecificInsecureValue) === 'true'); | ||
} | ||
function readFileFromEnv(signalSpecificEnvVar, nonSignalSpecificEnvVar, warningMessage) { | ||
var _a, _b; | ||
const signalSpecificPath = (_a = process.env[signalSpecificEnvVar]) === null || _a === void 0 ? void 0 : _a.trim(); | ||
const nonSignalSpecificPath = (_b = process.env[nonSignalSpecificEnvVar]) === null || _b === void 0 ? void 0 : _b.trim(); | ||
const signalSpecificPath = process.env[signalSpecificEnvVar]?.trim(); | ||
const nonSignalSpecificPath = process.env[nonSignalSpecificEnvVar]?.trim(); | ||
const filePath = fallbackIfNullishOrBlank(signalSpecificPath, nonSignalSpecificPath); | ||
@@ -97,3 +97,3 @@ if (filePath != null) { | ||
} | ||
catch (_c) { | ||
catch { | ||
api_1.diag.warn(warningMessage); | ||
@@ -136,3 +136,7 @@ return undefined; | ||
function getOtlpGrpcConfigurationFromEnv(signalIdentifier) { | ||
return Object.assign(Object.assign({}, (0, node_http_1.getSharedConfigurationFromEnvironment)(signalIdentifier)), { metadata: getMetadataProviderFromEnv(signalIdentifier), url: getUrlFromEnv(signalIdentifier), credentials: (finalResolvedUrl) => { | ||
return { | ||
...(0, node_http_1.getSharedConfigurationFromEnvironment)(signalIdentifier), | ||
metadata: getMetadataProviderFromEnv(signalIdentifier), | ||
url: getUrlFromEnv(signalIdentifier), | ||
credentials: (finalResolvedUrl) => { | ||
// Always assume insecure on http:// and secure on https://, the protocol always takes precedence over the insecure setting. | ||
@@ -156,5 +160,6 @@ // note: the spec does not make any exception for | ||
}; | ||
} }); | ||
}, | ||
}; | ||
} | ||
exports.getOtlpGrpcConfigurationFromEnv = getOtlpGrpcConfigurationFromEnv; | ||
//# sourceMappingURL=otlp-grpc-env-configuration.js.map |
@@ -50,2 +50,5 @@ "use strict"; | ||
class GrpcExporterTransport { | ||
_parameters; | ||
_client; | ||
_metadata; | ||
constructor(_parameters) { | ||
@@ -55,4 +58,3 @@ this._parameters = _parameters; | ||
shutdown() { | ||
var _a; | ||
(_a = this._client) === null || _a === void 0 ? void 0 : _a.close(); | ||
this._client?.close(); | ||
} | ||
@@ -59,0 +61,0 @@ send(data, timeoutMillis) { |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.57.2"; | ||
export declare const VERSION = "0.200.0-dev.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.57.2'; | ||
exports.VERSION = '0.200.0-dev.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/otlp-grpc-exporter-base", | ||
"version": "0.57.2", | ||
"version": "0.200.0-dev.0", | ||
"description": "OpenTelemetry OTLP-gRPC Exporter base (for internal use only)", | ||
@@ -35,3 +35,3 @@ "main": "build/src/index.js", | ||
"engines": { | ||
"node": ">=14" | ||
"node": "^18.19.0 || >=20.6.0" | ||
}, | ||
@@ -51,14 +51,14 @@ "files": [ | ||
"@opentelemetry/api": "1.9.0", | ||
"@opentelemetry/resources": "1.30.1", | ||
"@opentelemetry/sdk-trace-base": "1.30.1", | ||
"@opentelemetry/resources": "2.0.0-dev.0", | ||
"@opentelemetry/sdk-trace-base": "2.0.0-dev.0", | ||
"@types/mocha": "10.0.10", | ||
"@types/node": "18.6.5", | ||
"@types/sinon": "17.0.3", | ||
"@types/sinon": "17.0.4", | ||
"cross-var": "1.1.0", | ||
"lerna": "6.6.2", | ||
"mocha": "10.8.2", | ||
"nyc": "15.1.0", | ||
"mocha": "11.1.0", | ||
"nyc": "17.1.0", | ||
"sinon": "15.1.2", | ||
"ts-loader": "9.5.1", | ||
"typescript": "4.4.4" | ||
"ts-loader": "9.5.2", | ||
"typescript": "5.0.4" | ||
}, | ||
@@ -70,9 +70,9 @@ "peerDependencies": { | ||
"@grpc/grpc-js": "^1.7.1", | ||
"@opentelemetry/core": "1.30.1", | ||
"@opentelemetry/otlp-exporter-base": "0.57.2", | ||
"@opentelemetry/otlp-transformer": "0.57.2" | ||
"@opentelemetry/core": "2.0.0-dev.0", | ||
"@opentelemetry/otlp-exporter-base": "0.200.0-dev.0", | ||
"@opentelemetry/otlp-transformer": "0.200.0-dev.0" | ||
}, | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-grpc-exporter-base", | ||
"sideEffects": false, | ||
"gitHead": "ac8641a5dbb5df1169bd5ed25a6667a6a6f730ca" | ||
"gitHead": "544c40984797dd2e2cccb92cce0e88b30f235b02" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
639
85053
+ Added@opentelemetry/api-logs@0.200.0-dev.0(transitive)
+ Added@opentelemetry/core@2.0.0-dev.0(transitive)
+ Added@opentelemetry/otlp-exporter-base@0.200.0-dev.0(transitive)
+ Added@opentelemetry/otlp-transformer@0.200.0-dev.0(transitive)
+ Added@opentelemetry/resources@2.0.0-dev.0(transitive)
+ Added@opentelemetry/sdk-logs@0.200.0-dev.0(transitive)
+ Added@opentelemetry/sdk-metrics@2.0.0-dev.0(transitive)
+ Added@opentelemetry/sdk-trace-base@2.0.0-dev.0(transitive)
+ Added@opentelemetry/semantic-conventions@1.30.0(transitive)
- Removed@opentelemetry/api-logs@0.57.2(transitive)
- Removed@opentelemetry/core@1.30.1(transitive)
- Removed@opentelemetry/otlp-exporter-base@0.57.2(transitive)
- Removed@opentelemetry/otlp-transformer@0.57.2(transitive)
- Removed@opentelemetry/resources@1.30.1(transitive)
- Removed@opentelemetry/sdk-logs@0.57.2(transitive)
- Removed@opentelemetry/sdk-metrics@1.30.1(transitive)
- Removed@opentelemetry/sdk-trace-base@1.30.1(transitive)
- Removed@opentelemetry/semantic-conventions@1.28.0(transitive)