Skip to content

Commit

Permalink
Migrate exporter-collector-grpc to grpc-js (#2092)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Radetsky <dradetsky@gmail.com>
Co-authored-by: Valentin Marchaud <contact@vmarchaud.fr>
  • Loading branch information
3 people authored Apr 12, 2021
1 parent 2260dd6 commit d4e0fe2
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/grpc-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-exporter-collector-grpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-exporter-collector-grpc/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d4e0fe2

Please sign in to comment.