@opentelemetry/otlp-grpc-exporter-base 0.212.0 → 0.213.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.map +1 -1
- package/build/src/configuration/otlp-grpc-configuration.js +1 -12
- package/build/src/configuration/otlp-grpc-configuration.js.map +1 -1
- package/build/src/configuration/otlp-grpc-env-configuration.js.map +1 -1
- package/build/src/create-service-client-constructor.js +1 -12
- package/build/src/create-service-client-constructor.js.map +1 -1
- package/build/src/grpc-exporter-transport.js +1 -12
- package/build/src/grpc-exporter-transport.js.map +1 -1
- package/build/src/index.js +1 -12
- package/build/src/index.js.map +1 -1
- package/build/src/otlp-grpc-export-delegate.js +1 -12
- package/build/src/otlp-grpc-export-delegate.js.map +1 -1
- package/build/src/types.js +1 -12
- 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 +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-legacy-otlp-grpc-options.js","sourceRoot":"","sources":["../../../src/configuration/convert-legacy-otlp-grpc-options.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"convert-legacy-otlp-grpc-options.js","sourceRoot":"","sources":["../../../src/configuration/convert-legacy-otlp-grpc-options.ts"],"names":[],"mappings":";;;AAKA,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 * SPDX-License-Identifier: Apache-2.0\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"]}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
7
|
exports.getOtlpGrpcDefaultConfiguration = exports.mergeOtlpGrpcConfigurationWithDefaults = exports.validateAndNormalizeUrl = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlp-grpc-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-grpc-configuration.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"otlp-grpc-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-grpc-configuration.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;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,mBA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G,EAAE;YACb,MAAM,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,EAAE,CAAC;YACjD,mCAAmC,CACjC,QAAQ;YACR,uGAAuG;YACvG,yBAAyB,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,IAAA,6CAAmB,GAAE,CACxE,CAAC;YACF,mCAAmC,CACjC,QAAQ,EACR,qBAAqB,CAAC,QAAQ,EAAE,EAAE,IAAI,IAAA,6CAAmB,GAAE,CAC5D,CAAC;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,GAAG,EAAE,uBAAuB,CAAC,MAAM,CAAC;QACpC,WAAW,EACT,yBAAyB,CAAC,WAAW;YACrC,qBAAqB,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 * SPDX-License-Identifier: Apache-2.0\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlp-grpc-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-grpc-env-configuration.ts"],"names":[],"mappings":";;;AAiBA,8CAA8D;AAC9D,wEAIoC;AACpC,2EAAoG;AACpG,yBAAyB;AACzB,6BAA6B;AAC7B,4CAA0C;AAE1C,SAAS,wBAAwB,CAC/B,cAAuB,EACvB,iBAA0B;IAE1B,IAAI,cAAc,IAAI,IAAI,IAAI,cAAc,KAAK,EAAE,EAAE;QACnD,OAAO,cAAc,CAAC;KACvB;IAED,IAAI,iBAAiB,IAAI,IAAI,IAAI,iBAAiB,KAAK,EAAE,EAAE;QACzD,OAAO,iBAAiB,CAAC;KAC1B;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,kBAAkB,CAAC,gBAAwB;IAClD,MAAM,wBAAwB,GAC5B,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D,CAAC;AAED,SAAgB,+BAA+B,CAC7C,gBAAwB;IAExB,OAAO;QACL,GAAG,IAAA,iDAAqC,EAAC,gBAAgB,CAAC;QAC1D,QAAQ,EAAE,0BAA0B,CAAC,gBAAgB,CAAC;QACtD,GAAG,EAAE,aAAa,CAAC,gBAAgB,CAAC;QACpC,WAAW,EAAE,CAAC,gBAAwB,EAAE,EAAE;YACxC,4HAA4H;YAC5H,iDAAiD;YACjD,kGAAkG;YAClG,kHAAkH;YAClH,IAAI,gBAAgB,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;gBAC1C,OAAO,GAAG,EAAE;oBACV,OAAO,IAAA,mDAAyB,GAAE,CAAC;gBACrC,CAAC,CAAC;aACH;iBAAM,IAAI,gBAAgB,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;gBAClD,OAAO,GAAG,EAAE;oBACV,OAAO,mCAAmC,CAAC,gBAAgB,CAAC,CAAC;gBAC/D,CAAC,CAAC;aACH;YAED,qCAAqC;YACrC,OAAO,GAAG,EAAE;gBACV,OAAO,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;YACjD,CAAC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AA5BD,0EA4BC","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 { UnresolvedOtlpGrpcConfiguration } from './otlp-grpc-configuration';\nimport type { ChannelCredentials, Metadata } from '@grpc/grpc-js';\nimport { parseKeyPairsIntoRecord } from '@opentelemetry/core';\nimport {\n createEmptyMetadata,\n createInsecureCredentials,\n createSslCredentials,\n} from '../grpc-exporter-transport';\nimport { getSharedConfigurationFromEnvironment } from '@opentelemetry/otlp-exporter-base/node-http';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { diag } from '@opentelemetry/api';\n\nfunction fallbackIfNullishOrBlank(\n signalSpecific?: string,\n nonSignalSpecific?: string\n): string | undefined {\n if (signalSpecific != null && signalSpecific !== '') {\n return signalSpecific;\n }\n\n if (nonSignalSpecific != null && nonSignalSpecific !== '') {\n return nonSignalSpecific;\n }\n\n return undefined;\n}\n\nfunction getMetadataFromEnv(signalIdentifier: string): Metadata | undefined {\n const signalSpecificRawHeaders =\n process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`]?.trim();\n const nonSignalSpecificRawHeaders =\n process.env['OTEL_EXPORTER_OTLP_HEADERS']?.trim();\n\n const signalSpecificHeaders = parseKeyPairsIntoRecord(\n signalSpecificRawHeaders\n );\n const nonSignalSpecificHeaders = parseKeyPairsIntoRecord(\n nonSignalSpecificRawHeaders\n );\n\n if (\n Object.keys(signalSpecificHeaders).length === 0 &&\n Object.keys(nonSignalSpecificHeaders).length === 0\n ) {\n return undefined;\n }\n\n const mergeHeaders = Object.assign(\n {},\n nonSignalSpecificHeaders,\n signalSpecificHeaders\n );\n\n const metadata = createEmptyMetadata();\n\n // for this to work, metadata MUST be empty - otherwise `Metadata#set()` will merge items.\n for (const [key, value] of Object.entries(mergeHeaders)) {\n metadata.set(key, value);\n }\n\n return metadata;\n}\n\nfunction getMetadataProviderFromEnv(\n signalIdentifier: string\n): (() => Metadata) | undefined {\n const metadata = getMetadataFromEnv(signalIdentifier);\n if (metadata == null) {\n return undefined;\n }\n\n return () => metadata;\n}\n\nfunction getUrlFromEnv(signalIdentifier: string) {\n // This does not change the string beyond trimming on purpose.\n // Normally a user would just use a host and port for gRPC, but the OTLP Exporter specification requires us to\n // use the raw provided endpoint to derive credential settings. Therefore, we only normalize right when\n // we merge user-provided, env-provided and defaults together, and we have determined which credentials to use.\n //\n // Examples:\n // - example.test:4317 -> use secure credentials from environment (or provided via code)\n // - http://example.test:4317 -> use insecure credentials if nothing else is provided\n // - https://example.test:4317 -> use secure credentials from environment (or provided via code)\n\n const specificEndpoint =\n process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_ENDPOINT`]?.trim();\n const nonSpecificEndpoint =\n process.env[`OTEL_EXPORTER_OTLP_ENDPOINT`]?.trim();\n\n return fallbackIfNullishOrBlank(specificEndpoint, nonSpecificEndpoint);\n}\n\n/**\n * Determines whether the env var for insecure credentials is set to {@code true}.\n *\n * It will allow the following values as {@code true}\n * - 'true'\n * - 'true '\n * - ' true'\n * - 'TrUE'\n * - 'TRUE'\n *\n * It will not allow:\n * - 'true false'\n * - 'false true'\n * - 'true!'\n * - 'true,true'\n * - '1'\n * - ' '\n *\n * @param signalIdentifier\n */\nfunction getInsecureSettingFromEnv(signalIdentifier: string): boolean {\n const signalSpecificInsecureValue = process.env[\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_INSECURE`\n ]\n ?.toLowerCase()\n .trim();\n const nonSignalSpecificInsecureValue = process.env[\n `OTEL_EXPORTER_OTLP_INSECURE`\n ]\n ?.toLowerCase()\n .trim();\n\n return (\n fallbackIfNullishOrBlank(\n signalSpecificInsecureValue,\n nonSignalSpecificInsecureValue\n ) === 'true'\n );\n}\n\nfunction readFileFromEnv(\n signalSpecificEnvVar: string,\n nonSignalSpecificEnvVar: string,\n warningMessage: string\n): Buffer | undefined {\n const signalSpecificPath = process.env[signalSpecificEnvVar]?.trim();\n const nonSignalSpecificPath = process.env[nonSignalSpecificEnvVar]?.trim();\n\n const filePath = fallbackIfNullishOrBlank(\n signalSpecificPath,\n nonSignalSpecificPath\n );\n\n if (filePath != null) {\n try {\n return fs.readFileSync(path.resolve(process.cwd(), filePath));\n } catch {\n diag.warn(warningMessage);\n return undefined;\n }\n } else {\n return undefined;\n }\n}\n\nfunction getClientCertificateFromEnv(\n signalIdentifier: string\n): Buffer | undefined {\n return readFileFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_CLIENT_CERTIFICATE`,\n 'OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE',\n 'Failed to read client certificate chain file'\n );\n}\n\nfunction getClientKeyFromEnv(signalIdentifier: string): Buffer | undefined {\n return readFileFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_CLIENT_KEY`,\n 'OTEL_EXPORTER_OTLP_CLIENT_KEY',\n 'Failed to read client certificate private key file'\n );\n}\n\nfunction getRootCertificateFromEnv(\n signalIdentifier: string\n): Buffer | undefined {\n return readFileFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_CERTIFICATE`,\n 'OTEL_EXPORTER_OTLP_CERTIFICATE',\n 'Failed to read root certificate file'\n );\n}\n\nfunction getCredentialsFromEnvIgnoreInsecure(\n signalIdentifier: string\n): ChannelCredentials {\n const clientKey = getClientKeyFromEnv(signalIdentifier);\n const clientCertificate = getClientCertificateFromEnv(signalIdentifier);\n const rootCertificate = getRootCertificateFromEnv(signalIdentifier);\n\n // if the chain is not intact, @grpc/grpc-js will throw. This is fine when a user provides it in code, but env var\n // config is not allowed to throw, so we add this safeguard and try to make the best of it here.\n const clientChainIntact = clientKey != null && clientCertificate != null;\n if (rootCertificate != null && !clientChainIntact) {\n diag.warn(\n 'Client key and certificate must both be provided, but one was missing - attempting to create credentials from just the root certificate'\n );\n return createSslCredentials(getRootCertificateFromEnv(signalIdentifier));\n }\n\n return createSslCredentials(rootCertificate, clientKey, clientCertificate);\n}\n\nfunction getCredentialsFromEnv(signalIdentifier: string): ChannelCredentials {\n if (getInsecureSettingFromEnv(signalIdentifier)) {\n return createInsecureCredentials();\n }\n\n return getCredentialsFromEnvIgnoreInsecure(signalIdentifier);\n}\n\nexport function getOtlpGrpcConfigurationFromEnv(\n signalIdentifier: string\n): Partial<UnresolvedOtlpGrpcConfiguration> {\n return {\n ...getSharedConfigurationFromEnvironment(signalIdentifier),\n metadata: getMetadataProviderFromEnv(signalIdentifier),\n url: getUrlFromEnv(signalIdentifier),\n credentials: (finalResolvedUrl: string) => {\n // Always assume insecure on http:// and secure on https://, the protocol always takes precedence over the insecure setting.\n // note: the spec does not make any exception for\n // - \"localhost:4317\". If the protocol is omitted, credentials are required unless insecure is set\n // - \"unix://\", as it's neither http:// nor https:// and therefore credentials are required unless insecure is set\n if (finalResolvedUrl.startsWith('http://')) {\n return () => {\n return createInsecureCredentials();\n };\n } else if (finalResolvedUrl.startsWith('https://')) {\n return () => {\n return getCredentialsFromEnvIgnoreInsecure(signalIdentifier);\n };\n }\n\n // defer to env settings in this case\n return () => {\n return getCredentialsFromEnv(signalIdentifier);\n };\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"otlp-grpc-env-configuration.js","sourceRoot":"","sources":["../../../src/configuration/otlp-grpc-env-configuration.ts"],"names":[],"mappings":";;;AAMA,8CAA8D;AAC9D,wEAIoC;AACpC,2EAAoG;AACpG,yBAAyB;AACzB,6BAA6B;AAC7B,4CAA0C;AAE1C,SAAS,wBAAwB,CAC/B,cAAuB,EACvB,iBAA0B;IAE1B,IAAI,cAAc,IAAI,IAAI,IAAI,cAAc,KAAK,EAAE,EAAE;QACnD,OAAO,cAAc,CAAC;KACvB;IAED,IAAI,iBAAiB,IAAI,IAAI,IAAI,iBAAiB,KAAK,EAAE,EAAE;QACzD,OAAO,iBAAiB,CAAC;KAC1B;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,kBAAkB,CAAC,gBAAwB;IAClD,MAAM,wBAAwB,GAC5B,OAAO,CAAC,GAAG,CAAC,sBAAsB,gBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC;IACxE,MAAM,2BAA2B,GAC/B,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,EAAE,IAAI,EAAE,CAAC;IAEpD,MAAM,qBAAqB,GAAG,IAAA,8BAAuB,EACnD,wBAAwB,CACzB,CAAC;IACF,MAAM,wBAAwB,GAAG,IAAA,8BAAuB,EACtD,2BAA2B,C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kHAAkH;YAClH,IAAI,gBAAgB,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;gBAC1C,OAAO,GAAG,EAAE;oBACV,OAAO,IAAA,mDAAyB,GAAE,CAAC;gBACrC,CAAC,CAAC;aACH;iBAAM,IAAI,gBAAgB,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;gBAClD,OAAO,GAAG,EAAE;oBACV,OAAO,mCAAmC,CAAC,gBAAgB,CAAC,CAAC;gBAC/D,CAAC,CAAC;aACH;YAED,qCAAqC;YACrC,OAAO,GAAG,EAAE;gBACV,OAAO,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;YACjD,CAAC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AA5BD,0EA4BC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { UnresolvedOtlpGrpcConfiguration } from './otlp-grpc-configuration';\nimport type { ChannelCredentials, Metadata } from '@grpc/grpc-js';\nimport { parseKeyPairsIntoRecord } from '@opentelemetry/core';\nimport {\n createEmptyMetadata,\n createInsecureCredentials,\n createSslCredentials,\n} from '../grpc-exporter-transport';\nimport { getSharedConfigurationFromEnvironment } from '@opentelemetry/otlp-exporter-base/node-http';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { diag } from '@opentelemetry/api';\n\nfunction fallbackIfNullishOrBlank(\n signalSpecific?: string,\n nonSignalSpecific?: string\n): string | undefined {\n if (signalSpecific != null && signalSpecific !== '') {\n return signalSpecific;\n }\n\n if (nonSignalSpecific != null && nonSignalSpecific !== '') {\n return nonSignalSpecific;\n }\n\n return undefined;\n}\n\nfunction getMetadataFromEnv(signalIdentifier: string): Metadata | undefined {\n const signalSpecificRawHeaders =\n process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_HEADERS`]?.trim();\n const nonSignalSpecificRawHeaders =\n process.env['OTEL_EXPORTER_OTLP_HEADERS']?.trim();\n\n const signalSpecificHeaders = parseKeyPairsIntoRecord(\n signalSpecificRawHeaders\n );\n const nonSignalSpecificHeaders = parseKeyPairsIntoRecord(\n nonSignalSpecificRawHeaders\n );\n\n if (\n Object.keys(signalSpecificHeaders).length === 0 &&\n Object.keys(nonSignalSpecificHeaders).length === 0\n ) {\n return undefined;\n }\n\n const mergeHeaders = Object.assign(\n {},\n nonSignalSpecificHeaders,\n signalSpecificHeaders\n );\n\n const metadata = createEmptyMetadata();\n\n // for this to work, metadata MUST be empty - otherwise `Metadata#set()` will merge items.\n for (const [key, value] of Object.entries(mergeHeaders)) {\n metadata.set(key, value);\n }\n\n return metadata;\n}\n\nfunction getMetadataProviderFromEnv(\n signalIdentifier: string\n): (() => Metadata) | undefined {\n const metadata = getMetadataFromEnv(signalIdentifier);\n if (metadata == null) {\n return undefined;\n }\n\n return () => metadata;\n}\n\nfunction getUrlFromEnv(signalIdentifier: string) {\n // This does not change the string beyond trimming on purpose.\n // Normally a user would just use a host and port for gRPC, but the OTLP Exporter specification requires us to\n // use the raw provided endpoint to derive credential settings. Therefore, we only normalize right when\n // we merge user-provided, env-provided and defaults together, and we have determined which credentials to use.\n //\n // Examples:\n // - example.test:4317 -> use secure credentials from environment (or provided via code)\n // - http://example.test:4317 -> use insecure credentials if nothing else is provided\n // - https://example.test:4317 -> use secure credentials from environment (or provided via code)\n\n const specificEndpoint =\n process.env[`OTEL_EXPORTER_OTLP_${signalIdentifier}_ENDPOINT`]?.trim();\n const nonSpecificEndpoint =\n process.env[`OTEL_EXPORTER_OTLP_ENDPOINT`]?.trim();\n\n return fallbackIfNullishOrBlank(specificEndpoint, nonSpecificEndpoint);\n}\n\n/**\n * Determines whether the env var for insecure credentials is set to {@code true}.\n *\n * It will allow the following values as {@code true}\n * - 'true'\n * - 'true '\n * - ' true'\n * - 'TrUE'\n * - 'TRUE'\n *\n * It will not allow:\n * - 'true false'\n * - 'false true'\n * - 'true!'\n * - 'true,true'\n * - '1'\n * - ' '\n *\n * @param signalIdentifier\n */\nfunction getInsecureSettingFromEnv(signalIdentifier: string): boolean {\n const signalSpecificInsecureValue = process.env[\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_INSECURE`\n ]\n ?.toLowerCase()\n .trim();\n const nonSignalSpecificInsecureValue = process.env[\n `OTEL_EXPORTER_OTLP_INSECURE`\n ]\n ?.toLowerCase()\n .trim();\n\n return (\n fallbackIfNullishOrBlank(\n signalSpecificInsecureValue,\n nonSignalSpecificInsecureValue\n ) === 'true'\n );\n}\n\nfunction readFileFromEnv(\n signalSpecificEnvVar: string,\n nonSignalSpecificEnvVar: string,\n warningMessage: string\n): Buffer | undefined {\n const signalSpecificPath = process.env[signalSpecificEnvVar]?.trim();\n const nonSignalSpecificPath = process.env[nonSignalSpecificEnvVar]?.trim();\n\n const filePath = fallbackIfNullishOrBlank(\n signalSpecificPath,\n nonSignalSpecificPath\n );\n\n if (filePath != null) {\n try {\n return fs.readFileSync(path.resolve(process.cwd(), filePath));\n } catch {\n diag.warn(warningMessage);\n return undefined;\n }\n } else {\n return undefined;\n }\n}\n\nfunction getClientCertificateFromEnv(\n signalIdentifier: string\n): Buffer | undefined {\n return readFileFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_CLIENT_CERTIFICATE`,\n 'OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE',\n 'Failed to read client certificate chain file'\n );\n}\n\nfunction getClientKeyFromEnv(signalIdentifier: string): Buffer | undefined {\n return readFileFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_CLIENT_KEY`,\n 'OTEL_EXPORTER_OTLP_CLIENT_KEY',\n 'Failed to read client certificate private key file'\n );\n}\n\nfunction getRootCertificateFromEnv(\n signalIdentifier: string\n): Buffer | undefined {\n return readFileFromEnv(\n `OTEL_EXPORTER_OTLP_${signalIdentifier}_CERTIFICATE`,\n 'OTEL_EXPORTER_OTLP_CERTIFICATE',\n 'Failed to read root certificate file'\n );\n}\n\nfunction getCredentialsFromEnvIgnoreInsecure(\n signalIdentifier: string\n): ChannelCredentials {\n const clientKey = getClientKeyFromEnv(signalIdentifier);\n const clientCertificate = getClientCertificateFromEnv(signalIdentifier);\n const rootCertificate = getRootCertificateFromEnv(signalIdentifier);\n\n // if the chain is not intact, @grpc/grpc-js will throw. This is fine when a user provides it in code, but env var\n // config is not allowed to throw, so we add this safeguard and try to make the best of it here.\n const clientChainIntact = clientKey != null && clientCertificate != null;\n if (rootCertificate != null && !clientChainIntact) {\n diag.warn(\n 'Client key and certificate must both be provided, but one was missing - attempting to create credentials from just the root certificate'\n );\n return createSslCredentials(getRootCertificateFromEnv(signalIdentifier));\n }\n\n return createSslCredentials(rootCertificate, clientKey, clientCertificate);\n}\n\nfunction getCredentialsFromEnv(signalIdentifier: string): ChannelCredentials {\n if (getInsecureSettingFromEnv(signalIdentifier)) {\n return createInsecureCredentials();\n }\n\n return getCredentialsFromEnvIgnoreInsecure(signalIdentifier);\n}\n\nexport function getOtlpGrpcConfigurationFromEnv(\n signalIdentifier: string\n): Partial<UnresolvedOtlpGrpcConfiguration> {\n return {\n ...getSharedConfigurationFromEnvironment(signalIdentifier),\n metadata: getMetadataProviderFromEnv(signalIdentifier),\n url: getUrlFromEnv(signalIdentifier),\n credentials: (finalResolvedUrl: string) => {\n // Always assume insecure on http:// and secure on https://, the protocol always takes precedence over the insecure setting.\n // note: the spec does not make any exception for\n // - \"localhost:4317\". If the protocol is omitted, credentials are required unless insecure is set\n // - \"unix://\", as it's neither http:// nor https:// and therefore credentials are required unless insecure is set\n if (finalResolvedUrl.startsWith('http://')) {\n return () => {\n return createInsecureCredentials();\n };\n } else if (finalResolvedUrl.startsWith('https://')) {\n return () => {\n return getCredentialsFromEnvIgnoreInsecure(signalIdentifier);\n };\n }\n\n // defer to env settings in this case\n return () => {\n return getCredentialsFromEnv(signalIdentifier);\n };\n },\n };\n}\n"]}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
7
|
exports.createServiceClientConstructor = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-service-client-constructor.js","sourceRoot":"","sources":["../../src/create-service-client-constructor.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"create-service-client-constructor.js","sourceRoot":"","sources":["../../src/create-service-client-constructor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sCAAsC;AAEtC;;;;;;GAMG;AACH,SAAgB,8BAA8B,CAC5C,IAAY,EACZ,IAAY;IAEZ,MAAM,iBAAiB,GAAG;QACxB,MAAM,EAAE;YACN,IAAI,EAAE,IAAI;YACV,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,KAAK;YACrB,gBAAgB,EAAE,CAAC,GAAW,EAAE,EAAE;gBAChC,OAAO,GAAG,CAAC;YACb,CAAC;YACD,kBAAkB,EAAE,CAAC,GAAW,EAAE,EAAE;gBAClC,OAAO,GAAG,CAAC;YACb,CAAC;YACD,iBAAiB,EAAE,CAAC,GAAW,EAAE,EAAE;gBACjC,OAAO,GAAG,CAAC;YACb,CAAC;YACD,mBAAmB,EAAE,CAAC,GAAW,EAAE,EAAE;gBACnC,OAAO,GAAG,CAAC;YACb,CAAC;SACF;KACF,CAAC;IAEF,OAAO,IAAI,CAAC,4BAA4B,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;AACpE,CAAC;AAzBD,wEAyBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as grpc from '@grpc/grpc-js';\n\n/**\n * Creates a unary service client constructor that, when instantiated, does not serialize/deserialize anything.\n * Allows for passing in {@link Buffer} directly, serialization can be handled via protobufjs or custom implementations.\n *\n * @param path service path\n * @param name service name\n */\nexport function createServiceClientConstructor(\n path: string,\n name: string\n): grpc.ServiceClientConstructor {\n const serviceDefinition = {\n export: {\n path: path,\n requestStream: false,\n responseStream: false,\n requestSerialize: (arg: Buffer) => {\n return arg;\n },\n requestDeserialize: (arg: Buffer) => {\n return arg;\n },\n responseSerialize: (arg: Buffer) => {\n return arg;\n },\n responseDeserialize: (arg: Buffer) => {\n return arg;\n },\n },\n };\n\n return grpc.makeGenericClientConstructor(serviceDefinition, name);\n}\n"]}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
7
|
exports.createOtlpGrpcExporterTransport = exports.GrpcExporterTransport = exports.createEmptyMetadata = exports.createSslCredentials = exports.createInsecureCredentials = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc-exporter-transport.js","sourceRoot":"","sources":["../../src/grpc-exporter-transport.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"grpc-exporter-transport.js","sourceRoot":"","sources":["../../src/grpc-exporter-transport.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH,uCAAoC;AAEpC,MAAM,kBAAkB,GAAG,iCAAiC,iBAAO,EAAE,CAAC;AAEtE,SAAS,eAAe,CAAC,SAA6B;IACpD,IAAI,SAAS,EAAE;QACb,OAAO,GAAG,SAAS,IAAI,kBAAkB,EAAE,CAAC;KAC7C;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,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,MA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,CAAC,WAAW,CAAC,SAAS,CAC3B;iBACF,CACF,CAAC;aACH;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,OAAO,CAAC,OAAO,CAAC;oBACrB,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,KAAK;iBACb,CAAC,CAAC;aACJ;SACF;QAED,OAAO,IAAI,OAAO,CAAiB,OAAO,CAAC,EAAE;YAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,aAAa,CAAC;YAE5C,2BAA2B;YAC3B,IAAI,IAAI,CAAC,SAAS,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;AA7FD,sDA6FC;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 * SPDX-License-Identifier: Apache-2.0\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 private _parameters: GrpcExporterTransportParameters;\n\n constructor(parameters: GrpcExporterTransportParameters) {\n this._parameters = parameters;\n }\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"]}
|
package/build/src/index.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
7
|
exports.createOtlpGrpcExportDelegate = exports.convertLegacyOtlpGrpcOptions = void 0;
|
package/build/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qGAAgG;AAAvF,gJAAA,4BAA4B,OAAA;AACrC,yEAA2E;AAAlE,yIAAA,4BAA4B,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { convertLegacyOtlpGrpcOptions } from './configuration/convert-legacy-otlp-grpc-options';\nexport { createOtlpGrpcExportDelegate } from './otlp-grpc-export-delegate';\nexport type { OTLPGRPCExporterConfigNode } from './types';\n"]}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
7
|
exports.createOtlpGrpcExportDelegate = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlp-grpc-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-grpc-export-delegate.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"otlp-grpc-export-delegate.js","sourceRoot":"","sources":["../../src/otlp-grpc-export-delegate.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;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 * SPDX-License-Identifier: Apache-2.0\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.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright The OpenTelemetry Authors
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
7
|
//# sourceMappingURL=types.js.map
|
package/build/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA
|
|
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 { 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.213.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.213.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.213.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,8 +46,8 @@
|
|
|
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.6.0",
|
|
50
|
+
"@opentelemetry/sdk-trace-base": "2.6.0",
|
|
51
51
|
"@types/mocha": "10.0.10",
|
|
52
52
|
"@types/node": "18.19.130",
|
|
53
53
|
"@types/sinon": "17.0.4",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@grpc/grpc-js": "^1.14.3",
|
|
65
|
-
"@opentelemetry/core": "2.
|
|
66
|
-
"@opentelemetry/otlp-exporter-base": "0.
|
|
67
|
-
"@opentelemetry/otlp-transformer": "0.
|
|
65
|
+
"@opentelemetry/core": "2.6.0",
|
|
66
|
+
"@opentelemetry/otlp-exporter-base": "0.213.0",
|
|
67
|
+
"@opentelemetry/otlp-transformer": "0.213.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": "541e1b4ad83ad2093459794a18283228fe58d199"
|
|
72
72
|
}
|