Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

elastic-apm-node

Package Overview
Dependencies
Maintainers
3
Versions
162
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elastic-apm-node - npm Package Compare versions

Comparing version 4.6.0 to 4.7.0

8

index.d.ts

@@ -153,2 +153,4 @@ /*

setOutcome(outcome: Outcome): void;
addLink (link: Link): void;
addLinks (links: Link[]): void;

@@ -205,2 +207,4 @@ startSpan(

setServiceTarget(type?: string | null, name?: string | null): void;
addLink (link: Link): void;
addLinks (links: Link[]): void;
end (endTime?: number): void;

@@ -354,4 +358,4 @@ }

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;
}

@@ -358,0 +362,0 @@

@@ -173,20 +173,11 @@ /*

// 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
// Add span links.
//
// 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.
//
// @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]);
}

@@ -196,2 +187,14 @@ }

// 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 () {

@@ -283,5 +286,5 @@ this._isOutcomeFrozen = true;

//
// @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) {

@@ -296,3 +299,9 @@ if (!linkArg || !linkArg.context) {

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

@@ -299,0 +308,0 @@ traceId = ctx._context.traceparent.traceId;

@@ -163,3 +163,3 @@ /*

if (links) {
span._addLinks(links);
span.addLinks(links);
}

@@ -166,0 +166,0 @@

@@ -323,3 +323,3 @@ /*

if (links) {
span._addLinks(links);
span.addLinks(links);
}

@@ -326,0 +326,0 @@ }

@@ -241,3 +241,3 @@ /*

}
trans._addLinks(links);
trans.addLinks(links);
}

@@ -244,0 +244,0 @@

@@ -386,3 +386,3 @@ /*

const links = spanLinksFromSqsRecords(event.Records);
trans._addLinks(links);
trans.addLinks(links);
}

@@ -428,3 +428,3 @@

const links = spanLinksFromSnsRecords(event.Records);
trans._addLinks(links);
trans.addLinks(links);
}

@@ -431,0 +431,0 @@

@@ -130,2 +130,10 @@ /*

addLink(_link) {
return this;
}
addLinks(_links) {
return this;
}
end(_endTime) {}

@@ -132,0 +140,0 @@

@@ -170,2 +170,12 @@ /*

addLink(link) {
this._span.addLink(link);
return this;
}
addLinks(links) {
this._span.addLinks(links);
return this;
}
end(otelEndTime) {

@@ -172,0 +182,0 @@ oblog.apicall('%s.end(endTime=%s)', this, otelEndTime);

{
"name": "elastic-apm-node",
"version": "4.6.0",
"version": "4.7.0",
"description": "The official Elastic APM agent for Node.js",

@@ -5,0 +5,0 @@ "type": "commonjs",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc