Migrate exporter-collector-grpc to grpc-js (#2092)
Co-authored-by: Daniel Radetsky <dradetsky@gmail.com> Co-authored-by: Valentin Marchaud <contact@vmarchaud.fr>
This commit is contained in:
parent
2260dd6594
commit
d4e0fe2468
|
|
@ -28,7 +28,7 @@
|
|||
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.0.5",
|
||||
"@grpc/grpc-js": "^1.2.12",
|
||||
"@opentelemetry/api": "^1.0.0-rc.0",
|
||||
"@opentelemetry/exporter-jaeger": "^0.18.2",
|
||||
"@opentelemetry/exporter-zipkin": "^0.18.2",
|
||||
|
|
|
|||
|
|
@ -67,12 +67,12 @@
|
|||
"@opentelemetry/api": "^1.0.0-rc.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.2.12",
|
||||
"@grpc/proto-loader": "^0.5.4",
|
||||
"@opentelemetry/core": "0.18.2",
|
||||
"@opentelemetry/exporter-collector": "0.18.2",
|
||||
"@opentelemetry/metrics": "0.18.2",
|
||||
"@opentelemetry/resources": "0.18.2",
|
||||
"@opentelemetry/tracing": "0.18.2",
|
||||
"grpc": "^1.24.2"
|
||||
"@opentelemetry/tracing": "0.18.2"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import {
|
|||
CollectorExporterBase,
|
||||
collectorTypes,
|
||||
} from '@opentelemetry/exporter-collector';
|
||||
import type { Metadata } from 'grpc';
|
||||
import type { Metadata } from '@grpc/grpc-js';
|
||||
import {
|
||||
CollectorExporterConfigNode,
|
||||
GRPCQueueItem,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { collectorTypes } from '@opentelemetry/exporter-collector';
|
||||
import * as grpc from 'grpc';
|
||||
import * as grpc from '@grpc/grpc-js';
|
||||
|
||||
/**
|
||||
* Queue item to be used to save temporary spans/metrics in case the GRPC service
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
import { diag } from '@opentelemetry/api';
|
||||
import * as protoLoader from '@grpc/proto-loader';
|
||||
import { collectorTypes } from '@opentelemetry/exporter-collector';
|
||||
import * as grpc from 'grpc';
|
||||
import * as grpc from '@grpc/grpc-js';
|
||||
import * as path from 'path';
|
||||
|
||||
import {
|
||||
|
|
@ -82,7 +82,7 @@ export function send<ExportItem, ServiceRequest>(
|
|||
|
||||
collector.serviceClient.export(
|
||||
serviceRequest,
|
||||
collector.metadata,
|
||||
collector.metadata || new grpc.Metadata(),
|
||||
(err: collectorTypes.ExportServiceError) => {
|
||||
if (err) {
|
||||
diag.error('Service request', serviceRequest);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import { collectorTypes } from '@opentelemetry/exporter-collector';
|
|||
import * as metrics from '@opentelemetry/metrics';
|
||||
import * as assert from 'assert';
|
||||
import * as fs from 'fs';
|
||||
import * as grpc from 'grpc';
|
||||
import * as grpc from '@grpc/grpc-js';
|
||||
import * as path from 'path';
|
||||
import * as sinon from 'sinon';
|
||||
import { CollectorMetricExporter } from '../src';
|
||||
|
|
@ -109,9 +109,10 @@ const testCollectorMetricExporter = (params: TestParams) =>
|
|||
]
|
||||
)
|
||||
: grpc.ServerCredentials.createInsecure();
|
||||
server.bind(address, credentials);
|
||||
server.start();
|
||||
done();
|
||||
server.bindAsync(address, credentials, () => {
|
||||
server.start();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import {
|
|||
|
||||
import * as assert from 'assert';
|
||||
import * as fs from 'fs';
|
||||
import * as grpc from 'grpc';
|
||||
import * as grpc from '@grpc/grpc-js';
|
||||
import * as path from 'path';
|
||||
import * as sinon from 'sinon';
|
||||
import { CollectorTraceExporter } from '../src';
|
||||
|
|
@ -104,9 +104,10 @@ const testCollectorExporter = (params: TestParams) =>
|
|||
]
|
||||
)
|
||||
: grpc.ServerCredentials.createInsecure();
|
||||
server.bind(address, credentials);
|
||||
server.start();
|
||||
done();
|
||||
server.bindAsync(address, credentials, () => {
|
||||
server.start();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import * as metrics from '@opentelemetry/metrics';
|
|||
import { Resource } from '@opentelemetry/resources';
|
||||
import { ReadableSpan } from '@opentelemetry/tracing';
|
||||
import * as assert from 'assert';
|
||||
import * as grpc from 'grpc';
|
||||
import * as grpc from '@grpc/grpc-js';
|
||||
|
||||
const meterProvider = new metrics.MeterProvider({
|
||||
interval: 30000,
|
||||
|
|
|
|||
Loading…
Reference in New Issue