diff --git a/lib/instrumentation/generic-span.js b/lib/instrumentation/generic-span.js index 2971962b83..f049167e38 100644 --- a/lib/instrumentation/generic-span.js +++ b/lib/instrumentation/generic-span.js @@ -281,7 +281,7 @@ GenericSpan.prototype._serializeOTel = function (payload) { // span link as it will be serialized and sent to APM server. If the linkArg is // invalid, this will return null. // -// @param {Array} linkArg - An object with a `context` property that is +// @param {Object} linkArg - An object with a `context` property that is // a Transaction, Span, or TraceParent instance; an OTel SpanContext object; // or a W3C trace-context 'traceparent' string. function linkFromLinkArg(linkArg) { diff --git a/lib/opentelemetry-bridge/OTelSpan.js b/lib/opentelemetry-bridge/OTelSpan.js index 34d2653ea9..62684a3c8e 100644 --- a/lib/opentelemetry-bridge/OTelSpan.js +++ b/lib/opentelemetry-bridge/OTelSpan.js @@ -169,10 +169,12 @@ class OTelSpan { addLink(link) { this._span.addLink(link); + return this; } addLinks(links) { this._span.addLinks(links); + return this; } end(otelEndTime) { diff --git a/test/opentelemetry-bridge/fixtures/interface-span.js b/test/opentelemetry-bridge/fixtures/interface-span.js index aaa9d0ecb0..3998358ef4 100644 --- a/test/opentelemetry-bridge/fixtures/interface-span.js +++ b/test/opentelemetry-bridge/fixtures/interface-span.js @@ -176,8 +176,10 @@ const linkContext = { spanId: 'ffe4cfa94865ee2a', traceFlags: otel.TraceFlags.SAMPLED, }; -sAddLinks.addLink({ context: linkContext }); -sAddLinks.addLinks([{ context: linkContext }]); +rv = sAddLinks.addLink({ context: linkContext }); +assert.strictEqual(rv, sAddLinks, 'addLink return value is the span'); +rv = sAddLinks.addLinks([{ context: linkContext }]); +assert.strictEqual(rv, sAddLinks, 'addLinks return value is the span'); sAddLinks.end(); // Span#end