@opentelemetry/otlp-grpc-exporter-base 0.206.0 → 0.207.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/configuration/convert-legacy-otlp-grpc-options.js +1 -0
- package/build/src/configuration/convert-legacy-otlp-grpc-options.js.map +1 -1
- package/build/src/configuration/otlp-grpc-configuration.d.ts +1 -0
- package/build/src/configuration/otlp-grpc-configuration.js +2 -6
- package/build/src/configuration/otlp-grpc-configuration.js.map +1 -1
- package/build/src/grpc-exporter-transport.d.ts +1 -0
- package/build/src/grpc-exporter-transport.js +9 -0
- package/build/src/grpc-exporter-transport.js.map +1 -1
- package/build/src/otlp-grpc-export-delegate.js +1 -0
- package/build/src/otlp-grpc-export-delegate.js.map +1 -1
- package/build/src/types.d.ts +1 -0
- package/build/src/types.js.map +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/build/src/version.js.map +1 -1
- package/package.json +8 -8
|
@@ -28,6 +28,7 @@ function convertLegacyOtlpGrpcOptions(config, signalIdentifier) {
|
|
|
28
28
|
credentials: userProvidedCredentials != null
|
|
29
29
|
? () => userProvidedCredentials
|
|
30
30
|
: undefined,
|
|
31
|
+
userAgent: config.userAgent,
|
|
31
32
|
}, (0, otlp_grpc_env_configuration_1.getOtlpGrpcConfigurationFromEnv)(signalIdentifier), (0, otlp_grpc_configuration_1.getOtlpGrpcDefaultConfiguration)());
|
|
32
33
|
}
|
|
33
34
|
exports.convertLegacyOtlpGrpcOptions = convertLegacyOtlpGrpcOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-legacy-otlp-grpc-options.js","sourceRoot":"","sources":["../../../src/configuration/convert-legacy-otlp-grpc-options.ts"],"names":[],"mappings":";;;AAgBA,4CAA0C;AAC1C,uEAImC;AACnC,wEAAiE;AACjE,+EAAgF;AAEhF;;;;GAIG;AACH,SAAgB,4BAA4B,CAC1C,MAAkC,EAClC,gBAAwB;IAExB,IAAI,MAAM,CAAC,OAAO,EAAE;QAClB,UAAI,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;KACpD;IAED,mFAAmF;IACnF,MAAM,uBAAuB,GAAG,MAAM,CAAC,WAAW,CAAC;IACnD,OAAO,IAAA,gEAAsC,EAC3C;QACE,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,QAAQ,EAAE,GAAG,EAAE;YACb,yHAAyH;YACzH,OAAO,MAAM,CAAC,QAAQ,IAAI,IAAA,6CAAmB,GAAE,CAAC;QAClD,CAAC;QACD,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,WAAW,EACT,uBAAuB,IAAI,IAAI;YAC7B,CAAC,CAAC,GAAG,EAAE,CAAC,uBAAuB;YAC/B,CAAC,CAAC,SAAS;
|
|
1
|
+
{"version":3,"file":"convert-legacy-otlp-grpc-options.js","sourceRoot":"","sources":["../../../src/configuration/convert-legacy-otlp-grpc-options.ts"],"names":[],"mappings":";;;AAgBA,4CAA0C;AAC1C,uEAImC;AACnC,wEAAiE;AACjE,+EAAgF;AAEhF;;;;GAIG;AACH,SAAgB,4BAA4B,CAC1C,MAAkC,EAClC,gBAAwB;IAExB,IAAI,MAAM,CAAC,OAAO,EAAE;QAClB,UAAI,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;KACpD;IAED,mFAAmF;IACnF,MAAM,uBAAuB,GAAG,MAAM,CAAC,WAAW,CAAC;IACnD,OAAO,IAAA,gEAAsC,EAC3C;QACE,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,QAAQ,EAAE,GAAG,EAAE;YACb,yHAAyH;YACzH,OAAO,MAAM,CAAC,QAAQ,IAAI,IAAA,6CAAmB,GAAE,CAAC;QAClD,CAAC;QACD,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,WAAW,EACT,uBAAuB,IAAI,IAAI;YAC7B,CAAC,CAAC,GAAG,EAAE,CAAC,uBAAuB;YAC/B,CAAC,CAAC,SAAS;QACf,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,EACD,IAAA,6DAA+B,EAAC,gBAAgB,CAAC,EACjD,IAAA,yDAA+B,GAAE,CAClC,CAAC;AACJ,CAAC;AA7BD,oEA6BC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { OTLPGRPCExporterConfigNode } from '../types';\nimport { diag } from '@opentelemetry/api';\nimport {\n getOtlpGrpcDefaultConfiguration,\n mergeOtlpGrpcConfigurationWithDefaults,\n OtlpGrpcConfiguration,\n} from './otlp-grpc-configuration';\nimport { createEmptyMetadata } from '../grpc-exporter-transport';\nimport { getOtlpGrpcConfigurationFromEnv } from './otlp-grpc-env-configuration';\n\n/**\n * @deprecated\n * @param config\n * @param signalIdentifier\n */\nexport function convertLegacyOtlpGrpcOptions(\n config: OTLPGRPCExporterConfigNode,\n signalIdentifier: string\n): OtlpGrpcConfiguration {\n if (config.headers) {\n diag.warn('Headers cannot be set when using grpc');\n }\n\n // keep credentials locally in case user updates the reference on the config object\n const userProvidedCredentials = config.credentials;\n return mergeOtlpGrpcConfigurationWithDefaults(\n {\n url: config.url,\n metadata: () => {\n // metadata resolution strategy is merge, so we can return empty here, and it will not override the rest of the settings.\n return config.metadata ?? createEmptyMetadata();\n },\n compression: config.compression,\n timeoutMillis: config.timeoutMillis,\n concurrencyLimit: config.concurrencyLimit,\n credentials:\n userProvidedCredentials != null\n ? () => userProvidedCredentials\n : undefined,\n userAgent: config.userAgent,\n },\n getOtlpGrpcConfigurationFromEnv(signalIdentifier),\n getOtlpGrpcDefaultConfiguration()\n );\n}\n"]}
|
|
@@ -4,6 +4,7 @@ export interface OtlpGrpcConfiguration extends OtlpSharedConfiguration {
|
|
|
4
4
|
url: string;
|
|
5
5
|
metadata: () => Metadata;
|
|
6
6
|
credentials: () => ChannelCredentials;
|
|
7
|
+
userAgent?: string;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* Unresolved configuration where parts of the config may depend on other config options being resolved first.
|
|
@@ -18,7 +18,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.getOtlpGrpcDefaultConfiguration = exports.mergeOtlpGrpcConfigurationWithDefaults = exports.validateAndNormalizeUrl = void 0;
|
|
19
19
|
const otlp_exporter_base_1 = require("@opentelemetry/otlp-exporter-base");
|
|
20
20
|
const grpc_exporter_transport_1 = require("../grpc-exporter-transport");
|
|
21
|
-
const version_1 = require("../version");
|
|
22
21
|
const url_1 = require("url");
|
|
23
22
|
const api_1 = require("@opentelemetry/api");
|
|
24
23
|
function validateAndNormalizeUrl(url) {
|
|
@@ -67,17 +66,14 @@ function mergeOtlpGrpcConfigurationWithDefaults(userProvidedConfiguration, fallb
|
|
|
67
66
|
credentials: userProvidedConfiguration.credentials ??
|
|
68
67
|
fallbackConfiguration.credentials?.(rawUrl) ??
|
|
69
68
|
defaultConfiguration.credentials(rawUrl),
|
|
69
|
+
userAgent: userProvidedConfiguration.userAgent,
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
exports.mergeOtlpGrpcConfigurationWithDefaults = mergeOtlpGrpcConfigurationWithDefaults;
|
|
73
73
|
function getOtlpGrpcDefaultConfiguration() {
|
|
74
74
|
return {
|
|
75
75
|
...(0, otlp_exporter_base_1.getSharedConfigurationDefaults)(),
|
|
76
|
-
metadata: () =>
|
|
77
|
-
const metadata = (0, grpc_exporter_transport_1.createEmptyMetadata)();
|
|
78
|
-
metadata.set('User-Agent', `OTel-OTLP-Exporter-JavaScript/${version_1.VERSION}`);
|
|
79
|
-
return metadata;
|
|
80
|
-
},
|
|
76
|
+
metadata: () => (0, grpc_exporter_transport_1.createEmptyMetadata)(),
|
|
81
77
|
url: 'http://localhost:4317',
|
|
82
78
|
credentials: (url) => {
|
|
83
79
|
if (url.startsWith('http://')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlp-grpc-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-grpc-configuration.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,0EAI2C;AAC3C,wEAIoC;AACpC,
|
|
1
|
+
{"version":3,"file":"otlp-grpc-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-grpc-configuration.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,0EAI2C;AAC3C,wEAIoC;AACpC,6BAA0B;AAC1B,4CAA0C;AAyB1C,SAAgB,uBAAuB,CAAC,GAAW;IACjD,GAAG,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACnD,IAAI,CAAC,WAAW,EAAE;QAChB,GAAG,GAAG,WAAW,GAAG,EAAE,CAAC;KACxB;IACD,MAAM,MAAM,GAAG,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,EAAE;QAC/B,OAAO,GAAG,CAAC;KACZ;IACD,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,KAAK,GAAG,EAAE;QAC9C,UAAI,CAAC,IAAI,CACP,uFAAuF,CACxF,CAAC;KACH;IACD,IAAI,MAAM,CAAC,QAAQ,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,QAA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AqB,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC;YAC3C,oBAAoB,CAAC,WAAW,CAAC,MAAM,CAAC;QAC1C,SAAS,EAAE,yBAAyB,CAAC,SAAS;KAC/C,CAAC;AACJ,CAAC;AApCD,wFAoCC;AAED,SAAgB,+BAA+B;IAC7C,OAAO;QACL,GAAG,IAAA,mDAA8B,GAAE;QACnC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAA,6CAAmB,GAAE;QACrC,GAAG,EAAE,uBAAuB;QAC5B,WAAW,EAAE,CAAC,GAAW,EAAE,EAAE;YAC3B,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;gBAC7B,OAAO,GAAG,EAAE,CAAC,IAAA,mDAAyB,GAAE,CAAC;aAC1C;iBAAM;gBACL,OAAO,GAAG,EAAE,CAAC,IAAA,8CAAoB,GAAE,CAAC;aACrC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAbD,0EAaC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n getSharedConfigurationDefaults,\n mergeOtlpSharedConfigurationWithDefaults,\n OtlpSharedConfiguration,\n} from '@opentelemetry/otlp-exporter-base';\nimport {\n createEmptyMetadata,\n createInsecureCredentials,\n createSslCredentials,\n} from '../grpc-exporter-transport';\nimport { URL } from 'url';\nimport { diag } from '@opentelemetry/api';\n\n// NOTE: do not change this to be an actual import, doing so will break `@opentelemetry/instrumentation-grpc`\nimport type { ChannelCredentials, Metadata } from '@grpc/grpc-js';\n\nexport interface OtlpGrpcConfiguration extends OtlpSharedConfiguration {\n url: string;\n metadata: () => Metadata;\n credentials: () => ChannelCredentials;\n userAgent?: string;\n}\n\n/**\n * Unresolved configuration where parts of the config may depend on other config options being resolved first.\n */\nexport interface UnresolvedOtlpGrpcConfiguration\n extends OtlpSharedConfiguration {\n url: string;\n metadata: () => Metadata;\n /**\n * Credentials are based on the final resolved URL\n */\n credentials: (url: string) => () => ChannelCredentials;\n}\n\nexport function validateAndNormalizeUrl(url: string): string {\n url = url.trim();\n const hasProtocol = url.match(/^([\\w]{1,8}):\\/\\//);\n if (!hasProtocol) {\n url = `https://${url}`;\n }\n const target = new URL(url);\n if (target.protocol === 'unix:') {\n return url;\n }\n if (target.pathname && target.pathname !== '/') {\n diag.warn(\n 'URL path should not be set when using grpc, the path part of the URL will be ignored.'\n );\n }\n if (target.protocol !== '' && !target.protocol?.match(/^(http)s?:$/)) {\n diag.warn('URL protocol should be http(s)://. Using http://.');\n }\n return target.host;\n}\n\nfunction overrideMetadataEntriesIfNotPresent(\n metadata: Metadata,\n additionalMetadata: Metadata\n): void {\n for (const [key, value] of Object.entries(additionalMetadata.getMap())) {\n // only override with env var data if the key has no values.\n // not using Metadata.merge() as it will keep both values.\n if (metadata.get(key).length < 1) {\n metadata.set(key, value);\n }\n }\n}\n\nexport function mergeOtlpGrpcConfigurationWithDefaults(\n userProvidedConfiguration: Partial<OtlpGrpcConfiguration>,\n fallbackConfiguration: Partial<UnresolvedOtlpGrpcConfiguration>,\n defaultConfiguration: UnresolvedOtlpGrpcConfiguration\n): OtlpGrpcConfiguration {\n const rawUrl =\n userProvidedConfiguration.url ??\n fallbackConfiguration.url ??\n defaultConfiguration.url;\n\n return {\n ...mergeOtlpSharedConfigurationWithDefaults(\n userProvidedConfiguration,\n fallbackConfiguration,\n defaultConfiguration\n ),\n metadata: () => {\n const metadata = defaultConfiguration.metadata();\n overrideMetadataEntriesIfNotPresent(\n metadata,\n // clone to ensure we don't modify what the user gave us in case they hold on to the returned reference\n userProvidedConfiguration.metadata?.().clone() ?? createEmptyMetadata()\n );\n overrideMetadataEntriesIfNotPresent(\n metadata,\n fallbackConfiguration.metadata?.() ?? createEmptyMetadata()\n );\n return metadata;\n },\n url: validateAndNormalizeUrl(rawUrl),\n credentials:\n userProvidedConfiguration.credentials ??\n fallbackConfiguration.credentials?.(rawUrl) ??\n defaultConfiguration.credentials(rawUrl),\n userAgent: userProvidedConfiguration.userAgent,\n };\n}\n\nexport function getOtlpGrpcDefaultConfiguration(): UnresolvedOtlpGrpcConfiguration {\n return {\n ...getSharedConfigurationDefaults(),\n metadata: () => createEmptyMetadata(),\n url: 'http://localhost:4317',\n credentials: (url: string) => {\n if (url.startsWith('http://')) {\n return () => createInsecureCredentials();\n } else {\n return () => createSslCredentials();\n }\n },\n };\n}\n"]}
|
|
@@ -16,6 +16,14 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.createOtlpGrpcExporterTransport = exports.GrpcExporterTransport = exports.createEmptyMetadata = exports.createSslCredentials = exports.createInsecureCredentials = void 0;
|
|
19
|
+
const version_1 = require("./version");
|
|
20
|
+
const DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${version_1.VERSION}`;
|
|
21
|
+
function createUserAgent(userAgent) {
|
|
22
|
+
if (userAgent) {
|
|
23
|
+
return `${userAgent} ${DEFAULT_USER_AGENT}`;
|
|
24
|
+
}
|
|
25
|
+
return DEFAULT_USER_AGENT;
|
|
26
|
+
}
|
|
19
27
|
// values taken from '@grpc/grpc-js` so that we don't need to require/import it.
|
|
20
28
|
const GRPC_COMPRESSION_NONE = 0;
|
|
21
29
|
const GRPC_COMPRESSION_GZIP = 2;
|
|
@@ -77,6 +85,7 @@ class GrpcExporterTransport {
|
|
|
77
85
|
try {
|
|
78
86
|
this._client = new clientConstructor(this._parameters.address, this._parameters.credentials(), {
|
|
79
87
|
'grpc.default_compression_algorithm': toGrpcCompression(this._parameters.compression),
|
|
88
|
+
'grpc.primary_user_agent': createUserAgent(this._parameters.userAgent),
|
|
80
89
|
});
|
|
81
90
|
}
|
|
82
91
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc-exporter-transport.js","sourceRoot":"","sources":["../../src/grpc-exporter-transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAeH,gFAAgF;AAChF,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC,SAAS,iBAAiB,CAAC,WAA4B;IACrD,OAAO,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,qBAAqB,CAAC;AAChF,CAAC;AAED,SAAgB,yBAAyB;IACvC,iHAAiH;IACjH,MAAM,EACJ,WAAW;IACX,iEAAiE;MAClE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7B,OAAO,WAAW,CAAC,cAAc,EAAE,CAAC;AACtC,CAAC;AAPD,8DAOC;AAED,SAAgB,oBAAoB,CAClC,QAAiB,EACjB,UAAmB,EACnB,SAAkB;IAElB,iHAAiH;IACjH,MAAM,EACJ,WAAW;IACX,iEAAiE;MAClE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7B,OAAO,WAAW,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AAChE,CAAC;AAXD,oDAWC;AAED,SAAgB,mBAAmB;IACjC,iHAAiH;IACjH,MAAM,EACJ,QAAQ;IACR,iEAAiE;MAClE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7B,OAAO,IAAI,QAAQ,EAAE,CAAC;AACxB,CAAC;AAPD,kDAOC;
|
|
1
|
+
{"version":3,"file":"grpc-exporter-transport.js","sourceRoot":"","sources":["../../src/grpc-exporter-transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAeH,uCAAoC;AAEpC,MAAM,kBAAkB,GAAG,iC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IAAI,IAAI,EAAE;gBAC1B,OAAO,OAAO,CAAC;oBACb,KAAK,EAAE,IAAI,KAAK,CAAC,mBAAmB,CAAC;oBACrC,MAAM,EAAE,SAAS;iBAClB,CAAC,CAAC;aACJ;YAED,6DAA6D;YAC7D,qHAAqH;YACrH,IAAI,CAAC,OAAO,CAAC,MAAM,CACjB,MAAM,EACN,IAAI,CAAC,SAAS,EACd,EAAE,QAAQ,EAAE,QAAQ,EAAE,EACtB,CAAC,GAAiB,EAAE,QAAgB,EAAE,EAAE;gBACtC,IAAI,GAAG,EAAE;oBACP,OAAO,CAAC;wBACN,MAAM,EAAE,SAAS;wBACjB,KAAK,EAAE,GAAG;qBACX,CAAC,CAAC;iBACJ;qBAAM;oBACL,OAAO,CAAC;wBACN,IAAI,EAAE,QAAQ;wBACd,MAAM,EAAE,SAAS;qBAClB,CAAC,CAAC;iBACJ;YACH,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1FD,sDA0FC;AAED,SAAgB,+BAA+B,CAC7C,OAAwC;IAExC,OAAO,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC;AAJD,0EAIC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// NOTE: do not change these type imports to actual imports. Doing so WILL break `@opentelemetry/instrumentation-http`,\n// as they'd be imported before the http/https modules can be wrapped.\nimport type {\n Metadata,\n ServiceError,\n ChannelCredentials,\n Client,\n ServiceClientConstructor,\n} from '@grpc/grpc-js';\nimport {\n ExportResponse,\n IExporterTransport,\n} from '@opentelemetry/otlp-exporter-base';\nimport { VERSION } from './version';\n\nconst DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION}`;\n\nfunction createUserAgent(userAgent: string | undefined) {\n if (userAgent) {\n return `${userAgent} ${DEFAULT_USER_AGENT}`;\n }\n return DEFAULT_USER_AGENT;\n}\n\n// values taken from '@grpc/grpc-js` so that we don't need to require/import it.\nconst GRPC_COMPRESSION_NONE = 0;\nconst GRPC_COMPRESSION_GZIP = 2;\n\nfunction toGrpcCompression(compression: 'gzip' | 'none'): number {\n return compression === 'gzip' ? GRPC_COMPRESSION_GZIP : GRPC_COMPRESSION_NONE;\n}\n\nexport function createInsecureCredentials(): ChannelCredentials {\n // Lazy-load so that we don't need to require/import '@grpc/grpc-js' before it can be wrapped by instrumentation.\n const {\n credentials,\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n } = require('@grpc/grpc-js');\n return credentials.createInsecure();\n}\n\nexport function createSslCredentials(\n rootCert?: Buffer,\n privateKey?: Buffer,\n certChain?: Buffer\n): ChannelCredentials {\n // Lazy-load so that we don't need to require/import '@grpc/grpc-js' before it can be wrapped by instrumentation.\n const {\n credentials,\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n } = require('@grpc/grpc-js');\n return credentials.createSsl(rootCert, privateKey, certChain);\n}\n\nexport function createEmptyMetadata(): Metadata {\n // Lazy-load so that we don't need to require/import '@grpc/grpc-js' before it can be wrapped by instrumentation.\n const {\n Metadata,\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n } = require('@grpc/grpc-js');\n return new Metadata();\n}\n\nexport interface GrpcExporterTransportParameters {\n grpcPath: string;\n grpcName: string;\n address: string;\n /**\n * NOTE: Ensure that you're only importing/requiring gRPC inside the function providing the channel credentials,\n * otherwise, gRPC and http/https instrumentations may break.\n *\n * For common cases, you can avoid to import/require gRPC your function by using\n * - {@link createSslCredentials}\n * - {@link createInsecureCredentials}\n */\n credentials: () => ChannelCredentials;\n /**\n * NOTE: Ensure that you're only importing/requiring gRPC inside the function providing the metadata,\n * otherwise, gRPC and http/https instrumentations may break.\n *\n * To avoid having to import/require gRPC from your function to create a new Metadata object,\n * use {@link createEmptyMetadata}\n */\n metadata: () => Metadata;\n compression: 'gzip' | 'none';\n userAgent?: string;\n}\n\nexport class GrpcExporterTransport implements IExporterTransport {\n private _client?: Client;\n private _metadata?: Metadata;\n\n constructor(private _parameters: GrpcExporterTransportParameters) {}\n\n shutdown() {\n this._client?.close();\n }\n\n send(data: Uint8Array, timeoutMillis: number): Promise<ExportResponse> {\n // We need to make a for gRPC\n const buffer = Buffer.from(data);\n\n if (this._client == null) {\n // Lazy require to ensure that grpc is not loaded before instrumentations can wrap it\n const {\n createServiceClientConstructor,\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n } = require('./create-service-client-constructor');\n\n try {\n this._metadata = this._parameters.metadata();\n } catch (error) {\n return Promise.resolve({\n status: 'failure',\n error: error,\n });\n }\n\n const clientConstructor: ServiceClientConstructor =\n createServiceClientConstructor(\n this._parameters.grpcPath,\n this._parameters.grpcName\n );\n\n try {\n this._client = new clientConstructor(\n this._parameters.address,\n this._parameters.credentials(),\n {\n 'grpc.default_compression_algorithm': toGrpcCompression(\n this._parameters.compression\n ),\n 'grpc.primary_user_agent': createUserAgent(\n this._parameters.userAgent\n ),\n }\n );\n } catch (error) {\n return Promise.resolve({\n status: 'failure',\n error: error,\n });\n }\n }\n\n return new Promise<ExportResponse>(resolve => {\n const deadline = Date.now() + timeoutMillis;\n\n // this should never happen\n if (this._metadata == null) {\n return resolve({\n error: new Error('metadata was null'),\n status: 'failure',\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore The gRPC client constructor is created on runtime, so we don't have any types for the resulting client.\n this._client.export(\n buffer,\n this._metadata,\n { deadline: deadline },\n (err: ServiceError, response: Buffer) => {\n if (err) {\n resolve({\n status: 'failure',\n error: err,\n });\n } else {\n resolve({\n data: response,\n status: 'success',\n });\n }\n }\n );\n });\n }\n}\n\nexport function createOtlpGrpcExporterTransport(\n options: GrpcExporterTransportParameters\n): IExporterTransport {\n return new GrpcExporterTransport(options);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlp-grpc-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-grpc-export-delegate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,0EAG2C;AAG3C,uEAA4E;AAE5E,SAAgB,4BAA4B,CAC1C,OAA8B,EAC9B,UAA2C,EAC3C,QAAgB,EAChB,QAAgB;IAEhB,OAAO,IAAA,oDAA+B,EACpC,OAAO,EACP,UAAU,EACV,IAAA,yDAA+B,EAAC;QAC9B,OAAO,EAAE,OAAO,CAAC,GAAG;QACpB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,QAAQ;QACR,QAAQ;KACT,CAAC,CACH,CAAC;AACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"otlp-grpc-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-grpc-export-delegate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,0EAG2C;AAG3C,uEAA4E;AAE5E,SAAgB,4BAA4B,CAC1C,OAA8B,EAC9B,UAA2C,EAC3C,QAAgB,EAChB,QAAgB;IAEhB,OAAO,IAAA,oDAA+B,EACpC,OAAO,EACP,UAAU,EACV,IAAA,yDAA+B,EAAC;QAC9B,OAAO,EAAE,OAAO,CAAC,GAAG;QACpB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,QAAQ;QACR,QAAQ;KACT,CAAC,CACH,CAAC;AACJ,CAAC;AAnBD,oEAmBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createOtlpNetworkExportDelegate,\n IOtlpExportDelegate,\n} from '@opentelemetry/otlp-exporter-base';\nimport { ISerializer } from '@opentelemetry/otlp-transformer';\nimport { OtlpGrpcConfiguration } from './configuration/otlp-grpc-configuration';\nimport { createOtlpGrpcExporterTransport } from './grpc-exporter-transport';\n\nexport function createOtlpGrpcExportDelegate<Internal, Response>(\n options: OtlpGrpcConfiguration,\n serializer: ISerializer<Internal, Response>,\n grpcName: string,\n grpcPath: string\n): IOtlpExportDelegate<Internal> {\n return createOtlpNetworkExportDelegate(\n options,\n serializer,\n createOtlpGrpcExporterTransport({\n address: options.url,\n compression: options.compression,\n credentials: options.credentials,\n metadata: options.metadata,\n userAgent: options.userAgent,\n grpcName,\n grpcPath,\n })\n );\n}\n"]}
|
package/build/src/types.d.ts
CHANGED
package/build/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ChannelCredentials, Metadata } from '@grpc/grpc-js';\n\nimport {\n CompressionAlgorithm,\n OTLPExporterConfigBase,\n} from '@opentelemetry/otlp-exporter-base';\n\n/**\n * OTLP Exporter Config for Node\n */\nexport interface OTLPGRPCExporterConfigNode extends OTLPExporterConfigBase {\n credentials?: ChannelCredentials;\n metadata?: Metadata;\n compression?: CompressionAlgorithm;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ChannelCredentials, Metadata } from '@grpc/grpc-js';\n\nimport {\n CompressionAlgorithm,\n OTLPExporterConfigBase,\n} from '@opentelemetry/otlp-exporter-base';\n\n/**\n * OTLP Exporter Config for Node\n */\nexport interface OTLPGRPCExporterConfigNode extends OTLPExporterConfigBase {\n credentials?: ChannelCredentials;\n metadata?: Metadata;\n compression?: CompressionAlgorithm;\n userAgent?: string;\n}\n"]}
|
package/build/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.207.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/src/version.js
CHANGED
package/build/src/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.207.0';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/otlp-grpc-exporter-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.207.0",
|
|
4
4
|
"description": "OpenTelemetry OTLP-gRPC Exporter base (for internal use only)",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"types": "build/src/index.d.ts",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@opentelemetry/api": "1.9.0",
|
|
49
|
-
"@opentelemetry/resources": "2.
|
|
50
|
-
"@opentelemetry/sdk-trace-base": "2.
|
|
49
|
+
"@opentelemetry/resources": "2.2.0",
|
|
50
|
+
"@opentelemetry/sdk-trace-base": "2.2.0",
|
|
51
51
|
"@types/mocha": "10.0.10",
|
|
52
52
|
"@types/node": "18.6.5",
|
|
53
53
|
"@types/sinon": "17.0.4",
|
|
54
|
-
"mocha": "11.7.
|
|
54
|
+
"mocha": "11.7.4",
|
|
55
55
|
"nyc": "17.1.0",
|
|
56
56
|
"sinon": "18.0.1",
|
|
57
57
|
"ts-loader": "9.5.4",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@grpc/grpc-js": "^1.7.1",
|
|
65
|
-
"@opentelemetry/core": "2.
|
|
66
|
-
"@opentelemetry/otlp-exporter-base": "0.
|
|
67
|
-
"@opentelemetry/otlp-transformer": "0.
|
|
65
|
+
"@opentelemetry/core": "2.2.0",
|
|
66
|
+
"@opentelemetry/otlp-exporter-base": "0.207.0",
|
|
67
|
+
"@opentelemetry/otlp-transformer": "0.207.0"
|
|
68
68
|
},
|
|
69
69
|
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-grpc-exporter-base",
|
|
70
70
|
"sideEffects": false,
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "fb6476d8243ac8dcaaea74130b9c50c43938275c"
|
|
72
72
|
}
|