Skip to content

Commit

Permalink
Merge branch 'master' into node-14
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan authored May 1, 2020
2 parents b3ad188 + 6cf5406 commit 375683e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "packages/opentelemetry-exporter-collector/src/platform/node/protos"]
path = packages/opentelemetry-exporter-collector/src/platform/node/protos
url = git@github.com:open-telemetry/opentelemetry-proto.git
url = https://github.com/open-telemetry/opentelemetry-proto.git
2 changes: 2 additions & 0 deletions examples/opentracing-shim/shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ function shim(serviceName) {
const provider = new NodeTracerProvider();

provider.addSpanProcessor(new SimpleSpanProcessor(getExporter(serviceName)));
// Initialize the OpenTelemetry APIs to use the NodeTracerProvider bindings
provider.register();

return new TracerShim(provider.getTracer('opentracing-shim'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class PluginLoader {
}

this.logger.info(
`PluginLoader#load: trying loading ${name}@${version}`
`PluginLoader#load: trying to load ${name}@${version}`
);

if (!version) return exports;
Expand Down
4 changes: 4 additions & 0 deletions packages/opentelemetry-plugin-grpc/src/grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ export class GrpcPlugin extends BasePlugin<grpc> {
});

call.on('error', (err: grpcTypes.ServiceError) => {
span.setStatus({
code: _grpcStatusCodeToCanonicalCode(err.code),
message: err.message,
});
span.addEvent('finished with error');
span.setAttributes({
[AttributeNames.GRPC_ERROR_NAME]: err.name,
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-plugin-xml-http-request/src/xhr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ export class XMLHttpRequestPlugin extends BasePlugin<XMLHttpRequest> {
}

const currentSpan = this._tracer.startSpan(url, {
kind: api.SpanKind.CLIENT,
attributes: {
[AttributeNames.COMPONENT]: this.component,
[AttributeNames.HTTP_METHOD]: method,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ describe('xhr', () => {
assert.strictEqual(span.name, url, 'span has wrong name');
});

it('span should have correct kind', () => {
const span: tracing.ReadableSpan = exportSpy.args[0][0][0];
assert.strictEqual(
span.kind,
types.SpanKind.CLIENT,
'span has wrong kind'
);
});

it('span should have correct attributes', () => {
const span: tracing.ReadableSpan = exportSpy.args[0][0][0];
const attributes = span.attributes;
Expand Down

0 comments on commit 375683e

Please sign in to comment.