Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate exporter-collector-grpc to grpc-js #2092

Merged
merged 5 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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