@opentelemetry/otlp-grpc-exporter-base 0.49.1 → 0.51.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/OTLPGRPCExporterNodeBase.d.ts +10 -16
- package/build/src/OTLPGRPCExporterNodeBase.js +62 -43
- package/build/src/OTLPGRPCExporterNodeBase.js.map +1 -1
- package/build/src/create-service-client-constructor.d.ts +10 -0
- package/build/src/create-service-client-constructor.js +50 -0
- package/build/src/create-service-client-constructor.js.map +1 -0
- package/build/src/export-response.d.ts +10 -0
- package/build/src/export-response.js +18 -0
- package/build/src/export-response.js.map +1 -0
- package/build/src/exporter-transport.d.ts +6 -0
- package/build/src/exporter-transport.js +18 -0
- package/build/src/exporter-transport.js.map +1 -0
- package/build/src/grpc-exporter-transport.d.ts +40 -0
- package/build/src/grpc-exporter-transport.js +118 -0
- package/build/src/grpc-exporter-transport.js.map +1 -0
- package/build/src/index.d.ts +4 -3
- package/build/src/index.js +7 -15
- package/build/src/index.js.map +1 -1
- package/build/src/serializers.d.ts +12 -0
- package/build/src/serializers.js +56 -0
- package/build/src/serializers.js.map +1 -0
- package/build/src/types.d.ts +3 -15
- package/build/src/types.js +0 -7
- package/build/src/types.js.map +1 -1
- package/build/src/util.d.ts +6 -14
- package/build/src/util.js +26 -103
- package/build/src/util.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
- package/build/src/LogsExportServiceClient.d.ts +0 -3
- package/build/src/LogsExportServiceClient.js +0 -46
- package/build/src/LogsExportServiceClient.js.map +0 -1
- package/build/src/MetricsExportServiceClient.d.ts +0 -3
- package/build/src/MetricsExportServiceClient.js +0 -46
- package/build/src/MetricsExportServiceClient.js.map +0 -1
- package/build/src/TraceExportServiceClient.d.ts +0 -3
- package/build/src/TraceExportServiceClient.js +0 -46
- package/build/src/TraceExportServiceClient.js.map +0 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
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.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.MetricsSerializer = exports.TraceSerializer = exports.LogsSerializer = void 0;
|
|
19
|
+
const root = require("./generated/root");
|
|
20
|
+
const logsResponseType = root.opentelemetry.proto.collector.logs.v1
|
|
21
|
+
.ExportLogsServiceResponse;
|
|
22
|
+
const logsRequestType = root.opentelemetry.proto.collector.logs.v1
|
|
23
|
+
.ExportLogsServiceRequest;
|
|
24
|
+
const metricsResponseType = root.opentelemetry.proto.collector.metrics.v1
|
|
25
|
+
.ExportMetricsServiceResponse;
|
|
26
|
+
const metricsRequestType = root.opentelemetry.proto.collector.metrics.v1
|
|
27
|
+
.ExportMetricsServiceRequest;
|
|
28
|
+
const traceResponseType = root.opentelemetry.proto.collector.trace.v1
|
|
29
|
+
.ExportTraceServiceResponse;
|
|
30
|
+
const traceRequestType = root.opentelemetry.proto.collector.trace.v1
|
|
31
|
+
.ExportTraceServiceRequest;
|
|
32
|
+
exports.LogsSerializer = {
|
|
33
|
+
serializeRequest: (arg) => {
|
|
34
|
+
return Buffer.from(logsRequestType.encode(arg).finish());
|
|
35
|
+
},
|
|
36
|
+
deserializeResponse: (arg) => {
|
|
37
|
+
return logsResponseType.decode(arg);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
exports.TraceSerializer = {
|
|
41
|
+
serializeRequest: (arg) => {
|
|
42
|
+
return Buffer.from(traceRequestType.encode(arg).finish());
|
|
43
|
+
},
|
|
44
|
+
deserializeResponse: (arg) => {
|
|
45
|
+
return traceResponseType.decode(arg);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
exports.MetricsSerializer = {
|
|
49
|
+
serializeRequest: (arg) => {
|
|
50
|
+
return Buffer.from(metricsRequestType.encode(arg).finish());
|
|
51
|
+
},
|
|
52
|
+
deserializeResponse: (arg) => {
|
|
53
|
+
return metricsResponseType.decode(arg);
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=serializers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializers.js","sourceRoot":"","sources":["../../src/serializers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,yCAAyC;AAWzC,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;KAChE,yBAAmE,CAAC;AAEvE,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;KAC/D,wBAAiE,CAAC;AAErE,MAAM,mBAAmB,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;KACtE,4BAAyE,CAAC;AAE7E,MAAM,kBAAkB,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;KACrE,2BAAuE,CAAC;AAE3E,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;KAClE,0BAAqE,CAAC;AAEzE,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;KACjE,yBAAmE,CAAC;AAU1D,QAAA,cAAc,GAGvB;IACF,gBAAgB,EAAE,CAAC,GAA8B,EAAE,EAAE;QACnD,OAAO,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3D,CAAC;IACD,mBAAmB,EAAE,CAAC,GAAW,EAAE,EAAE;QACnC,OAAO,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;CACF,CAAC;AAEW,QAAA,eAAe,GAGxB;IACF,gBAAgB,EAAE,CAAC,GAA+B,EAAE,EAAE;QACpD,OAAO,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,mBAAmB,EAAE,CAAC,GAAW,EAAE,EAAE;QACnC,OAAO,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;CACF,CAAC;AAEW,QAAA,iBAAiB,GAG1B;IACF,gBAAgB,EAAE,CAAC,GAAiC,EAAE,EAAE;QACtD,OAAO,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,mBAAmB,EAAE,CAAC,GAAW,EAAE,EAAE;QACnC,OAAO,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;CACF,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\nimport * as root from './generated/root';\nimport {\n IExportLogsServiceRequest,\n IExportLogsServiceResponse,\n IExportMetricsServiceRequest,\n IExportMetricsServiceResponse,\n IExportTraceServiceRequest,\n IExportTraceServiceResponse,\n} from '@opentelemetry/otlp-transformer';\nimport { ExportType } from './internal-types';\n\nconst logsResponseType = root.opentelemetry.proto.collector.logs.v1\n .ExportLogsServiceResponse as ExportType<IExportLogsServiceResponse>;\n\nconst logsRequestType = root.opentelemetry.proto.collector.logs.v1\n .ExportLogsServiceRequest as ExportType<IExportLogsServiceRequest>;\n\nconst metricsResponseType = root.opentelemetry.proto.collector.metrics.v1\n .ExportMetricsServiceResponse as ExportType<IExportMetricsServiceResponse>;\n\nconst metricsRequestType = root.opentelemetry.proto.collector.metrics.v1\n .ExportMetricsServiceRequest as ExportType<IExportMetricsServiceRequest>;\n\nconst traceResponseType = root.opentelemetry.proto.collector.trace.v1\n .ExportTraceServiceResponse as ExportType<IExportTraceServiceResponse>;\n\nconst traceRequestType = root.opentelemetry.proto.collector.trace.v1\n .ExportTraceServiceRequest as ExportType<IExportTraceServiceRequest>;\n\n/**\n * Serializes and deserializes the OTLP request/response to and from {@link Uint8Array}\n */\nexport interface ISerializer<Request, Response> {\n serializeRequest(request: Request): Uint8Array | undefined;\n deserializeResponse(data: Uint8Array): Response;\n}\n\nexport const LogsSerializer: ISerializer<\n IExportLogsServiceRequest,\n IExportLogsServiceResponse\n> = {\n serializeRequest: (arg: IExportLogsServiceRequest) => {\n return Buffer.from(logsRequestType.encode(arg).finish());\n },\n deserializeResponse: (arg: Buffer) => {\n return logsResponseType.decode(arg);\n },\n};\n\nexport const TraceSerializer: ISerializer<\n IExportTraceServiceRequest,\n IExportTraceServiceResponse\n> = {\n serializeRequest: (arg: IExportTraceServiceRequest) => {\n return Buffer.from(traceRequestType.encode(arg).finish());\n },\n deserializeResponse: (arg: Buffer) => {\n return traceResponseType.decode(arg);\n },\n};\n\nexport const MetricsSerializer: ISerializer<\n IExportMetricsServiceRequest,\n IExportMetricsServiceResponse\n> = {\n serializeRequest: (arg: IExportMetricsServiceRequest) => {\n return Buffer.from(metricsRequestType.encode(arg).finish());\n },\n deserializeResponse: (arg: Buffer) => {\n return metricsResponseType.decode(arg);\n },\n};\n"]}
|
package/build/src/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ChannelCredentials, Metadata } from '@grpc/grpc-js';
|
|
2
2
|
import { CompressionAlgorithm, OTLPExporterConfigBase, OTLPExporterError } from '@opentelemetry/otlp-exporter-base';
|
|
3
3
|
/**
|
|
4
4
|
* Queue item to be used to save temporary spans/metrics/logs in case the GRPC service
|
|
@@ -9,24 +9,12 @@ export interface GRPCQueueItem<ExportedItem> {
|
|
|
9
9
|
onSuccess: () => void;
|
|
10
10
|
onError: (error: OTLPExporterError) => void;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Service Client for sending spans/metrics/logs
|
|
14
|
-
*/
|
|
15
|
-
export interface ServiceClient {
|
|
16
|
-
export: (request: any, metadata: grpc.Metadata, options: grpc.CallOptions, callback: Function) => {};
|
|
17
|
-
close(): void;
|
|
18
|
-
}
|
|
19
12
|
/**
|
|
20
13
|
* OTLP Exporter Config for Node
|
|
21
14
|
*/
|
|
22
15
|
export interface OTLPGRPCExporterConfigNode extends OTLPExporterConfigBase {
|
|
23
|
-
credentials?:
|
|
24
|
-
metadata?:
|
|
16
|
+
credentials?: ChannelCredentials;
|
|
17
|
+
metadata?: Metadata;
|
|
25
18
|
compression?: CompressionAlgorithm;
|
|
26
19
|
}
|
|
27
|
-
export declare enum ServiceClientType {
|
|
28
|
-
SPANS = 0,
|
|
29
|
-
METRICS = 1,
|
|
30
|
-
LOGS = 2
|
|
31
|
-
}
|
|
32
20
|
//# sourceMappingURL=types.d.ts.map
|
package/build/src/types.js
CHANGED
|
@@ -15,11 +15,4 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.ServiceClientType = void 0;
|
|
19
|
-
var ServiceClientType;
|
|
20
|
-
(function (ServiceClientType) {
|
|
21
|
-
ServiceClientType[ServiceClientType["SPANS"] = 0] = "SPANS";
|
|
22
|
-
ServiceClientType[ServiceClientType["METRICS"] = 1] = "METRICS";
|
|
23
|
-
ServiceClientType[ServiceClientType["LOGS"] = 2] = "LOGS";
|
|
24
|
-
})(ServiceClientType = exports.ServiceClientType || (exports.ServiceClientType = {}));
|
|
25
18
|
//# 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;;;;;;;;;;;;;;GAcG
|
|
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 OTLPExporterError,\n} from '@opentelemetry/otlp-exporter-base';\n\n/**\n * Queue item to be used to save temporary spans/metrics/logs in case the GRPC service\n * hasn't been fully initialized yet\n */\nexport interface GRPCQueueItem<ExportedItem> {\n objects: ExportedItem[];\n onSuccess: () => void;\n onError: (error: OTLPExporterError) => void;\n}\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"]}
|
package/build/src/util.d.ts
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { OTLPGRPCExporterConfigNode } from './types';
|
|
4
|
-
import { OTLPExporterError, CompressionAlgorithm } from '@opentelemetry/otlp-exporter-base';
|
|
1
|
+
import { CompressionAlgorithm } from '@opentelemetry/otlp-exporter-base';
|
|
2
|
+
import type { ChannelCredentials } from '@grpc/grpc-js';
|
|
5
3
|
export declare const DEFAULT_COLLECTOR_URL = "http://localhost:4317";
|
|
6
|
-
export declare function onInit<ExportItem, ServiceRequest>(collector: OTLPGRPCExporterNodeBase<ExportItem, ServiceRequest>, config: OTLPGRPCExporterConfigNode): void;
|
|
7
|
-
export declare function send<ExportItem, ServiceRequest>(collector: OTLPGRPCExporterNodeBase<ExportItem, ServiceRequest>, objects: ExportItem[], onSuccess: () => void, onError: (error: OTLPExporterError) => void): void;
|
|
8
4
|
export declare function validateAndNormalizeUrl(url: string): string;
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function useSecureConnection(): grpc.ChannelCredentials;
|
|
5
|
+
export declare function configureCredentials(credentials: ChannelCredentials | undefined, endpoint: string): ChannelCredentials;
|
|
11
6
|
/**
|
|
12
|
-
*
|
|
7
|
+
* Exported for testing
|
|
13
8
|
*/
|
|
14
|
-
export declare
|
|
15
|
-
|
|
16
|
-
GZIP = 2
|
|
17
|
-
}
|
|
18
|
-
export declare function configureCompression(compression: CompressionAlgorithm | undefined): GrpcCompressionAlgorithm;
|
|
9
|
+
export declare function getCredentialsFromEnvironment(): ChannelCredentials;
|
|
10
|
+
export declare function configureCompression(compression: CompressionAlgorithm | undefined): CompressionAlgorithm;
|
|
19
11
|
//# sourceMappingURL=util.d.ts.map
|
package/build/src/util.js
CHANGED
|
@@ -15,83 +15,15 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.configureCompression = exports.
|
|
19
|
-
const grpc = require("@grpc/grpc-js");
|
|
18
|
+
exports.configureCompression = exports.getCredentialsFromEnvironment = exports.configureCredentials = exports.validateAndNormalizeUrl = exports.DEFAULT_COLLECTOR_URL = void 0;
|
|
20
19
|
const api_1 = require("@opentelemetry/api");
|
|
21
20
|
const core_1 = require("@opentelemetry/core");
|
|
22
21
|
const path = require("path");
|
|
23
22
|
const url_1 = require("url");
|
|
24
23
|
const fs = require("fs");
|
|
25
|
-
const types_1 = require("./types");
|
|
26
24
|
const otlp_exporter_base_1 = require("@opentelemetry/otlp-exporter-base");
|
|
27
|
-
const
|
|
28
|
-
const TraceExportServiceClient_1 = require("./TraceExportServiceClient");
|
|
29
|
-
const LogsExportServiceClient_1 = require("./LogsExportServiceClient");
|
|
25
|
+
const grpc_exporter_transport_1 = require("./grpc-exporter-transport");
|
|
30
26
|
exports.DEFAULT_COLLECTOR_URL = 'http://localhost:4317';
|
|
31
|
-
function onInit(collector, config) {
|
|
32
|
-
collector.grpcQueue = [];
|
|
33
|
-
const credentials = configureSecurity(config.credentials, collector.getUrlFromConfig(config));
|
|
34
|
-
try {
|
|
35
|
-
if (collector.getServiceClientType() === types_1.ServiceClientType.SPANS) {
|
|
36
|
-
const client = new TraceExportServiceClient_1.TraceExportServiceClient(collector.url, credentials, {
|
|
37
|
-
'grpc.default_compression_algorithm': collector.compression.valueOf(),
|
|
38
|
-
});
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
collector.serviceClient = client;
|
|
42
|
-
}
|
|
43
|
-
else if (collector.getServiceClientType() === types_1.ServiceClientType.METRICS) {
|
|
44
|
-
const client = new MetricsExportServiceClient_1.MetricExportServiceClient(collector.url, credentials, {
|
|
45
|
-
'grpc.default_compression_algorithm': collector.compression.valueOf(),
|
|
46
|
-
});
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
collector.serviceClient = client;
|
|
50
|
-
}
|
|
51
|
-
else if (collector.getServiceClientType() === types_1.ServiceClientType.LOGS) {
|
|
52
|
-
const client = new LogsExportServiceClient_1.LogsExportServiceClient(collector.url, credentials, {
|
|
53
|
-
'grpc.default_compression_algorithm': collector.compression.valueOf(),
|
|
54
|
-
});
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
56
|
-
// @ts-ignore
|
|
57
|
-
collector.serviceClient = client;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
catch (err) {
|
|
61
|
-
(0, core_1.globalErrorHandler)(err);
|
|
62
|
-
}
|
|
63
|
-
if (collector.grpcQueue.length > 0) {
|
|
64
|
-
const queue = collector.grpcQueue.splice(0);
|
|
65
|
-
queue.forEach((item) => {
|
|
66
|
-
collector.send(item.objects, item.onSuccess, item.onError);
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.onInit = onInit;
|
|
71
|
-
function send(collector, objects, onSuccess, onError) {
|
|
72
|
-
if (collector.serviceClient) {
|
|
73
|
-
const serviceRequest = collector.convert(objects);
|
|
74
|
-
const deadline = Date.now() + collector.timeoutMillis;
|
|
75
|
-
collector.serviceClient.export(serviceRequest, collector.metadata || new grpc.Metadata(), { deadline: deadline }, (err) => {
|
|
76
|
-
if (err) {
|
|
77
|
-
api_1.diag.error('Service request', serviceRequest);
|
|
78
|
-
onError(err);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
api_1.diag.debug('Objects sent');
|
|
82
|
-
onSuccess();
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
collector.grpcQueue.push({
|
|
88
|
-
objects,
|
|
89
|
-
onSuccess,
|
|
90
|
-
onError,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.send = send;
|
|
95
27
|
function validateAndNormalizeUrl(url) {
|
|
96
28
|
var _a;
|
|
97
29
|
const hasProtocol = url.match(/^([\w]{1,8}):\/\//);
|
|
@@ -111,7 +43,7 @@ function validateAndNormalizeUrl(url) {
|
|
|
111
43
|
return target.host;
|
|
112
44
|
}
|
|
113
45
|
exports.validateAndNormalizeUrl = validateAndNormalizeUrl;
|
|
114
|
-
function
|
|
46
|
+
function configureCredentials(credentials, endpoint) {
|
|
115
47
|
let insecure;
|
|
116
48
|
if (credentials) {
|
|
117
49
|
return credentials;
|
|
@@ -127,13 +59,13 @@ function configureSecurity(credentials, endpoint) {
|
|
|
127
59
|
insecure = getSecurityFromEnv();
|
|
128
60
|
}
|
|
129
61
|
if (insecure) {
|
|
130
|
-
return
|
|
62
|
+
return (0, grpc_exporter_transport_1.createInsecureCredentials)();
|
|
131
63
|
}
|
|
132
64
|
else {
|
|
133
|
-
return
|
|
65
|
+
return getCredentialsFromEnvironment();
|
|
134
66
|
}
|
|
135
67
|
}
|
|
136
|
-
exports.
|
|
68
|
+
exports.configureCredentials = configureCredentials;
|
|
137
69
|
function getSecurityFromEnv() {
|
|
138
70
|
const definedInsecure = (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_TRACES_INSECURE ||
|
|
139
71
|
(0, core_1.getEnv)().OTEL_EXPORTER_OTLP_INSECURE;
|
|
@@ -144,13 +76,16 @@ function getSecurityFromEnv() {
|
|
|
144
76
|
return false;
|
|
145
77
|
}
|
|
146
78
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Exported for testing
|
|
81
|
+
*/
|
|
82
|
+
function getCredentialsFromEnvironment() {
|
|
83
|
+
const rootCert = retrieveRootCert();
|
|
84
|
+
const privateKey = retrievePrivateKey();
|
|
85
|
+
const certChain = retrieveCertChain();
|
|
86
|
+
return (0, grpc_exporter_transport_1.createSslCredentials)(rootCert, privateKey, certChain);
|
|
152
87
|
}
|
|
153
|
-
exports.
|
|
88
|
+
exports.getCredentialsFromEnvironment = getCredentialsFromEnvironment;
|
|
154
89
|
function retrieveRootCert() {
|
|
155
90
|
const rootCertificate = (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE ||
|
|
156
91
|
(0, core_1.getEnv)().OTEL_EXPORTER_OTLP_CERTIFICATE;
|
|
@@ -199,32 +134,20 @@ function retrieveCertChain() {
|
|
|
199
134
|
return undefined;
|
|
200
135
|
}
|
|
201
136
|
}
|
|
202
|
-
function toGrpcCompression(compression) {
|
|
203
|
-
if (compression === otlp_exporter_base_1.CompressionAlgorithm.NONE)
|
|
204
|
-
return GrpcCompressionAlgorithm.NONE;
|
|
205
|
-
else if (compression === otlp_exporter_base_1.CompressionAlgorithm.GZIP)
|
|
206
|
-
return GrpcCompressionAlgorithm.GZIP;
|
|
207
|
-
return GrpcCompressionAlgorithm.NONE;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* These values are defined by grpc client
|
|
211
|
-
*/
|
|
212
|
-
var GrpcCompressionAlgorithm;
|
|
213
|
-
(function (GrpcCompressionAlgorithm) {
|
|
214
|
-
GrpcCompressionAlgorithm[GrpcCompressionAlgorithm["NONE"] = 0] = "NONE";
|
|
215
|
-
GrpcCompressionAlgorithm[GrpcCompressionAlgorithm["GZIP"] = 2] = "GZIP";
|
|
216
|
-
})(GrpcCompressionAlgorithm = exports.GrpcCompressionAlgorithm || (exports.GrpcCompressionAlgorithm = {}));
|
|
217
137
|
function configureCompression(compression) {
|
|
218
|
-
if (compression) {
|
|
219
|
-
return
|
|
138
|
+
if (compression != null) {
|
|
139
|
+
return compression;
|
|
220
140
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return
|
|
225
|
-
|
|
226
|
-
|
|
141
|
+
const envCompression = (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_TRACES_COMPRESSION ||
|
|
142
|
+
(0, core_1.getEnv)().OTEL_EXPORTER_OTLP_COMPRESSION;
|
|
143
|
+
if (envCompression === 'gzip') {
|
|
144
|
+
return otlp_exporter_base_1.CompressionAlgorithm.GZIP;
|
|
145
|
+
}
|
|
146
|
+
else if (envCompression === 'none') {
|
|
147
|
+
return otlp_exporter_base_1.CompressionAlgorithm.NONE;
|
|
227
148
|
}
|
|
149
|
+
api_1.diag.warn('Unknown compression "' + envCompression + '", falling back to "none"');
|
|
150
|
+
return otlp_exporter_base_1.CompressionAlgorithm.NONE;
|
|
228
151
|
}
|
|
229
152
|
exports.configureCompression = configureCompression;
|
|
230
153
|
//# sourceMappingURL=util.js.map
|
package/build/src/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,sCAAsC;AACtC,4CAA0C;AAC1C,8CAAiE;AACjE,6BAA6B;AAE7B,6BAA0B;AAC1B,yBAAyB;AACzB,mCAIiB;AACjB,0EAI2C;AAE3C,6EAAyE;AACzE,yEAAsE;AACtE,uEAAoE;AAEvD,QAAA,qBAAqB,GAAG,uBAAuB,CAAC;AAE7D,SAAgB,MAAM,CACpB,SAA+D,EAC/D,MAAkC;IAElC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;IAEzB,MAAM,WAAW,GAA4B,iBAAiB,CAC5D,MAAM,CAAC,WAAW,EAClB,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,CACnC,CAAC;IAEF,IAAI;QACF,IAAI,SAAS,CAAC,oBAAoB,EAAE,KAAK,yBAAiB,CAAC,KAAK,EAAE;YAChE,MAAM,MAAM,GAAG,IAAI,mDAAwB,CAAC,SAAS,CAAC,GAAG,EAAE,WAAW,EAAE;gBACtE,oCAAoC,EAAE,SAAS,CAAC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SAAS,CAAC;SAClB;KACF;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED,SAAS,iBAAiB,CACxB,WAAiC;IAEjC,IAAI,WAAW,KAAK,yCAAoB,CAAC,IAAI;QAC3C,OAAO,wBAAwB,CAAC,IAAI,CAAC;SAClC,IAAI,WAAW,KAAK,yCAAoB,CAAC,IAAI;QAChD,OAAO,wBAAwB,CAAC,IAAI,CAAC;IACvC,OAAO,wBAAwB,CAAC,IAAI,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,IAAY,wBAGX;AAHD,WAAY,wBAAwB;IAClC,uEAAQ,CAAA;IACR,uEAAQ,CAAA;AACV,CAAC,EAHW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAGnC;AAED,SAAgB,oBAAoB,CAClC,WAA6C;IAE7C,IAAI,WAAW,EAAE;QACf,OAAO,iBAAiB,CAAC,WAAW,CAAC,CAAC;KACvC;SAAM;QACL,MAAM,kBAAkB,GACtB,IAAA,aAAM,GAAE,CAAC,qCAAqC;YAC9C,IAAA,aAAM,GAAE,CAAC,8BAA8B,CAAC;QAE1C,OAAO,kBAAkB,KAAK,MAAM;YAClC,CAAC,CAAC,wBAAwB,CAAC,IAAI;YAC/B,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC;KACnC;AACH,CAAC;AAdD,oDAcC","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 * as grpc from '@grpc/grpc-js';\nimport { diag } from '@opentelemetry/api';\nimport { getEnv, globalErrorHandler } from '@opentelemetry/core';\nimport * as path from 'path';\nimport { OTLPGRPCExporterNodeBase } from './OTLPGRPCExporterNodeBase';\nimport { URL } from 'url';\nimport * as fs from 'fs';\nimport {\n GRPCQueueItem,\n OTLPGRPCExporterConfigNode,\n ServiceClientType,\n} from './types';\nimport {\n ExportServiceError,\n OTLPExporterError,\n CompressionAlgorithm,\n} from '@opentelemetry/otlp-exporter-base';\n\nimport { MetricExportServiceClient } from './MetricsExportServiceClient';\nimport { TraceExportServiceClient } from './TraceExportServiceClient';\nimport { LogsExportServiceClient } from './LogsExportServiceClient';\n\nexport const DEFAULT_COLLECTOR_URL = 'http://localhost:4317';\n\nexport function onInit<ExportItem, ServiceRequest>(\n collector: OTLPGRPCExporterNodeBase<ExportItem, ServiceRequest>,\n config: OTLPGRPCExporterConfigNode\n): void {\n collector.grpcQueue = [];\n\n const credentials: grpc.ChannelCredentials = configureSecurity(\n config.credentials,\n collector.getUrlFromConfig(config)\n );\n\n try {\n if (collector.getServiceClientType() === ServiceClientType.SPANS) {\n const client = new TraceExportServiceClient(collector.url, credentials, {\n 'grpc.default_compression_algorithm': collector.compression.valueOf(),\n });\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n collector.serviceClient = client;\n } else if (collector.getServiceClientType() === ServiceClientType.METRICS) {\n const client = new MetricExportServiceClient(collector.url, credentials, {\n 'grpc.default_compression_algorithm': collector.compression.valueOf(),\n });\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n collector.serviceClient = client;\n } else if (collector.getServiceClientType() === ServiceClientType.LOGS) {\n const client = new LogsExportServiceClient(collector.url, credentials, {\n 'grpc.default_compression_algorithm': collector.compression.valueOf(),\n });\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n collector.serviceClient = client;\n }\n } catch (err) {\n globalErrorHandler(err);\n }\n if (collector.grpcQueue.length > 0) {\n const queue = collector.grpcQueue.splice(0);\n queue.forEach((item: GRPCQueueItem<ExportItem>) => {\n collector.send(item.objects, item.onSuccess, item.onError);\n });\n }\n}\n\nexport function send<ExportItem, ServiceRequest>(\n collector: OTLPGRPCExporterNodeBase<ExportItem, ServiceRequest>,\n objects: ExportItem[],\n onSuccess: () => void,\n onError: (error: OTLPExporterError) => void\n): void {\n if (collector.serviceClient) {\n const serviceRequest = collector.convert(objects);\n const deadline = Date.now() + collector.timeoutMillis;\n\n collector.serviceClient.export(\n serviceRequest,\n collector.metadata || new grpc.Metadata(),\n { deadline: deadline },\n (err: ExportServiceError) => {\n if (err) {\n diag.error('Service request', serviceRequest);\n onError(err);\n } else {\n diag.debug('Objects sent');\n onSuccess();\n }\n }\n );\n } else {\n collector.grpcQueue.push({\n objects,\n onSuccess,\n onError,\n });\n }\n}\n\nexport function validateAndNormalizeUrl(url: string): string {\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\nexport function configureSecurity(\n credentials: grpc.ChannelCredentials | undefined,\n endpoint: string\n): grpc.ChannelCredentials {\n let insecure: boolean;\n\n if (credentials) {\n return credentials;\n } else if (endpoint.startsWith('https://')) {\n insecure = false;\n } else if (\n endpoint.startsWith('http://') ||\n endpoint === DEFAULT_COLLECTOR_URL\n ) {\n insecure = true;\n } else {\n insecure = getSecurityFromEnv();\n }\n\n if (insecure) {\n return grpc.credentials.createInsecure();\n } else {\n return useSecureConnection();\n }\n}\n\nfunction getSecurityFromEnv(): boolean {\n const definedInsecure =\n getEnv().OTEL_EXPORTER_OTLP_TRACES_INSECURE ||\n getEnv().OTEL_EXPORTER_OTLP_INSECURE;\n\n if (definedInsecure) {\n return definedInsecure.toLowerCase() === 'true';\n } else {\n return false;\n }\n}\n\nexport function useSecureConnection(): grpc.ChannelCredentials {\n const rootCertPath = retrieveRootCert();\n const privateKeyPath = retrievePrivateKey();\n const certChainPath = retrieveCertChain();\n\n return grpc.credentials.createSsl(\n rootCertPath,\n privateKeyPath,\n certChainPath\n );\n}\n\nfunction retrieveRootCert(): Buffer | undefined {\n const rootCertificate =\n getEnv().OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE ||\n getEnv().OTEL_EXPORTER_OTLP_CERTIFICATE;\n\n if (rootCertificate) {\n try {\n return fs.readFileSync(path.resolve(process.cwd(), rootCertificate));\n } catch {\n diag.warn('Failed to read root certificate file');\n return undefined;\n }\n } else {\n return undefined;\n }\n}\n\nfunction retrievePrivateKey(): Buffer | undefined {\n const clientKey =\n getEnv().OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY ||\n getEnv().OTEL_EXPORTER_OTLP_CLIENT_KEY;\n\n if (clientKey) {\n try {\n return fs.readFileSync(path.resolve(process.cwd(), clientKey));\n } catch {\n diag.warn('Failed to read client certificate private key file');\n return undefined;\n }\n } else {\n return undefined;\n }\n}\n\nfunction retrieveCertChain(): Buffer | undefined {\n const clientChain =\n getEnv().OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE ||\n getEnv().OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE;\n\n if (clientChain) {\n try {\n return fs.readFileSync(path.resolve(process.cwd(), clientChain));\n } catch {\n diag.warn('Failed to read client certificate chain file');\n return undefined;\n }\n } else {\n return undefined;\n }\n}\n\nfunction toGrpcCompression(\n compression: CompressionAlgorithm\n): GrpcCompressionAlgorithm {\n if (compression === CompressionAlgorithm.NONE)\n return GrpcCompressionAlgorithm.NONE;\n else if (compression === CompressionAlgorithm.GZIP)\n return GrpcCompressionAlgorithm.GZIP;\n return GrpcCompressionAlgorithm.NONE;\n}\n\n/**\n * These values are defined by grpc client\n */\nexport enum GrpcCompressionAlgorithm {\n NONE = 0,\n GZIP = 2,\n}\n\nexport function configureCompression(\n compression: CompressionAlgorithm | undefined\n): GrpcCompressionAlgorithm {\n if (compression) {\n return toGrpcCompression(compression);\n } else {\n const definedCompression =\n getEnv().OTEL_EXPORTER_OTLP_TRACES_COMPRESSION ||\n getEnv().OTEL_EXPORTER_OTLP_COMPRESSION;\n\n return definedCompression === 'gzip'\n ? GrpcCompressionAlgorithm.GZIP\n : GrpcCompressionAlgorithm.NONE;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA0C;AAC1C,8CAA6C;AAC7C,6BAA6B;AAC7B,6BAA0B;AAC1B,yBAAyB;AACzB,0EAAyE;AACzE,uEAGmC;AAMtB,QAAA,qBAAqB,GAAG,uBAAuB,CAAC;AAE7D,SAAgB,uBAAuB,CAAC,GAAW;;IACjD,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,CAAA,MAAA,MAAM,CAAC,QAAQ,0CAAE,KAAK,CAAC,aAAa,CAAC,CAAA,EAAE;QACpE,UAAI,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;KAChE;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAlBD,0DAk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qC;QAC9C,IAAA,aAAM,GAAE,CAAC,8BAA8B,CAAC;IAE1C,IAAI,cAAc,KAAK,MAAM,EAAE;QAC7B,OAAO,yCAAoB,CAAC,IAAI,CAAC;KAClC;SAAM,IAAI,cAAc,KAAK,MAAM,EAAE;QACpC,OAAO,yCAAoB,CAAC,IAAI,CAAC;KAClC;IAED,UAAI,CAAC,IAAI,CACP,uBAAuB,GAAG,cAAc,GAAG,2BAA2B,CACvE,CAAC;IACF,OAAO,yCAAoB,CAAC,IAAI,CAAC;AACnC,CAAC;AArBD,oDAqBC","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 { diag } from '@opentelemetry/api';\nimport { getEnv } from '@opentelemetry/core';\nimport * as path from 'path';\nimport { URL } from 'url';\nimport * as fs from 'fs';\nimport { CompressionAlgorithm } from '@opentelemetry/otlp-exporter-base';\nimport {\n createInsecureCredentials,\n createSslCredentials,\n} from './grpc-exporter-transport';\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 { ChannelCredentials } from '@grpc/grpc-js';\n\nexport const DEFAULT_COLLECTOR_URL = 'http://localhost:4317';\n\nexport function validateAndNormalizeUrl(url: string): string {\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\nexport function configureCredentials(\n credentials: ChannelCredentials | undefined,\n endpoint: string\n): ChannelCredentials {\n let insecure: boolean;\n\n if (credentials) {\n return credentials;\n } else if (endpoint.startsWith('https://')) {\n insecure = false;\n } else if (\n endpoint.startsWith('http://') ||\n endpoint === DEFAULT_COLLECTOR_URL\n ) {\n insecure = true;\n } else {\n insecure = getSecurityFromEnv();\n }\n\n if (insecure) {\n return createInsecureCredentials();\n } else {\n return getCredentialsFromEnvironment();\n }\n}\n\nfunction getSecurityFromEnv(): boolean {\n const definedInsecure =\n getEnv().OTEL_EXPORTER_OTLP_TRACES_INSECURE ||\n getEnv().OTEL_EXPORTER_OTLP_INSECURE;\n\n if (definedInsecure) {\n return definedInsecure.toLowerCase() === 'true';\n } else {\n return false;\n }\n}\n\n/**\n * Exported for testing\n */\nexport function getCredentialsFromEnvironment(): ChannelCredentials {\n const rootCert = retrieveRootCert();\n const privateKey = retrievePrivateKey();\n const certChain = retrieveCertChain();\n\n return createSslCredentials(rootCert, privateKey, certChain);\n}\n\nfunction retrieveRootCert(): Buffer | undefined {\n const rootCertificate =\n getEnv().OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE ||\n getEnv().OTEL_EXPORTER_OTLP_CERTIFICATE;\n\n if (rootCertificate) {\n try {\n return fs.readFileSync(path.resolve(process.cwd(), rootCertificate));\n } catch {\n diag.warn('Failed to read root certificate file');\n return undefined;\n }\n } else {\n return undefined;\n }\n}\n\nfunction retrievePrivateKey(): Buffer | undefined {\n const clientKey =\n getEnv().OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY ||\n getEnv().OTEL_EXPORTER_OTLP_CLIENT_KEY;\n\n if (clientKey) {\n try {\n return fs.readFileSync(path.resolve(process.cwd(), clientKey));\n } catch {\n diag.warn('Failed to read client certificate private key file');\n return undefined;\n }\n } else {\n return undefined;\n }\n}\n\nfunction retrieveCertChain(): Buffer | undefined {\n const clientChain =\n getEnv().OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE ||\n getEnv().OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE;\n\n if (clientChain) {\n try {\n return fs.readFileSync(path.resolve(process.cwd(), clientChain));\n } catch {\n diag.warn('Failed to read client certificate chain file');\n return undefined;\n }\n } else {\n return undefined;\n }\n}\n\nexport function configureCompression(\n compression: CompressionAlgorithm | undefined\n): CompressionAlgorithm {\n if (compression != null) {\n return compression;\n }\n\n const envCompression =\n getEnv().OTEL_EXPORTER_OTLP_TRACES_COMPRESSION ||\n getEnv().OTEL_EXPORTER_OTLP_COMPRESSION;\n\n if (envCompression === 'gzip') {\n return CompressionAlgorithm.GZIP;\n } else if (envCompression === 'none') {\n return CompressionAlgorithm.NONE;\n }\n\n diag.warn(\n 'Unknown compression \"' + envCompression + '\", falling back to \"none\"'\n );\n return CompressionAlgorithm.NONE;\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.51.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,QAAQ,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,QAAQ,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.51.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.51.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",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@opentelemetry/api": "1.8.0",
|
|
52
|
-
"@opentelemetry/otlp-transformer": "0.
|
|
53
|
-
"@opentelemetry/resources": "1.
|
|
54
|
-
"@opentelemetry/sdk-trace-base": "1.
|
|
52
|
+
"@opentelemetry/otlp-transformer": "0.51.0",
|
|
53
|
+
"@opentelemetry/resources": "1.24.0",
|
|
54
|
+
"@opentelemetry/sdk-trace-base": "1.24.0",
|
|
55
55
|
"@types/mocha": "10.0.6",
|
|
56
56
|
"@types/node": "18.6.5",
|
|
57
57
|
"@types/sinon": "10.0.20",
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@grpc/grpc-js": "^1.7.1",
|
|
75
|
-
"@opentelemetry/core": "1.
|
|
76
|
-
"@opentelemetry/otlp-exporter-base": "0.
|
|
75
|
+
"@opentelemetry/core": "1.24.0",
|
|
76
|
+
"@opentelemetry/otlp-exporter-base": "0.51.0",
|
|
77
77
|
"protobufjs": "^7.2.3"
|
|
78
78
|
},
|
|
79
79
|
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-grpc-exporter-base",
|
|
80
80
|
"sideEffects": false,
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "3ab4f765d8d696327b7d139ae6a45e7bd7edd924"
|
|
82
82
|
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
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.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.LogsExportServiceClient = void 0;
|
|
19
|
-
const root = require("./generated/root");
|
|
20
|
-
const grpc = require("@grpc/grpc-js");
|
|
21
|
-
const responseType = root.opentelemetry.proto.collector.logs.v1
|
|
22
|
-
.ExportLogsServiceResponse;
|
|
23
|
-
const requestType = root.opentelemetry.proto.collector.logs.v1
|
|
24
|
-
.ExportLogsServiceRequest;
|
|
25
|
-
const logsServiceDefinition = {
|
|
26
|
-
export: {
|
|
27
|
-
path: '/opentelemetry.proto.collector.logs.v1.LogsService/Export',
|
|
28
|
-
requestStream: false,
|
|
29
|
-
responseStream: false,
|
|
30
|
-
requestSerialize: (arg) => {
|
|
31
|
-
return Buffer.from(requestType.encode(arg).finish());
|
|
32
|
-
},
|
|
33
|
-
requestDeserialize: (arg) => {
|
|
34
|
-
return requestType.decode(arg);
|
|
35
|
-
},
|
|
36
|
-
responseSerialize: (arg) => {
|
|
37
|
-
return Buffer.from(responseType.encode(arg).finish());
|
|
38
|
-
},
|
|
39
|
-
responseDeserialize: (arg) => {
|
|
40
|
-
return responseType.decode(arg);
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
// Creates a new instance of a gRPC service client for OTLP logs
|
|
45
|
-
exports.LogsExportServiceClient = grpc.makeGenericClientConstructor(logsServiceDefinition, 'LogsExportService');
|
|
46
|
-
//# sourceMappingURL=LogsExportServiceClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LogsExportServiceClient.js","sourceRoot":"","sources":["../../src/LogsExportServiceClient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,yCAAyC;AACzC,sCAAsC;AAOtC,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;KAC5D,yBAAmE,CAAC;AAEvE,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;KAC3D,wBAAiE,CAAC;AAErE,MAAM,qBAAqB,GAAG;IAC5B,MAAM,EAAE;QACN,IAAI,EAAE,2DAA2D;QACjE,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,KAAK;QACrB,gBAAgB,EAAE,CAAC,GAA8B,EAAE,EAAE;YACnD,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QACvD,CAAC;QACD,kBAAkB,EAAE,CAAC,GAAW,EAAE,EAAE;YAClC,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;QACD,iBAAiB,EAAE,CAAC,GAA+B,EAAE,EAAE;YACrD,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,mBAAmB,EAAE,CAAC,GAAW,EAAE,EAAE;YACnC,OAAO,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClC,CAAC;KACF;CACF,CAAC;AAEF,gEAAgE;AACnD,QAAA,uBAAuB,GAClC,IAAI,CAAC,4BAA4B,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,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\nimport * as root from './generated/root';\nimport * as grpc from '@grpc/grpc-js';\nimport {\n IExportLogsServiceRequest,\n IExportLogsServiceResponse,\n} from '@opentelemetry/otlp-transformer';\nimport { ExportType } from './internal-types';\n\nconst responseType = root.opentelemetry.proto.collector.logs.v1\n .ExportLogsServiceResponse as ExportType<IExportLogsServiceResponse>;\n\nconst requestType = root.opentelemetry.proto.collector.logs.v1\n .ExportLogsServiceRequest as ExportType<IExportLogsServiceRequest>;\n\nconst logsServiceDefinition = {\n export: {\n path: '/opentelemetry.proto.collector.logs.v1.LogsService/Export',\n requestStream: false,\n responseStream: false,\n requestSerialize: (arg: IExportLogsServiceRequest) => {\n return Buffer.from(requestType.encode(arg).finish());\n },\n requestDeserialize: (arg: Buffer) => {\n return requestType.decode(arg);\n },\n responseSerialize: (arg: IExportLogsServiceResponse) => {\n return Buffer.from(responseType.encode(arg).finish());\n },\n responseDeserialize: (arg: Buffer) => {\n return responseType.decode(arg);\n },\n },\n};\n\n// Creates a new instance of a gRPC service client for OTLP logs\nexport const LogsExportServiceClient: grpc.ServiceClientConstructor =\n grpc.makeGenericClientConstructor(logsServiceDefinition, 'LogsExportService');\n"]}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
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.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.MetricExportServiceClient = void 0;
|
|
19
|
-
const root = require("./generated/root");
|
|
20
|
-
const grpc = require("@grpc/grpc-js");
|
|
21
|
-
const responseType = root.opentelemetry.proto.collector.metrics.v1
|
|
22
|
-
.ExportMetricsServiceResponse;
|
|
23
|
-
const requestType = root.opentelemetry.proto.collector.metrics.v1
|
|
24
|
-
.ExportMetricsServiceRequest;
|
|
25
|
-
const metricsServiceDefinition = {
|
|
26
|
-
export: {
|
|
27
|
-
path: '/opentelemetry.proto.collector.metrics.v1.MetricsService/Export',
|
|
28
|
-
requestStream: false,
|
|
29
|
-
responseStream: false,
|
|
30
|
-
requestSerialize: (arg) => {
|
|
31
|
-
return Buffer.from(requestType.encode(arg).finish());
|
|
32
|
-
},
|
|
33
|
-
requestDeserialize: (arg) => {
|
|
34
|
-
return requestType.decode(arg);
|
|
35
|
-
},
|
|
36
|
-
responseSerialize: (arg) => {
|
|
37
|
-
return Buffer.from(responseType.encode(arg).finish());
|
|
38
|
-
},
|
|
39
|
-
responseDeserialize: (arg) => {
|
|
40
|
-
return responseType.decode(arg);
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
// Creates a new instance of a gRPC service client for OTLP metrics
|
|
45
|
-
exports.MetricExportServiceClient = grpc.makeGenericClientConstructor(metricsServiceDefinition, 'MetricsExportService');
|
|
46
|
-
//# sourceMappingURL=MetricsExportServiceClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MetricsExportServiceClient.js","sourceRoot":"","sources":["../../src/MetricsExportServiceClient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,yCAAyC;AACzC,sCAAsC;AAOtC,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;KAC/D,4BAAyE,CAAC;AAE7E,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;KAC9D,2BAAuE,CAAC;AAE3E,MAAM,wBAAwB,GAAG;IAC/B,MAAM,EAAE;QACN,IAAI,EAAE,iEAAiE;QACvE,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,KAAK;QACrB,gBAAgB,EAAE,CAAC,GAAiC,EAAE,EAAE;YACtD,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QACvD,CAAC;QACD,kBAAkB,EAAE,CAAC,GAAW,EAAE,EAAE;YAClC,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;QACD,iBAAiB,EAAE,CAAC,GAAkC,EAAE,EAAE;YACxD,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,mBAAmB,EAAE,CAAC,GAAW,EAAE,EAAE;YACnC,OAAO,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClC,CAAC;KACF;CACF,CAAC;AAEF,mEAAmE;AACtD,QAAA,yBAAyB,GACpC,IAAI,CAAC,4BAA4B,CAC/B,wBAAwB,EACxB,sBAAsB,CACvB,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\nimport * as root from './generated/root';\nimport * as grpc from '@grpc/grpc-js';\nimport {\n IExportMetricsServiceRequest,\n IExportMetricsServiceResponse,\n} from '@opentelemetry/otlp-transformer';\nimport { ExportType } from './internal-types';\n\nconst responseType = root.opentelemetry.proto.collector.metrics.v1\n .ExportMetricsServiceResponse as ExportType<IExportMetricsServiceResponse>;\n\nconst requestType = root.opentelemetry.proto.collector.metrics.v1\n .ExportMetricsServiceRequest as ExportType<IExportMetricsServiceRequest>;\n\nconst metricsServiceDefinition = {\n export: {\n path: '/opentelemetry.proto.collector.metrics.v1.MetricsService/Export',\n requestStream: false,\n responseStream: false,\n requestSerialize: (arg: IExportMetricsServiceRequest) => {\n return Buffer.from(requestType.encode(arg).finish());\n },\n requestDeserialize: (arg: Buffer) => {\n return requestType.decode(arg);\n },\n responseSerialize: (arg: IExportMetricsServiceResponse) => {\n return Buffer.from(responseType.encode(arg).finish());\n },\n responseDeserialize: (arg: Buffer) => {\n return responseType.decode(arg);\n },\n },\n};\n\n// Creates a new instance of a gRPC service client for OTLP metrics\nexport const MetricExportServiceClient: grpc.ServiceClientConstructor =\n grpc.makeGenericClientConstructor(\n metricsServiceDefinition,\n 'MetricsExportService'\n );\n"]}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
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.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.TraceExportServiceClient = void 0;
|
|
19
|
-
const root = require("./generated/root");
|
|
20
|
-
const grpc = require("@grpc/grpc-js");
|
|
21
|
-
const responseType = root.opentelemetry.proto.collector.trace.v1
|
|
22
|
-
.ExportTraceServiceResponse;
|
|
23
|
-
const requestType = root.opentelemetry.proto.collector.trace.v1
|
|
24
|
-
.ExportTraceServiceRequest;
|
|
25
|
-
const traceServiceDefinition = {
|
|
26
|
-
export: {
|
|
27
|
-
path: '/opentelemetry.proto.collector.trace.v1.TraceService/Export',
|
|
28
|
-
requestStream: false,
|
|
29
|
-
responseStream: false,
|
|
30
|
-
requestSerialize: (arg) => {
|
|
31
|
-
return Buffer.from(requestType.encode(arg).finish());
|
|
32
|
-
},
|
|
33
|
-
requestDeserialize: (arg) => {
|
|
34
|
-
return requestType.decode(arg);
|
|
35
|
-
},
|
|
36
|
-
responseSerialize: (arg) => {
|
|
37
|
-
return Buffer.from(responseType.encode(arg).finish());
|
|
38
|
-
},
|
|
39
|
-
responseDeserialize: (arg) => {
|
|
40
|
-
return responseType.decode(arg);
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
// Creates a new instance of a gRPC service client for exporting OTLP traces
|
|
45
|
-
exports.TraceExportServiceClient = grpc.makeGenericClientConstructor(traceServiceDefinition, 'TraceExportService');
|
|
46
|
-
//# sourceMappingURL=TraceExportServiceClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TraceExportServiceClient.js","sourceRoot":"","sources":["../../src/TraceExportServiceClient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,yCAAyC;AACzC,sCAAsC;AAOtC,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;KAC7D,0BAAqE,CAAC;AAEzE,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;KAC5D,yBAAmE,CAAC;AAEvE,MAAM,sBAAsB,GAAG;IAC7B,MAAM,EAAE;QACN,IAAI,EAAE,6DAA6D;QACnE,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,KAAK;QACrB,gBAAgB,EAAE,CAAC,GAA+B,EAAE,EAAE;YACpD,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QACvD,CAAC;QACD,kBAAkB,EAAE,CAAC,GAAW,EAAE,EAAE;YAClC,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;QACD,iBAAiB,EAAE,CAAC,GAAgC,EAAE,EAAE;YACtD,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,mBAAmB,EAAE,CAAC,GAAW,EAAE,EAAE;YACnC,OAAO,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClC,CAAC;KACF;CACF,CAAC;AAEF,4EAA4E;AAC/D,QAAA,wBAAwB,GACnC,IAAI,CAAC,4BAA4B,CAC/B,sBAAsB,EACtB,oBAAoB,CACrB,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\nimport * as root from './generated/root';\nimport * as grpc from '@grpc/grpc-js';\nimport {\n IExportTraceServiceRequest,\n IExportTraceServiceResponse,\n} from '@opentelemetry/otlp-transformer';\nimport { ExportType } from './internal-types';\n\nconst responseType = root.opentelemetry.proto.collector.trace.v1\n .ExportTraceServiceResponse as ExportType<IExportTraceServiceResponse>;\n\nconst requestType = root.opentelemetry.proto.collector.trace.v1\n .ExportTraceServiceRequest as ExportType<IExportTraceServiceRequest>;\n\nconst traceServiceDefinition = {\n export: {\n path: '/opentelemetry.proto.collector.trace.v1.TraceService/Export',\n requestStream: false,\n responseStream: false,\n requestSerialize: (arg: IExportTraceServiceRequest) => {\n return Buffer.from(requestType.encode(arg).finish());\n },\n requestDeserialize: (arg: Buffer) => {\n return requestType.decode(arg);\n },\n responseSerialize: (arg: IExportTraceServiceResponse) => {\n return Buffer.from(responseType.encode(arg).finish());\n },\n responseDeserialize: (arg: Buffer) => {\n return responseType.decode(arg);\n },\n },\n};\n\n// Creates a new instance of a gRPC service client for exporting OTLP traces\nexport const TraceExportServiceClient: grpc.ServiceClientConstructor =\n grpc.makeGenericClientConstructor(\n traceServiceDefinition,\n 'TraceExportService'\n );\n"]}
|