Repository: honeycombio/beeline-nodejs
Pull request #454 (2021-09-20 07:01:22)

Bump libhoney from 2.3.2 to 2.3.3
Bumps [libhoney](https://github.com/honeycombio/libhoney-js) from 2.3.2 to 2.3.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/honeycombio/libhoney-js/releases">libhoney's releases</a>.</em></p>
<blockquote>
<h2>v2.3.3</h2>
<h3>Maintenance</h3>
<ul>
<li>Bump prettier from 2.3.2 to 2.4.0 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/182">#182</a>)</li>
<li>Bump <code>@​babel/preset-env</code> from 7.15.0 to 7.15.6 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/181">#181</a>)</li>
<li>Bump <code>@​babel/core</code> from 7.15.0 to 7.15.5 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/179">#179</a>)</li>
<li>Bump husky from 7.0.1 to 7.0.2 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/176">#176</a>)</li>
<li>Bump superagent-proxy from 2.1.0 to 3.0.0 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/178">#178</a>)</li>
<li>Bump path-parse from 1.0.6 to 1.0.7 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/174">#174</a>)</li>
<li>Add note about dropping Node 8 in future (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/177">#177</a>)</li>
<li>Add issue and PR templates (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/175">#175</a>)</li>
<li>Add OSS lifecycle badge (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/173">#173</a>)</li>
<li>Add community health files (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/172">#172</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/honeycombio/libhoney-js/blob/main/CHANGELOG.md">libhoney's changelog</a>.</em></p>
<blockquote>
<h2>[2.3.3] - 2021-09-16</h2>
<h3>Maintenance</h3>
<ul>
<li>Bump prettier from 2.3.2 to 2.4.0 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/182">#182</a>)</li>
<li>Bump <code>@​babel/preset-env</code> from 7.15.0 to 7.15.6 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/181">#181</a>)</li>
<li>Bump <code>@​babel/core</code> from 7.15.0 to 7.15.5 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/179">#179</a>)</li>
<li>Bump husky from 7.0.1 to 7.0.2 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/176">#176</a>)</li>
<li>Bump superagent-proxy from 2.1.0 to 3.0.0 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/178">#178</a>)</li>
<li>Bump path-parse from 1.0.6 to 1.0.7 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/174">#174</a>)</li>
<li>Add note about dropping Node 8 in future (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/177">#177</a>)</li>
<li>Add issue and PR templates (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/175">#175</a>)</li>
<li>Add OSS lifecycle badge (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/173">#173</a>)</li>
<li>Add community health files (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/172">#172</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/honeycombio/libhoney-js/commit/2580c46603cbb2e620348fd3acf3f955a9b7b5af"><code>2580c46</code></a> Prep v2.3.3 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/183">#183</a>)</li>
<li><a href="https://github.com/honeycombio/libhoney-js/commit/a2c47d769d76cb6aa2a9b818d894e87323c4a6fa"><code>a2c47d7</code></a> Bump prettier from 2.3.2 to 2.4.0 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/182">#182</a>)</li>
<li><a href="https://github.com/honeycombio/libhoney-js/commit/fbdb7eb2a10ddffb23c7cc2ffd5ea2a6377e255f"><code>fbdb7eb</code></a> Bump <code>@​babel/preset-env</code> from 7.15.0 to 7.15.6 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/181">#181</a>)</li>
<li><a href="https://github.com/honeycombio/libhoney-js/commit/af279e221bc3671257b41c5b57d51e8b6afdb87c"><code>af279e2</code></a> Bump <code>@​babel/core</code> from 7.15.0 to 7.15.5 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/179">#179</a>)</li>
<li><a href="https://github.com/honeycombio/libhoney-js/commit/cd4cb6af66555b5487275eb1b0192d4b7219bd34"><code>cd4cb6a</code></a> Bump husky from 7.0.1 to 7.0.2 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/176">#176</a>)</li>
<li><a href="https://github.com/honeycombio/libhoney-js/commit/a93f2b160c18c3dbf8cd4f22594856573624e420"><code>a93f2b1</code></a> Bump superagent-proxy from 2.1.0 to 3.0.0 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/178">#178</a>)</li>
<li><a href="https://github.com/honeycombio/libhoney-js/commit/6314093762778e098b0121900723bbf64c4cfdf5"><code>6314093</code></a> Add note about dropping Node 8 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/177">#177</a>)</li>
<li><a href="https://github.com/honeycombio/libhoney-js/commit/7cee8bc2e83a2e148a2d108e7ce431430c115b12"><code>7cee8bc</code></a> Bump path-parse from 1.0.6 to 1.0.7 (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/174">#174</a>)</li>
<li><a href="https://github.com/honeycombio/libhoney-js/commit/6a04bbc539ab166b27abc5ddd383bcec96d3ea24"><code>6a04bbc</code></a> Add issue and PR templates (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/175">#175</a>)</li>
<li><a href="https://github.com/honeycombio/libhoney-js/commit/b2be48e5ee98534bcedc8f7a40ae069d414d8060"><code>b2be48e</code></a> Add OSS lifecycle badge (<a href="https://github-redirect.dependabot.com/honeycombio/libhoney-js/issues/173">#173</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/honeycombio/libhoney-js/compare/v2.3.2...v2.3.3">compare view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a href="https://www.npmjs.com/~honeycombci">honeycombci</a>, a new releaser for libhoney since your current version.</p>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=libhoney&package-manager=npm_and_yarn&previous-version=2.3.2&new-version=2.3.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/lib/api/libhoney.js b/lib/api/libhoney.js
index 5083b08..675b671 100644
--- a/lib/api/libhoney.js
+++ b/lib/api/libhoney.js
@@ -290,7 +290,7 @@ module.exports = class LibhoneyEventAPI {
       // valid, since we can end up in our instrumentation outside of requests we're tracking
       return;
     }
-    Object.assign(context.stack[0].payload, map);
+    Object.assign(context.stack[context.stack.length - 1].payload, map);
   }
 
   /**
@@ -302,7 +302,7 @@ module.exports = class LibhoneyEventAPI {
       // valid, since we can end up in our instrumentation outside of requests we're tracking
       return;
     }
-    delete context.stack[0].payload[key];
+    delete context.stack[context.stack.length - 1].payload[key];
   }
 
   addTraceContext(map) {
diff --git a/lib/api/mock.js b/lib/api/mock.js
index 5a528ec..27424df 100644
--- a/lib/api/mock.js
+++ b/lib/api/mock.js
@@ -85,7 +85,7 @@ module.exports = class MockEventAPI {
     if (!context || context.stack.length === 0) {
       return;
     }
-    Object.assign(context.stack[0], map);
+    Object.assign(context.stack[context.stack.length - 1], map);
   }
 
   /**
@@ -93,7 +93,7 @@ module.exports = class MockEventAPI {
    */
   removeContext(key) {
     let context = tracker.getTracked();
-    delete context.stack[0].payload[key];
+    delete context.stack[context.stack.length - 1].payload[key];
   }
 
   addTraceContext(map) {
diff --git a/lib/instrumentation/trace-util.js b/lib/instrumentation/trace-util.js
index f640a37..d884ce4 100644
--- a/lib/instrumentation/trace-util.js
+++ b/lib/instrumentation/trace-util.js
@@ -59,9 +59,7 @@ exports.getTraceContext = (traceIdSource, req) => {
   const { honeycomb, aws } = api;
   if (typeof traceIdSource === "undefined" || typeof traceIdSource === "string") {
     let headers =
-      typeof traceIdSource === "undefined"
-        ? [honeycomb.TRACE_HTTP_HEADER, "X-Request-ID", aws.TRACE_HTTP_HEADER]
-        : [traceIdSource];
+      typeof traceIdSource === "undefined" ? [honeycomb.TRACE_HTTP_HEADER] : [traceIdSource];
     let valueAndHeader = getValueFromHeaders(req.headers, headers);
 
     if (!valueAndHeader) {
diff --git a/package-lock.json b/package-lock.json
index 3ffa1c4..68c7a63 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6,7 +6,7 @@
   "packages": {
     "": {
       "name": "honeycomb-beeline",
-      "version": "2.8.0",
+      "version": "2.8.1",
       "license": "Apache-2.0",
       "dependencies": {
         "@opentelemetry/api": "^1.0.2",
@@ -1352,9 +1352,9 @@
       }
     },
     "node_modules/@types/node": {
-      "version": "16.9.1",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz",
-      "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g=="
+      "version": "16.9.4",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.4.tgz",
+      "integrity": "sha512-KDazLNYAGIuJugdbULwFZULF9qQ13yNWEBFnfVpqlpgAAo6H/qnM9RjBgh0A0kmHf3XxAKLdN5mTIng9iUvVLA=="
     },
     "node_modules/@types/parse-json": {
       "version": "4.0.0",
@@ -1613,9 +1613,9 @@
       }
     },
     "node_modules/ast-types/node_modules/tslib": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz",
-      "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A=="
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
+      "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
     },
     "node_modules/astral-regex": {
       "version": "2.0.0",
@@ -2275,9 +2275,9 @@
       "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA=="
     },
     "node_modules/core-util-is": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
-      "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
+      "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
     },
     "node_modules/cosmiconfig": {
       "version": "7.0.0",
@@ -2403,13 +2403,14 @@
       }
     },
     "node_modules/degenerator": {
-      "version": "2.2.0",
-      "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-2.2.0.tgz",
-      "integrity": "sha512-aiQcQowF01RxFI4ZLFMpzyotbQonhNpBao6dkI8JPk5a+hmSjR5ErHp2CQySmQe8os3VBqLCIh87nDBgZXvsmg==",
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-3.0.1.tgz",
+      "integrity": "sha512-LFsIFEeLPlKvAKXu7j3ssIG6RT0TbI7/GhsqrI0DnHASEQjXQ0LUSYcjJteGgRGmZbl1TnMSxpNQIAiJ7Du5TQ==",
       "dependencies": {
         "ast-types": "^0.13.2",
         "escodegen": "^1.8.1",
-        "esprima": "^4.0.0"
+        "esprima": "^4.0.0",
+        "vm2": "^3.9.3"
       },
       "engines": {
         "node": ">= 6"
@@ -3368,11 +3369,6 @@
         "node": ">=0.8.0"
       }
     },
-    "node_modules/ftp/node_modules/isarray": {
-      "version": "0.0.1",
-      "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
-      "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
-    },
     "node_modules/ftp/node_modules/readable-stream": {
       "version": "1.1.14",
       "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
@@ -3898,6 +3894,11 @@
         "url": "https://github.com/sponsors/sindresorhus"
       }
     },
+    "node_modules/isarray": {
+      "version": "0.0.1",
+      "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+      "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
+    },
     "node_modules/isexe": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@@ -5753,7 +5754,7 @@
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
       "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
-      "dependencies": {
+      "optionalDependencies": {
         "graceful-fs": "^4.1.6"
       }
     },
@@ -5788,12 +5789,12 @@
       }
     },
     "node_modules/libhoney": {
-      "version": "2.3.2",
-      "resolved": "https://registry.npmjs.org/libhoney/-/libhoney-2.3.2.tgz",
-      "integrity": "sha512-GH/RUiiBQJykBzzMc7KZF3u+uAMkkTEkFBjfcHErnGl+SZ0vmRH3a4QNt5138BPVoYTvCAjncjIQWz3YUOUWRA==",
+      "version": "2.3.3",
+      "resolved": "https://registry.npmjs.org/libhoney/-/libhoney-2.3.3.tgz",
+      "integrity": "sha512-WfujgzJjIxN4ZwRwX7iO1LFvzB9x+M7MGEN+FsPrCjTti+cA3CMYR400ElqRO84/ZwEphjiJrO+yqvVceu4N6Q==",
       "dependencies": {
         "superagent": "^6.1.0",
-        "superagent-proxy": "^2.0.0",
+        "superagent-proxy": "^3.0.0",
         "urljoin": "^0.1.5"
       },
       "engines": {
@@ -6330,9 +6331,9 @@
       }
     },
     "node_modules/netmask": {
-      "version": "1.0.6",
-      "resolved": "https://registry.npmjs.org/netmask/-/netmask-1.0.6.tgz",
-      "integrity": "sha1-ICl+idhvb2QA8lDZ9Pa0wZRfzTU=",
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz",
+      "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==",
       "engines": {
         "node": ">= 0.4.0"
       }
@@ -6531,9 +6532,9 @@
       }
     },
     "node_modules/pac-proxy-agent": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-4.1.0.tgz",
-      "integrity": "sha512-ejNgYm2HTXSIYX9eFlkvqFp8hyJ374uDf0Zq5YUAifiSh1D6fo+iBivQZirGvVv8dCYUsLhmLBRhlAYvBKI5+Q==",
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-5.0.0.tgz",
+      "integrity": "sha512-CcFG3ZtnxO8McDigozwE3AqAw15zDvGH+OjXO4kzf7IkEKkQ4gxQ+3sdF50WmhQ4P/bVusXcqNE2S3XrNURwzQ==",
       "dependencies": {
         "@tootallnate/once": "1",
         "agent-base": "6",
@@ -6541,25 +6542,25 @@
         "get-uri": "3",
         "http-proxy-agent": "^4.0.1",
         "https-proxy-agent": "5",
-        "pac-resolver": "^4.1.0",
+        "pac-resolver": "^5.0.0",
         "raw-body": "^2.2.0",
         "socks-proxy-agent": "5"
       },
       "engines": {
-        "node": ">= 6"
+        "node": ">= 8"
       }
     },
     "node_modules/pac-resolver": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-4.1.0.tgz",
-      "integrity": "sha512-d6lf2IrZJJ7ooVHr7BfwSjRO1yKSJMaiiWYSHcrxSIUtZrCa4KKGwcztdkZ/E9LFleJfjoi1yl+XLR7AX24nbQ==",
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-5.0.0.tgz",
+      "integrity": "sha512-H+/A6KitiHNNW+bxBKREk2MCGSxljfqRX76NjummWEYIat7ldVXRU3dhRIE3iXZ0nvGBk6smv3nntxKkzRL8NA==",
       "dependencies": {
-        "degenerator": "^2.2.0",
+        "degenerator": "^3.0.1",
         "ip": "^1.1.5",
-        "netmask": "^1.0.6"
+        "netmask": "^2.0.1"
       },
       "engines": {
-        "node": ">= 6"
+        "node": ">= 8"
       }
     },
     "node_modules/packet-reader": {
@@ -6873,9 +6874,9 @@
       }
     },
     "node_modules/prettier": {
-      "version": "2.4.0",
-      "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.0.tgz",
-      "integrity": "sha512-DsEPLY1dE5HF3BxCRBmD4uYZ+5DCbvatnolqTqcxEgKVZnL2kUfyu7b8pPQ5+hTBkdhU9SLUmK0/pHb07RE4WQ==",
+      "version": "2.4.1",
+      "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz",
+      "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==",
       "dev": true,
       "bin": {
         "prettier": "bin-prettier.js"
@@ -6947,21 +6948,21 @@
       }
     },
     "node_modules/proxy-agent": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-4.0.1.tgz",
-      "integrity": "sha512-ODnQnW2jc/FUVwHHuaZEfN5otg/fMbvMxz9nMSUQfJ9JU7q2SZvSULSsjLloVgJOiv9yhc8GlNMKc4GkFmcVEA==",
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-5.0.0.tgz",
+      "integrity": "sha512-gkH7BkvLVkSfX9Dk27W6TyNOWWZWRilRfk1XxGNWOYJ2TuedAv1yFpCaU9QSBmBe716XOTNpYNOzhysyw8xn7g==",
       "dependencies": {
         "agent-base": "^6.0.0",
         "debug": "4",
         "http-proxy-agent": "^4.0.0",
         "https-proxy-agent": "^5.0.0",
         "lru-cache": "^5.1.1",
-        "pac-proxy-agent": "^4.1.0",
+        "pac-proxy-agent": "^5.0.0",
         "proxy-from-env": "^1.0.0",
         "socks-proxy-agent": "^5.0.0"
       },
       "engines": {
-        "node": ">=6"
+        "node": ">= 8"
       }
     },
     "node_modules/proxy-from-env": {
@@ -7491,18 +7492,18 @@
       }
     },
     "node_modules/smart-buffer": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.1.0.tgz",
-      "integrity": "sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw==",
+      "version": "4.2.0",
+      "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
+      "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
       "engines": {
         "node": ">= 6.0.0",
         "npm": ">= 3.0.0"
       }
     },
     "node_modules/socks": {
-      "version": "2.6.0",
-      "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.0.tgz",
-      "integrity": "sha512-mNmr9owlinMplev0Wd7UHFlqI4ofnBnNzFuzrm63PPaHgbkqCFe4T5LzwKmtQ/f2tX0NTpcdVLyD/FHxFBstYw==",
+      "version": "2.6.1",
+      "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.1.tgz",
+      "integrity": "sha512-kLQ9N5ucj8uIcxrDwjm0Jsqk06xdpBjGNQtpXy4Q8/QY2k+fY7nZH8CARy+hkbG+SGAovmzzuauCpBlb8FrnBA==",
       "dependencies": {
         "ip": "^1.1.5",
         "smart-buffer": "^4.1.0"
@@ -7513,11 +7514,11 @@
       }
     },
     "node_modules/socks-proxy-agent": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.0.tgz",
-      "integrity": "sha512-lEpa1zsWCChxiynk+lCycKuC502RxDWLKJZoIhnxrWNjLSDGYRFflHA1/228VkRcnv9TIb8w98derGbpKxJRgA==",
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.1.tgz",
+      "integrity": "sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ==",
       "dependencies": {
-        "agent-base": "6",
+        "agent-base": "^6.0.2",
         "debug": "4",
         "socks": "^2.3.3"
       },
@@ -7745,30 +7746,20 @@
       }
     },
     "node_modules/superagent-proxy": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/superagent-proxy/-/superagent-proxy-2.1.0.tgz",
-      "integrity": "sha512-DnarpKN6Xn8e3pYlFV4Yvsj9yxLY4q5FIsUe5JvN7vjzP+YCfzXv03dTkZSD2yzrSadsNYHf0IgOUJwKjX457A==",
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/superagent-proxy/-/superagent-proxy-3.0.0.tgz",
+      "integrity": "sha512-wAlRInOeDFyd9pyonrkJspdRAxdLrcsZ6aSnS+8+nu4x1aXbz6FWSTT9M6Ibze+eG60szlL7JA8wEIV7bPWuyQ==",
       "dependencies": {
-        "debug": "^3.1.0",
-        "proxy-agent": "^4.0.0"
+        "debug": "^4.3.2",
+        "proxy-agent": "^5.0.0"
       },
       "engines": {
         "node": ">=6"
+      },
+      "peerDependencies": {
+        "superagent": ">= 0.15.4 || 1 || 2 || 3"
       }
     },
-    "node_modules/superagent-proxy/node_modules/debug": {
-      "version": "3.2.7",
-      "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
-      "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
-      "dependencies": {
-        "ms": "^2.1.1"
-      }
-    },
-    "node_modules/superagent-proxy/node_modules/ms": {
-      "version": "2.1.3",
-      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
-      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
-    },
     "node_modules/superagent/node_modules/mime": {
       "version": "2.5.2",
       "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz",
@@ -8172,6 +8163,17 @@
         "node": ">= 0.8"
       }
     },
+    "node_modules/vm2": {
+      "version": "3.9.3",
+      "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.3.tgz",
+      "integrity": "sha512-smLS+18RjXYMl9joyJxMNI9l4w7biW8ilSDaVRvFBDwOH8P0BK1ognFQTpg0wyQ6wIKLTblHJvROW692L/E53Q==",
+      "bin": {
+        "vm2": "bin/vm2"
+      },
+      "engines": {
+        "node": ">=6.0"
+      }
+    },
     "node_modules/w3c-hr-time": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz",
@@ -8406,7 +8408,10 @@
     "node_modules/xregexp": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz",
-      "integrity": "sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM="
+      "integrity": "sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM=",
+      "engines": {
+        "node": "*"
+      }
     },
     "node_modules/xtend": {
       "version": "4.0.2",
@@ -9480,9 +9485,9 @@
       }
     },
     "@types/node": {
-      "version": "16.9.1",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz",
-      "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g=="
+      "version": "16.9.4",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.4.tgz",
+      "integrity": "sha512-KDazLNYAGIuJugdbULwFZULF9qQ13yNWEBFnfVpqlpgAAo6H/qnM9RjBgh0A0kmHf3XxAKLdN5mTIng9iUvVLA=="
     },
     "@types/parse-json": {
       "version": "4.0.0",
@@ -9692,9 +9697,9 @@
       },
       "dependencies": {
         "tslib": {
-          "version": "2.1.0",
-          "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz",
-          "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A=="
+          "version": "2.3.1",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
+          "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
         }
       }
     },
@@ -10214,9 +10219,9 @@
       "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA=="
     },
     "core-util-is": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
-      "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
+      "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
     },
     "cosmiconfig": {
       "version": "7.0.0",
@@ -10320,13 +10325,14 @@
       "dev": true
     },
     "degenerator": {
-      "version": "2.2.0",
-      "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-2.2.0.tgz",
-      "integrity": "sha512-aiQcQowF01RxFI4ZLFMpzyotbQonhNpBao6dkI8JPk5a+hmSjR5ErHp2CQySmQe8os3VBqLCIh87nDBgZXvsmg==",
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-3.0.1.tgz",
+      "integrity": "sha512-LFsIFEeLPlKvAKXu7j3ssIG6RT0TbI7/GhsqrI0DnHASEQjXQ0LUSYcjJteGgRGmZbl1TnMSxpNQIAiJ7Du5TQ==",
       "requires": {
         "ast-types": "^0.13.2",
         "escodegen": "^1.8.1",
-        "esprima": "^4.0.0"
+        "esprima": "^4.0.0",
+        "vm2": "^3.9.3"
       }
     },
     "delayed-stream": {
@@ -11082,11 +11088,6 @@
         "xregexp": "2.0.0"
       },
       "dependencies": {
-        "isarray": {
-          "version": "0.0.1",
-          "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
-          "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
-        },
         "readable-stream": {
           "version": "1.1.14",
           "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
@@ -11478,6 +11479,11 @@
       "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
       "dev": true
     },
+    "isarray": {
+      "version": "0.0.1",
+      "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+      "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
+    },
     "isexe": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@@ -12870,12 +12876,12 @@
       }
     },
     "libhoney": {
-      "version": "2.3.2",
-      "resolved": "https://registry.npmjs.org/libhoney/-/libhoney-2.3.2.tgz",
-      "integrity": "sha512-GH/RUiiBQJykBzzMc7KZF3u+uAMkkTEkFBjfcHErnGl+SZ0vmRH3a4QNt5138BPVoYTvCAjncjIQWz3YUOUWRA==",
+      "version": "2.3.3",
+      "resolved": "https://registry.npmjs.org/libhoney/-/libhoney-2.3.3.tgz",
+      "integrity": "sha512-WfujgzJjIxN4ZwRwX7iO1LFvzB9x+M7MGEN+FsPrCjTti+cA3CMYR400ElqRO84/ZwEphjiJrO+yqvVceu4N6Q==",
       "requires": {
         "superagent": "^6.1.0",
-        "superagent-proxy": "^2.0.0",
+        "superagent-proxy": "^3.0.0",
         "urljoin": "^0.1.5"
       }
     },
@@ -13279,9 +13285,9 @@
       "dev": true
     },
     "netmask": {
-      "version": "1.0.6",
-      "resolved": "https://registry.npmjs.org/netmask/-/netmask-1.0.6.tgz",
-      "integrity": "sha1-ICl+idhvb2QA8lDZ9Pa0wZRfzTU="
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz",
+      "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg=="
     },
     "node-int64": {
       "version": "0.4.0",
@@ -13425,9 +13431,9 @@
       "dev": true
     },
     "pac-proxy-agent": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-4.1.0.tgz",
-      "integrity": "sha512-ejNgYm2HTXSIYX9eFlkvqFp8hyJ374uDf0Zq5YUAifiSh1D6fo+iBivQZirGvVv8dCYUsLhmLBRhlAYvBKI5+Q==",
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-5.0.0.tgz",
+      "integrity": "sha512-CcFG3ZtnxO8McDigozwE3AqAw15zDvGH+OjXO4kzf7IkEKkQ4gxQ+3sdF50WmhQ4P/bVusXcqNE2S3XrNURwzQ==",
       "requires": {
         "@tootallnate/once": "1",
         "agent-base": "6",
@@ -13435,19 +13441,19 @@
         "get-uri": "3",
         "http-proxy-agent": "^4.0.1",
         "https-proxy-agent": "5",
-        "pac-resolver": "^4.1.0",
+        "pac-resolver": "^5.0.0",
         "raw-body": "^2.2.0",
         "socks-proxy-agent": "5"
       }
     },
     "pac-resolver": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-4.1.0.tgz",
-      "integrity": "sha512-d6lf2IrZJJ7ooVHr7BfwSjRO1yKSJMaiiWYSHcrxSIUtZrCa4KKGwcztdkZ/E9LFleJfjoi1yl+XLR7AX24nbQ==",
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-5.0.0.tgz",
+      "integrity": "sha512-H+/A6KitiHNNW+bxBKREk2MCGSxljfqRX76NjummWEYIat7ldVXRU3dhRIE3iXZ0nvGBk6smv3nntxKkzRL8NA==",
       "requires": {
-        "degenerator": "^2.2.0",
+        "degenerator": "^3.0.1",
         "ip": "^1.1.5",
-        "netmask": "^1.0.6"
+        "netmask": "^2.0.1"
       }
     },
     "packet-reader": {
@@ -13689,9 +13695,9 @@
       "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ="
     },
     "prettier": {
-      "version": "2.4.0",
-      "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.0.tgz",
-      "integrity": "sha512-DsEPLY1dE5HF3BxCRBmD4uYZ+5DCbvatnolqTqcxEgKVZnL2kUfyu7b8pPQ5+hTBkdhU9SLUmK0/pHb07RE4WQ==",
+      "version": "2.4.1",
+      "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz",
+      "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==",
       "dev": true
     },
     "pretty-format": {
@@ -13741,16 +13747,16 @@
       }
     },
     "proxy-agent": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-4.0.1.tgz",
-      "integrity": "sha512-ODnQnW2jc/FUVwHHuaZEfN5otg/fMbvMxz9nMSUQfJ9JU7q2SZvSULSsjLloVgJOiv9yhc8GlNMKc4GkFmcVEA==",
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-5.0.0.tgz",
+      "integrity": "sha512-gkH7BkvLVkSfX9Dk27W6TyNOWWZWRilRfk1XxGNWOYJ2TuedAv1yFpCaU9QSBmBe716XOTNpYNOzhysyw8xn7g==",
       "requires": {
         "agent-base": "^6.0.0",
         "debug": "4",
         "http-proxy-agent": "^4.0.0",
         "https-proxy-agent": "^5.0.0",
         "lru-cache": "^5.1.1",
-        "pac-proxy-agent": "^4.1.0",
+        "pac-proxy-agent": "^5.0.0",
         "proxy-from-env": "^1.0.0",
         "socks-proxy-agent": "^5.0.0"
       }
@@ -14189,25 +14195,25 @@
       }
     },
     "smart-buffer": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.1.0.tgz",
-      "integrity": "sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw=="
+      "version": "4.2.0",
+      "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
+      "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="
     },
     "socks": {
-      "version": "2.6.0",
-      "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.0.tgz",
-      "integrity": "sha512-mNmr9owlinMplev0Wd7UHFlqI4ofnBnNzFuzrm63PPaHgbkqCFe4T5LzwKmtQ/f2tX0NTpcdVLyD/FHxFBstYw==",
+      "version": "2.6.1",
+      "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.1.tgz",
+      "integrity": "sha512-kLQ9N5ucj8uIcxrDwjm0Jsqk06xdpBjGNQtpXy4Q8/QY2k+fY7nZH8CARy+hkbG+SGAovmzzuauCpBlb8FrnBA==",
       "requires": {
         "ip": "^1.1.5",
         "smart-buffer": "^4.1.0"
       }
     },
     "socks-proxy-agent": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.0.tgz",
-      "integrity": "sha512-lEpa1zsWCChxiynk+lCycKuC502RxDWLKJZoIhnxrWNjLSDGYRFflHA1/228VkRcnv9TIb8w98derGbpKxJRgA==",
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.1.tgz",
+      "integrity": "sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ==",
       "requires": {
-        "agent-base": "6",
+        "agent-base": "^6.0.2",
         "debug": "4",
         "socks": "^2.3.3"
       }
@@ -14387,27 +14393,12 @@
       }
     },
     "superagent-proxy": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/superagent-proxy/-/superagent-proxy-2.1.0.tgz",
-      "integrity": "sha512-DnarpKN6Xn8e3pYlFV4Yvsj9yxLY4q5FIsUe5JvN7vjzP+YCfzXv03dTkZSD2yzrSadsNYHf0IgOUJwKjX457A==",
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/superagent-proxy/-/superagent-proxy-3.0.0.tgz",
+      "integrity": "sha512-wAlRInOeDFyd9pyonrkJspdRAxdLrcsZ6aSnS+8+nu4x1aXbz6FWSTT9M6Ibze+eG60szlL7JA8wEIV7bPWuyQ==",
       "requires": {
-        "debug": "^3.1.0",
-        "proxy-agent": "^4.0.0"
-      },
-      "dependencies": {
-        "debug": {
-          "version": "3.2.7",
-          "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
-          "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
-          "requires": {
-            "ms": "^2.1.1"
-          }
-        },
-        "ms": {
-          "version": "2.1.3",
-          "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
-          "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
-        }
+        "debug": "^4.3.2",
+        "proxy-agent": "^5.0.0"
       }
     },
     "supertest": {
@@ -14728,6 +14719,11 @@
       "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
       "dev": true
     },
+    "vm2": {
+      "version": "3.9.3",
+      "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.3.tgz",
+      "integrity": "sha512-smLS+18RjXYMl9joyJxMNI9l4w7biW8ilSDaVRvFBDwOH8P0BK1ognFQTpg0wyQ6wIKLTblHJvROW692L/E53Q=="
+    },
     "w3c-hr-time": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz",


Test patch:
diff --git a/lib/api/index.test.js b/lib/api/index.test.js
index b7d4e0f..b4f4b2a 100644
--- a/lib/api/index.test.js
+++ b/lib/api/index.test.js
@@ -648,6 +648,76 @@ test("async spans share custom context", () => {
   expect(asyncData["app.custom"]).toBe("value");
 });
 
+test("addContext works on the current span", () => {
+  const honey = api._apiForTesting().honey;
+
+  let parentSpan = api.startTrace({ name: "parent" });
+  api.addContext({ field: "a" });
+
+  let childSpan = api.startSpan({ name: "child" });
+  api.addContext({ field: "b" });
+
+  let grandchildSpan = api.startSpan({ name: "grandchild" });
+  api.addContext({ field: "c" });
+
+  api.finishSpan(grandchildSpan);
+  api.finishSpan(childSpan);
+  api.finishTrace(parentSpan);
+
+  expect(honey.transmission.events.length).toBe(3);
+
+  let parentEvent = honey.transmission.events[2].postData;
+  let childEvent = honey.transmission.events[1].postData;
+  let grandchildEvent = honey.transmission.events[0].postData;
+
+  expect(parentEvent["name"]).toBe("parent");
+  expect(childEvent["name"]).toBe("child");
+  expect(grandchildEvent["name"]).toBe("grandchild");
+
+  expect(parentEvent["field"]).toBe("a");
+  expect(childEvent["field"]).toBe("b");
+  expect(grandchildEvent["field"]).toBe("c");
+});
+
+test("removeContext works on the current span", () => {
+  const honey = api._apiForTesting().honey;
+
+  let parentSpan = api.startTrace({ name: "parent" });
+  api.addContext({ a: 1, b: 2 });
+  api.removeContext("b");
+
+  let childSpan = api.startSpan({ name: "child" });
+  api.addContext({ b: 2, c: 3 });
+  api.removeContext("c");
+
+  let grandchildSpan = api.startSpan({ name: "grandchild" });
+  api.addContext({ c: 3, d: 4 });
+  api.removeContext("d");
+
+  api.finishSpan(grandchildSpan);
+  api.finishSpan(childSpan);
+  api.finishTrace(parentSpan);
+
+  expect(honey.transmission.events.length).toBe(3);
+
+  let parentEvent = honey.transmission.events[2].postData;
+  let childEvent = honey.transmission.events[1].postData;
+  let grandchildEvent = honey.transmission.events[0].postData;
+
+  expect(parentEvent["name"]).toBe("parent");
+  expect(childEvent["name"]).toBe("child");
+  expect(grandchildEvent["name"]).toBe("grandchild");
+
+  expect(parentEvent["a"]).toBe(1);
+  expect(parentEvent["b"]).toBeUndefined();
+
+  expect(childEvent["b"]).toBe(2);
+  expect(childEvent["c"]).toBeUndefined();
+
+  expect(grandchildEvent["c"]).toBe(3);
+  expect(grandchildEvent["d"]).toBeUndefined();
+});
+
 describe("presend hook", () => {
   it("calls the presend hook function if provided", () => {
     const mockPresendHook = jest.fn();