diff --git a/docs/span-api.asciidoc b/docs/span-api.asciidoc index 79d01af262..52a6dff259 100644 --- a/docs/span-api.asciidoc +++ b/docs/span-api.asciidoc @@ -242,3 +242,33 @@ If false-y values (e.g. `null`) are given for both `type` and `name`, then `serv If this method is not called, the service target values are inferred from other span fields (https://github.com/elastic/apm/blob/main/specs/agents/tracing-spans-service-target.md#field-values[spec]). `service.target.*` fields are ignored for APM Server before v8.3. + +[[span-addlink]] +==== `span.addLink(link)` + +[small]#Added in: REPLACEME# + +* `link` +{type-link}+ + +A span can refer to zero or more other transactions or spans (separate +from its parent). Span links will be shown in the Kibana APM app trace view. The +`link` argument is an object with a single "context" field that is a +`Transaction`, `Span`, OpenTelemetry `SpanContext` object, or W3C trace-context +'traceparent' string. +For example: `span.addLink({ context: anotherSpan })`. + +[[span-addlinks]] +==== `span.addLinks([links])` + +[small]#Added in: REPLACEME# + +* `links` +{type-array}+ Span links. + +Add span links to this span. + +A span can refer to zero or more other transactions or spans (separate +from its parent). Span links will be shown in the Kibana APM app trace view. The +`link` argument is an object with a single "context" field that is a +`Transaction`, `Span`, OpenTelemetry `SpanContext` object, or W3C trace-context +'traceparent' string. +For example: `span.addLinks([{ context: anotherSpan }])`. diff --git a/docs/supported-technologies.asciidoc b/docs/supported-technologies.asciidoc index 5461eaec9b..26f4fd0130 100644 --- a/docs/supported-technologies.asciidoc +++ b/docs/supported-technologies.asciidoc @@ -84,7 +84,7 @@ Metrics API and Metrics SDK to allow [options="header"] |======================================================================= | Framework | Version -| <> | >=1.0.0 <1.9.0 +| <> | >=1.0.0 <1.10.0 | https://www.npmjs.com/package/@opentelemetry/sdk-metrics[@opentelemetry/sdk-metrics] | >=1.11.0 <2 |======================================================================= diff --git a/docs/transaction-api.asciidoc b/docs/transaction-api.asciidoc index e834b2ccb1..6d69d8ff67 100644 --- a/docs/transaction-api.asciidoc +++ b/docs/transaction-api.asciidoc @@ -308,3 +308,33 @@ Non-HTTP transactions will begin with an outcome of `unknown`. * `outcome` +{type-string}+ The `setOutcome` method allows an end user to override the Node.js agent's default setting of a transaction's `outcome` property. The `setOutcome` method accepts a string of either `success`, `failure`, or `unknown`, and will force the agent to report this value for a specific span. + +[[transaction-addlink]] +==== `transaction.addLink(link)` + +[small]#Added in: REPLACEME# + +* `link` +{type-link}+ + +A transaction can refer to zero or more other transactions or spans (separate +from its parent). Span links will be shown in the Kibana APM app trace view. The +`link` argument is an object with a single "context" field that is a +`Transaction`, `Span`, OpenTelemetry `SpanContext` object, or W3C trace-context +'traceparent' string. +For example: `transaction.addLink({ context: anotherSpan })`. + +[[transaction-addlinks]] +==== `transaction.addLinks([links])` + +[small]#Added in: REPLACEME# + +* `links` +{type-array}+ Span links. + +Add span links to this transaction. + +A transaction can refer to zero or more other transactions or spans (separate +from its parent). Span links will be shown in the Kibana APM app trace view. The +`link` argument is an object with a single "context" field that is a +`Transaction`, `Span`, OpenTelemetry `SpanContext` object, or W3C trace-context +'traceparent' string. +For example: `transaction.addLinks([{ context: anotherSpan }])`. diff --git a/index.d.ts b/index.d.ts index 7cc33d028e..681c86dc03 100644 --- a/index.d.ts +++ b/index.d.ts @@ -150,6 +150,8 @@ declare namespace apm { setLabel (name: string, value: LabelValue, stringify?: boolean): boolean; addLabels (labels: Labels, stringify?: boolean): boolean; setOutcome(outcome: Outcome): void; + addLink (link: Link): void; + addLinks (links: Link[]): void; startSpan( name?: string | null, @@ -201,6 +203,8 @@ declare namespace apm { addLabels (labels: Labels, stringify?: boolean): boolean; setOutcome(outcome: Outcome): void; setServiceTarget(type?: string | null, name?: string | null): void; + addLink (link: Link): void; + addLinks (links: Link[]): void; end (endTime?: number): void; } @@ -349,8 +353,8 @@ declare namespace apm { // equivalent APIs in "opentelemetry-js-api/src/trace/link.ts". Currently // span link attributes are not supported. export interface Link { - /** A W3C trace-context 'traceparent' string, Transaction, or Span. */ - context: Transaction | Span | string; // This is a SpanContext in OTel. + /** A W3C trace-context 'traceparent' string, Transaction, Span, or OTel SpanContext. */ + context: Transaction | Span | {traceId: string, spanId: string} | string; } export interface TransactionOptions { diff --git a/lib/instrumentation/generic-span.js b/lib/instrumentation/generic-span.js index 0fcd7f43ac..f049167e38 100644 --- a/lib/instrumentation/generic-span.js +++ b/lib/instrumentation/generic-span.js @@ -170,28 +170,31 @@ GenericSpan.prototype.addLabels = function (labels, stringify) { return true; }; -// This method is private because the APM agents spec says that (for OTel -// compat), adding links after span creation should not be allowed. -// https://github.com/elastic/apm/blob/main/specs/agents/span-links.md -// -// To support adding span links for SQS ReceiveMessage and equivalent, the -// message data isn't known until the *response*, after the span has been -// created. +// Add span links. // // @param {Array} links - An array of objects with a `context` property that is -// a Transaction, Span, or TraceParent instance, or a W3C trace-context -// 'traceparent' string. -GenericSpan.prototype._addLinks = function (links) { +// a Transaction, Span, or TraceParent instance; an OTel SpanContext object; +// or a W3C trace-context 'traceparent' string. +GenericSpan.prototype.addLinks = function (links) { if (links) { for (let i = 0; i < links.length; i++) { - const link = linkFromLinkArg(links[i]); - if (link) { - this._links.push(link); - } + this.addLink(links[i]); } } }; +// Add a span link. +// +// @param {Link} link - 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. +GenericSpan.prototype.addLink = function (linkArg) { + const link = linkFromLinkArg(linkArg); + if (link) { + this._links.push(link); + } +}; + GenericSpan.prototype._freezeOutcome = function () { this._isOutcomeFrozen = true; }; @@ -278,9 +281,9 @@ 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 {Object} linkArg - An object with a `context` property that is a -// Transaction, Span, or TraceParent instance, or a W3C trace-context -// 'traceparent' string. +// @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) { if (!linkArg || !linkArg.context) { return null; @@ -290,7 +293,13 @@ function linkFromLinkArg(linkArg) { let traceId; let spanId; - if (ctx._context instanceof TraceContext) { + if (ctx.traceId && ctx.spanId) { + // Duck-typing for an OTel SpanContext. APM intake v2 only supports the + // trace id and span id fields for span links, so we only need care about + // those attributes. + traceId = ctx.traceId; + spanId = ctx.spanId; + } else if (ctx._context instanceof TraceContext) { // Transaction or Span traceId = ctx._context.traceparent.traceId; spanId = ctx._context.traceparent.id; diff --git a/lib/instrumentation/modules/@aws-sdk/client-sqs.js b/lib/instrumentation/modules/@aws-sdk/client-sqs.js index e6fab7dd22..ab3bb5348d 100644 --- a/lib/instrumentation/modules/@aws-sdk/client-sqs.js +++ b/lib/instrumentation/modules/@aws-sdk/client-sqs.js @@ -160,7 +160,7 @@ function sqsMiddlewareFactory(client, agent) { // Links const links = getSpanLinksFromResponseData(result && result.output); if (links) { - span._addLinks(links); + span.addLinks(links); } // Metrics diff --git a/lib/instrumentation/modules/aws-sdk/sqs.js b/lib/instrumentation/modules/aws-sdk/sqs.js index 3586f55210..1ef51f534d 100644 --- a/lib/instrumentation/modules/aws-sdk/sqs.js +++ b/lib/instrumentation/modules/aws-sdk/sqs.js @@ -320,7 +320,7 @@ function instrumentationSqs( if (receiveMsgData) { const links = getSpanLinksFromResponseData(receiveMsgData); if (links) { - span._addLinks(links); + span.addLinks(links); } } diff --git a/lib/instrumentation/modules/kafkajs.js b/lib/instrumentation/modules/kafkajs.js index 8838f3dd64..c0e10b1685 100644 --- a/lib/instrumentation/modules/kafkajs.js +++ b/lib/instrumentation/modules/kafkajs.js @@ -238,7 +238,7 @@ module.exports = function (mod, agent, { version, enabled }) { } } } - trans._addLinks(links); + trans.addLinks(links); } let result, err; diff --git a/lib/lambda.js b/lib/lambda.js index b7d4d9ada5..587e50fbae 100644 --- a/lib/lambda.js +++ b/lib/lambda.js @@ -383,7 +383,7 @@ function setSqsData(agent, trans, event, context, faasId, isColdStart) { trans.setCloudContext(cloudContext); const links = spanLinksFromSqsRecords(event.Records); - trans._addLinks(links); + trans.addLinks(links); } function setSnsData(agent, trans, event, context, faasId, isColdStart) { @@ -424,7 +424,7 @@ function setSnsData(agent, trans, event, context, faasId, isColdStart) { trans.setCloudContext(cloudContext); const links = spanLinksFromSnsRecords(event.Records); - trans._addLinks(links); + trans.addLinks(links); } function setS3SingleData(trans, event, context, faasId, isColdStart) { diff --git a/lib/opentelemetry-bridge/OTelBridgeNonRecordingSpan.js b/lib/opentelemetry-bridge/OTelBridgeNonRecordingSpan.js index 7fef832d71..7b85d87eed 100644 --- a/lib/opentelemetry-bridge/OTelBridgeNonRecordingSpan.js +++ b/lib/opentelemetry-bridge/OTelBridgeNonRecordingSpan.js @@ -127,6 +127,14 @@ class OTelBridgeNonRecordingSpan { return this; } + addLink(_link) { + return this; + } + + addLinks(_links) { + return this; + } + end(_endTime) {} // isRecording always returns false for NonRecordingSpan. diff --git a/lib/opentelemetry-bridge/OTelSpan.js b/lib/opentelemetry-bridge/OTelSpan.js index 7ea1139ca2..62684a3c8e 100644 --- a/lib/opentelemetry-bridge/OTelSpan.js +++ b/lib/opentelemetry-bridge/OTelSpan.js @@ -167,6 +167,16 @@ class OTelSpan { return this; } + addLink(link) { + this._span.addLink(link); + return this; + } + + addLinks(links) { + this._span.addLinks(links); + return this; + } + end(otelEndTime) { oblog.apicall('%s.end(endTime=%s)', this, otelEndTime); const endTime = diff --git a/test/instrumentation/span.test.js b/test/instrumentation/span.test.js index 826bf902a3..5d57f70d52 100644 --- a/test/instrumentation/span.test.js +++ b/test/instrumentation/span.test.js @@ -263,6 +263,38 @@ test('#addLabels', function (t) { t.end(); }); +test('#addLink, #addLinks', function (t) { + var trans = new Transaction(agent); + var span = new Span(trans); + + const theTraceId = '00000000000000000000000000000001'; + span.addLink({ + context: { traceId: theTraceId, spanId: '0000000000000002' }, + }); + t.deepEqual(span._links, [ + { + trace_id: theTraceId, + span_id: '0000000000000002', + }, + ]); + + span.addLinks([ + { + context: { traceId: theTraceId, spanId: '0000000000000003' }, + }, + { + context: { traceId: theTraceId, spanId: '0000000000000004' }, + }, + ]); + t.deepEqual(span._links, [ + { trace_id: theTraceId, span_id: '0000000000000002' }, + { trace_id: theTraceId, span_id: '0000000000000003' }, + { trace_id: theTraceId, span_id: '0000000000000004' }, + ]); + + t.end(); +}); + test('span.sync', function (t) { var trans = agent.startTransaction(); @@ -528,6 +560,10 @@ test('Span API on ended span', function (t) { t.pass('span.addLabels(...) does not blow up'); span.setOutcome('failure'); t.pass('span.setOutcome(...) does not blow up'); + span.addLink({ context: { traceId: '001', spanId: '002' } }); + t.pass('span.addLink(...) does not blow up'); + span.addLinks([{ context: { traceId: '001', spanId: '002' } }]); + t.pass('span.addLinks(...) does not blow up'); span.end(42); t.pass('span.end(...) does not blow up'); diff --git a/test/instrumentation/transaction.test.js b/test/instrumentation/transaction.test.js index 13a36b845b..7fa4f51612 100644 --- a/test/instrumentation/transaction.test.js +++ b/test/instrumentation/transaction.test.js @@ -226,6 +226,37 @@ test('#addLabels', function (t) { t.end(); }); +test('#addLink, #addLinks', function (t) { + var trans = new Transaction(agent); + + const theTraceId = '00000000000000000000000000000001'; + trans.addLink({ + context: { traceId: theTraceId, spanId: '0000000000000002' }, + }); + t.deepEqual(trans._links, [ + { + trace_id: theTraceId, + span_id: '0000000000000002', + }, + ]); + + trans.addLinks([ + { + context: { traceId: theTraceId, spanId: '0000000000000003' }, + }, + { + context: { traceId: theTraceId, spanId: '0000000000000004' }, + }, + ]); + t.deepEqual(trans._links, [ + { trace_id: theTraceId, span_id: '0000000000000002' }, + { trace_id: theTraceId, span_id: '0000000000000003' }, + { trace_id: theTraceId, span_id: '0000000000000004' }, + ]); + + t.end(); +}); + test('#startSpan()', function (t) { t.test('basic', function (t) { var trans = new Transaction(agent); diff --git a/test/opentelemetry-bridge/.tav.yml b/test/opentelemetry-bridge/.tav.yml index 68b2a3b251..f9ac3def64 100644 --- a/test/opentelemetry-bridge/.tav.yml +++ b/test/opentelemetry-bridge/.tav.yml @@ -1,5 +1,5 @@ "@opentelemetry/api": - versions: '>=1.0.0 <1.9.0' + versions: '>=1.0.0 <1.10.0' node: '>=8.0.0' commands: - node OTelBridgeNonRecordingSpan.test.js diff --git a/test/opentelemetry-bridge/OTelBridgeNonRecordingSpan.test.js b/test/opentelemetry-bridge/OTelBridgeNonRecordingSpan.test.js index eaacad4ed0..e8edd46597 100644 --- a/test/opentelemetry-bridge/OTelBridgeNonRecordingSpan.test.js +++ b/test/opentelemetry-bridge/OTelBridgeNonRecordingSpan.test.js @@ -78,6 +78,13 @@ tape.test('OTelBridgeNonRecordingSpan', (suite) => { 'setStatus', ); t.equal(nrsOTelSpan.updateName('anotherName'), nrsOTelSpan, 'updateName'); + const linkContext = { + traceId: '8b46594050c89c3d87248476ed8e0c57', + spanId: 'ffe4cfa94865ee2a', + traceFlags: otel.TraceFlags.SAMPLED, + }; + t.equal(nrsOTelSpan.addLink(linkContext), nrsOTelSpan, 'addLink'); + t.equal(nrsOTelSpan.addLinks([linkContext]), nrsOTelSpan, 'addLinks'); t.equal(nrsOTelSpan.end(), undefined, 'end'); t.equal(nrsOTelSpan.isRecording(), false, 'isRecording'); t.equal( diff --git a/test/opentelemetry-bridge/fixtures.test.js b/test/opentelemetry-bridge/fixtures.test.js index e121884316..e70941062c 100644 --- a/test/opentelemetry-bridge/fixtures.test.js +++ b/test/opentelemetry-bridge/fixtures.test.js @@ -376,6 +376,7 @@ const cases = [ 'sSetStatusChildERROR.outcome', ); + // Span#updateName t.strictEqual( findObjInArray( events, @@ -386,6 +387,23 @@ const cases = [ 'sUpdateName', ); + // Span#addLink, Span#addLinks + t.deepEqual( + findObjInArray(events, 'transaction.name', 'sAddLinks').transaction + .links, + [ + { + trace_id: '8b46594050c89c3d87248476ed8e0c57', + span_id: 'ffe4cfa94865ee2a', + }, + { + trace_id: '8b46594050c89c3d87248476ed8e0c57', + span_id: 'ffe4cfa94865ee2a', + }, + ], + 'sAddLinks links', + ); + // Span#end function spanEndTimeIsApprox(transOrSpanName, t = Date.now()) { const foundTrans = findObjInArray( diff --git a/test/opentelemetry-bridge/fixtures/interface-span.js b/test/opentelemetry-bridge/fixtures/interface-span.js index 0fb136c4d6..3998358ef4 100644 --- a/test/opentelemetry-bridge/fixtures/interface-span.js +++ b/test/opentelemetry-bridge/fixtures/interface-span.js @@ -169,6 +169,19 @@ sUpdateName.updateName('three'); sUpdateName.end(); sUpdateName.updateName('four'); // updateName after end should *not* take +// Span#addLink, Span#addLinks +const sAddLinks = tracer.startSpan('sAddLinks'); +const linkContext = { + traceId: '8b46594050c89c3d87248476ed8e0c57', + spanId: 'ffe4cfa94865ee2a', + traceFlags: otel.TraceFlags.SAMPLED, +}; +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 // Specify approximately "now" in each of the supported TimeInput formats. // OTel HrTime is `[, ]`. diff --git a/test/opentelemetry-metrics/fixtures/.tav.yml b/test/opentelemetry-metrics/fixtures/.tav.yml index a138bc2416..ce1519300d 100644 --- a/test/opentelemetry-metrics/fixtures/.tav.yml +++ b/test/opentelemetry-metrics/fixtures/.tav.yml @@ -1,5 +1,5 @@ "@opentelemetry/api": - versions: '>=1.3.0 <1.9.0' + versions: '>=1.3.0 <1.10.0' node: '>=14.0.0' commands: - node ../fixtures.test.js diff --git a/test/opentelemetry-metrics/fixtures/package-lock.json b/test/opentelemetry-metrics/fixtures/package-lock.json index 9baeb9e0a6..3dde52bddd 100644 --- a/test/opentelemetry-metrics/fixtures/package-lock.json +++ b/test/opentelemetry-metrics/fixtures/package-lock.json @@ -22,27 +22,27 @@ } }, "node_modules/@opentelemetry/core": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.24.1.tgz", - "integrity": "sha512-wMSGfsdmibI88K9wB498zXY04yThPexo8jvwNNlm542HZB7XrrMRBbAyKJqG8qDRJwIBdBrPMi4V9ZPW/sqrcg==", + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.25.0.tgz", + "integrity": "sha512-n0B3s8rrqGrasTgNkXLKXzN0fXo+6IYP7M5b7AMsrZM33f/y6DS6kJ0Btd7SespASWq8bgL3taLo0oe0vB52IQ==", "dependencies": { - "@opentelemetry/semantic-conventions": "1.24.1" + "@opentelemetry/semantic-conventions": "1.25.0" }, "engines": { "node": ">=14" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" + "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "node_modules/@opentelemetry/exporter-prometheus": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-prometheus/-/exporter-prometheus-0.51.1.tgz", - "integrity": "sha512-c8TrTlLm9JJRIHW6MtFv6ESoZRgXBXD/YrTRYylWiyYBOVbYHo1c5Qaw/j/thXDhkmYOYAn4LAhJZpLl5gBFEQ==", + "version": "0.52.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-prometheus/-/exporter-prometheus-0.52.0.tgz", + "integrity": "sha512-DJoCAtm6J1/rAP9oAjd5q5iq9/IKeiPLCHWOw+2QhPkgHHFvwKeOHnUp3xTC7RvpiuV2GQAV8Hih0CRHjehHJQ==", "dependencies": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-metrics": "1.24.1" + "@opentelemetry/core": "1.25.0", + "@opentelemetry/resources": "1.25.0", + "@opentelemetry/sdk-metrics": "1.25.0" }, "engines": { "node": ">=14" @@ -52,40 +52,40 @@ } }, "node_modules/@opentelemetry/resources": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.24.1.tgz", - "integrity": "sha512-cyv0MwAaPF7O86x5hk3NNgenMObeejZFLJJDVuSeSMIsknlsj3oOZzRv3qSzlwYomXsICfBeFFlxwHQte5mGXQ==", + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.25.0.tgz", + "integrity": "sha512-iHjydPMYJ+Li1auveJCq2rp5U2h6Mhq8BidiyE0jfVlDTFyR1ny8AfJHfmFzJ/RAM8vT8L7T21kcmGybxZC7lQ==", "dependencies": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/semantic-conventions": "1.24.1" + "@opentelemetry/core": "1.25.0", + "@opentelemetry/semantic-conventions": "1.25.0" }, "engines": { "node": ">=14" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" + "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "node_modules/@opentelemetry/sdk-metrics": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.24.1.tgz", - "integrity": "sha512-FrAqCbbGao9iKI+Mgh+OsC9+U2YMoXnlDHe06yH7dvavCKzE3S892dGtX54+WhSFVxHR/TMRVJiK/CV93GR0TQ==", + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.25.0.tgz", + "integrity": "sha512-IF+Sv4VHgBr/BPMKabl+GouJIhEqAOexCHgXVTISdz3q9P9H/uA8ScCF+22gitQ69aFtESbdYOV+Fen5+avQng==", "dependencies": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1", + "@opentelemetry/core": "1.25.0", + "@opentelemetry/resources": "1.25.0", "lodash.merge": "^4.6.2" }, "engines": { "node": ">=14" }, "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.9.0" + "@opentelemetry/api": ">=1.3.0 <1.10.0" } }, "node_modules/@opentelemetry/semantic-conventions": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.24.1.tgz", - "integrity": "sha512-VkliWlS4/+GHLLW7J/rVBA00uXus1SWvwFvcUDxDwmFxYfg/2VI6ekwdXS28cjI8Qz2ky2BzG8OUHo+WeYIWqw==", + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.25.0.tgz", + "integrity": "sha512-M+kkXKRAIAiAP6qYyesfrC5TOmDpDVtsxuGfPcqd9B/iBrac+E14jYwrgm0yZBUIbIP2OnqC3j+UgkXLm1vxUQ==", "engines": { "node": ">=14" } @@ -103,46 +103,46 @@ "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==" }, "@opentelemetry/core": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.24.1.tgz", - "integrity": "sha512-wMSGfsdmibI88K9wB498zXY04yThPexo8jvwNNlm542HZB7XrrMRBbAyKJqG8qDRJwIBdBrPMi4V9ZPW/sqrcg==", + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.25.0.tgz", + "integrity": "sha512-n0B3s8rrqGrasTgNkXLKXzN0fXo+6IYP7M5b7AMsrZM33f/y6DS6kJ0Btd7SespASWq8bgL3taLo0oe0vB52IQ==", "requires": { - "@opentelemetry/semantic-conventions": "1.24.1" + "@opentelemetry/semantic-conventions": "1.25.0" } }, "@opentelemetry/exporter-prometheus": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-prometheus/-/exporter-prometheus-0.51.1.tgz", - "integrity": "sha512-c8TrTlLm9JJRIHW6MtFv6ESoZRgXBXD/YrTRYylWiyYBOVbYHo1c5Qaw/j/thXDhkmYOYAn4LAhJZpLl5gBFEQ==", + "version": "0.52.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-prometheus/-/exporter-prometheus-0.52.0.tgz", + "integrity": "sha512-DJoCAtm6J1/rAP9oAjd5q5iq9/IKeiPLCHWOw+2QhPkgHHFvwKeOHnUp3xTC7RvpiuV2GQAV8Hih0CRHjehHJQ==", "requires": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-metrics": "1.24.1" + "@opentelemetry/core": "1.25.0", + "@opentelemetry/resources": "1.25.0", + "@opentelemetry/sdk-metrics": "1.25.0" } }, "@opentelemetry/resources": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.24.1.tgz", - "integrity": "sha512-cyv0MwAaPF7O86x5hk3NNgenMObeejZFLJJDVuSeSMIsknlsj3oOZzRv3qSzlwYomXsICfBeFFlxwHQte5mGXQ==", + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.25.0.tgz", + "integrity": "sha512-iHjydPMYJ+Li1auveJCq2rp5U2h6Mhq8BidiyE0jfVlDTFyR1ny8AfJHfmFzJ/RAM8vT8L7T21kcmGybxZC7lQ==", "requires": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/semantic-conventions": "1.24.1" + "@opentelemetry/core": "1.25.0", + "@opentelemetry/semantic-conventions": "1.25.0" } }, "@opentelemetry/sdk-metrics": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.24.1.tgz", - "integrity": "sha512-FrAqCbbGao9iKI+Mgh+OsC9+U2YMoXnlDHe06yH7dvavCKzE3S892dGtX54+WhSFVxHR/TMRVJiK/CV93GR0TQ==", + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.25.0.tgz", + "integrity": "sha512-IF+Sv4VHgBr/BPMKabl+GouJIhEqAOexCHgXVTISdz3q9P9H/uA8ScCF+22gitQ69aFtESbdYOV+Fen5+avQng==", "requires": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1", + "@opentelemetry/core": "1.25.0", + "@opentelemetry/resources": "1.25.0", "lodash.merge": "^4.6.2" } }, "@opentelemetry/semantic-conventions": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.24.1.tgz", - "integrity": "sha512-VkliWlS4/+GHLLW7J/rVBA00uXus1SWvwFvcUDxDwmFxYfg/2VI6ekwdXS28cjI8Qz2ky2BzG8OUHo+WeYIWqw==" + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.25.0.tgz", + "integrity": "sha512-M+kkXKRAIAiAP6qYyesfrC5TOmDpDVtsxuGfPcqd9B/iBrac+E14jYwrgm0yZBUIbIP2OnqC3j+UgkXLm1vxUQ==" }, "lodash.merge": { "version": "4.6.2", diff --git a/test/types/index.ts b/test/types/index.ts index fbcd03cd5f..e71936eb2a 100644 --- a/test/types/index.ts +++ b/test/types/index.ts @@ -192,6 +192,11 @@ apm.logger.fatal('') trans.startSpan('foo', 'type', 'subtype', { exitSpan: true }) trans.startSpan('foo', { links: [{ context: '00-12345678901234567890123456789012-1234567890123456-01' }] }) + trans.addLink({ context: '00-12345678901234567890123456789012-1234567890123456-01' }) + trans.addLink({ context: { traceId: '12345678901234567890123456789012', spanId: '1234567890123456' }}) + trans.addLinks([{ context: '00-12345678901234567890123456789012-1234567890123456-01' }]) + trans.addLinks([{ context: { traceId: '12345678901234567890123456789012', spanId: '1234567890123456' }}]) + function ensureParentId (id: string) {} ensureParentId(trans.ensureParentId()) @@ -225,6 +230,11 @@ apm.logger.fatal('') span.setServiceTarget(null, null) span.setServiceTarget() + span.addLink({ context: '00-12345678901234567890123456789012-1234567890123456-01' }) + span.addLink({ context: { traceId: '12345678901234567890123456789012', spanId: '1234567890123456' }}) + span.addLinks([{ context: '00-12345678901234567890123456789012-1234567890123456-01' }]) + span.addLinks([{ context: { traceId: '12345678901234567890123456789012', spanId: '1234567890123456' }}]) + span.end() span.end(42) }