Repository: newrelic/node-newrelic (js)

Issue:
Confusing documentation example - WebFramework
## Where
in the file
[examples/shim/Webframework-Simple.md](https://raw.githubusercontent.com/newrelic/node-newrelic/main/examples/shim/Webframework-Simple.md)

I am experiencing some confusion with the first code sample:
```js
var myWebFramework = require('my-web-framework')

// create server
var server = new myWebFramework.Server()

server.all(function authenticate(req, res, next) {
  if (authenticate()) {
    next()
  } else {
    res.statusCode = 403
    res.end()
  }
})

server.get('/api/users', function(req, res) {
  res.write(getUsers())
  res.end()
})

server.get('/home', function(req, res) {
  this.render('home', function(err, renderedView) {
    res.write(renderedView)
    res.end()
  })
})

server.start(8080)
```


### Specifically these lines:
```js
server.all(function authenticate(req, res, next) {
  if (authenticate())
```
## Reason
The function `authenticate()` is recursively calling itself causing an infinite loop.

The function is declared in this line:
```js
server.all(function authenticate(req, res, next) {
```

And later calls a reference of itself the following line, thus causing an infinite loop:
```js
  if (authenticate())
```
## Solution
Use non conflicting names like:

```js
var myWebFramework = require('my-web-framework')
var authenticate = require('./lib/authenticate')

// create server
var server = new myWebFramework.Server()

server.all(function authenticateMiddleware(req, res, next) {
  if (authenticate()) {
    next()
  } else {
    res.statusCode = 403
    res.end()
  }
})

server.get('/api/users', function(req, res) {
  res.write(getUsers())
  res.end()
})

server.get('/home', function(req, res) {
  this.render('home', function(err, renderedView) {
    res.write(renderedView)
    res.end()
  })
})

server.start(8080)
```


 

Pull request:
Shim documentation update
<!--
Thank you for submitting a Pull Request.

This code is leveraged to monitor critical services. Please consider the following:
* Tests are required.
* Performance matters.
* Features that are specific to just your app are unlikely to make it in.

Please fill out the relevant sections as follows:
* Proposed Release Notes: Bulleted list of recommended release notes for the change(s).
* Links: Any relevant links for the change.
* Details: In-depth description of changes, other technical notes, etc.
-->

## Proposed Release Notes
* Update shim documentation (thanks  @ronen-e -- closes #485)

## Links
#485 
https://raw.githubusercontent.com/newrelic/node-newrelic/main/examples/shim/Webframework-Simple.md


Patch:
diff --git a/.github/workflows/repolinter.yml b/.github/workflows/repolinter.yml
deleted file mode 100644
index acb921f30..000000000
--- a/.github/workflows/repolinter.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-# NOTE: This file should always be named `repolinter.yml` to allow
-# workflow_dispatch to work properly
-name: Repolinter Action
-
-# NOTE: This workflow will ONLY check the default branch!
-# Currently there is no elegant way to specify the default
-# branch in the event filtering, so branches are instead
-# filtered in the "Test Default Branch" step.
-on: [push, workflow_dispatch]
-
-jobs:
-  repolint:
-    name: Run Repolinter
-    runs-on: ubuntu-latest
-    steps:
-      - name: Test Default Branch
-        id: default-branch
-        uses: actions/github-script@v2
-        with:
-          script: |
-            const data = await github.repos.get(context.repo)
-            return data.data && data.data.default_branch === context.ref.split('/').slice(-1)[0]
-      - name: Checkout Self
-        if: ${{ steps.default-branch.outputs.result == 'true' }}
-        uses: actions/checkout@v2
-      - name: Run Repolinter
-        if: ${{ steps.default-branch.outputs.result == 'true' }}
-        uses: newrelic/repolinter-action@v1
-        with:
-          config_url: https://raw.githubusercontent.com/newrelic/.github/main/repolinter-rulesets/community-plus.yml
-          output_type: issue
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..4fb725724
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,5 @@
+### Hello! We're glad you've joined us. 
+
+We believe participation in our community should be a harassment free experience for everyone. 
+
+Learn more about our guidelines and principles by reading our [Code of Conduct](https://opensource.newrelic.com/code-of-conduct/) on our Open Source Website. 
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 08214af1e..d152d5307 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -20,9 +20,9 @@ licensing restrictions.
 
 ### Code of Conduct
 
-Before contributing please read the [code of conduct](https://github.com/newrelic/.github/blob/main/CODE_OF_CONDUCT.md)
+Before contributing please read the [code of conduct](./CODE_OF_CONDUCT.md)
 
-Note that our [code of conduct](https://github.com/newrelic/.github/blob/main/CODE_OF_CONDUCT.md) applies to all platforms
+Note that our [code of conduct](./CODE_OF_CONDUCT.md) applies to all platforms
 and venues related to this project; please follow it in all your interactions
 with the project and its participants.
 
@@ -53,7 +53,7 @@ When contributing, keep in mind that New Relic customers (that's you!) are runni
 
 Be aware that the instrumentation needs to work with a wide range of versions of the instrumented modules, and that code that looks nonsensical or overcomplicated may be that way for compatibility-related reasons. Read all the comments and check the related tests before deciding whether existing code is incorrect.
 
-If you’re planning on contributing a new feature or an otherwise complex contribution, we kindly ask you to start a conversation with the maintainer team by opening up an Github issue first.
+If you’re planning on contributing a new feature or an otherwise complex contribution, we kindly ask you to start a conversation with the maintainer team by opening up an Github issue first. 
 
 ### General Guidelines
 
diff --git a/NEWS.md b/NEWS.md
index 240a0dc67..eeecd73ca 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,42 +1,3 @@
-## 6.13.1 (2020-09-24):
-
-* Fixed named-pipe check for lambda invocations to avoid race-condition.
-
-  Named-pipe existence will now be checked just prior to first write and then cached.
-
-* Updated README with community-plus header.
-
-* Updated README config copy example.
-
-* Added Open Source Policy workflow.
-
-* Removed repository CoC in favor of centralized CoC at org root.
-
-### 6.13.0 (2020-08-25):
-
-* Added ability for the agent to write to a named pipe, instead of stdout, when in serverless mode.
-
-### 6.12.1 (2020-08-20):
-
-* **Security fix:** Resolves an issue where transaction traces will still capture the request URI when the Node.js agent is configured to exclude the 'request.uri' attribute. This can be problematic for certain customers in environments where sensitive information is included in the URI. See security bulletin [NR20-02](https://docs.newrelic.com/docs/security/new-relic-security/security-bulletins/security-bulletin-nr20-02).
-
-  The request URI will now be excluded from transaction traces if the 'request.uri' attribute has been set to be excluded at either the top-level 'attributes.exclude' configuration or at the 'transaction_tracer.attributes.exclude' configuration.
-
-### 6.12.0 (2020-08-11):
-
-* Fixes obfuscation of SQL queries with large data inserts.
-Special thanks to Tomáš Hanáček (@tomashanacek) for tracking down the issue and providing the fix.
-* On failed instrumentation, prevent multiple requires from re-wrapping shims.
-Special thanks to Ryan Copley (@RyanCopley) for the contribution.
-* Upgrade `async` to `v3.2.0`. Special thanks to Yohan Siguret (@Crow-EH) for the contribution
-* Bumped `@newrelic/native-metrics` to `^5.3.0`.
-* Bumped `@newrelic/aws-sdk` to `^2.0.0`.
-* Bumped `node-test-utilities` to `^4.0.0`.
-* Bumped `@newrelic/superagent` to `^3.0.0`.
-* Bumps `@newrelic/koa` to `^4.0.0`.
-* Updated `SECURITY.md` with coordinated disclosure program link.
-* Updated guidelines and templates for contributing to the project.
-
 ### 6.11.0 (2020-07-07):
 
 * Updated to Apache 2.0 license
diff --git a/README.md b/README.md
index d99dc2510..61259e34e 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)
+[![Community Project header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Project.png)](https://opensource.newrelic.com/oss-category/#community-project)
 
 # New Relic's Node.js agent [![Server Smoke Tests][3]][4] [![Node Agent CI][5]][6]
 
@@ -20,11 +20,11 @@ To use New Relic's Node.js agent entails these three steps, which are described
 
 1. To install the agent for performance monitoring, use your favorite npm-based package manager and install the `newrelic` package into your application:
 
-    `$ npm install newrelic`
+    $ npm install newrelic
 
 2. Then, copy the stock configuration file to your program's base folder:
 
-    `$ cp ./node_modules/newrelic/newrelic.js ./<your destination>`
+    $ cp node_modules/newrelic/newrelic.js
 
 3. Now, add your New Relic license key and application/service name to that file:
 
@@ -172,4 +172,4 @@ The Node.js agent also uses source code from third-party libraries. You can find
 [3]: https://github.com/newrelic/node-newrelic/workflows/Server%20Smoke%20Tests/badge.svg
 [4]: https://github.com/newrelic/node-newrelic/actions?query=workflow%3A%22Server+Smoke+Tests%22
 [5]: https://github.com/newrelic/node-newrelic/workflows/Node%20Agent%20CI/badge.svg
-[6]: https://github.com/newrelic/node-newrelic/actions?query=workflow%3A%22Node+Agent+CI%22
+[6]: https://github.com/newrelic/node-newrelic/actions?query=workflow%3A%22Node+Agent+CI%22
\ No newline at end of file
diff --git a/examples/shim/Webframework-Simple.md b/examples/shim/Webframework-Simple.md
index 1203ae429..6eb7fa93a 100644
--- a/examples/shim/Webframework-Simple.md
+++ b/examples/shim/Webframework-Simple.md
@@ -11,12 +11,13 @@ similar concepts to popular web frameworks such as Express or Restify.
 Here is an example of how the web framework would be used in a user's code:
 
 ```js
-var myWebFramework = require('my-web-framework')
+const myWebFramework = require('my-web-framework')
+const authenticate = require('./lib/authenticate')
 
 // create server
-var server = new myWebFramework.Server()
+let server = new myWebFramework.Server()
 
-server.all(function authenticate(req, res, next) {
+server.all(function authenticateMiddleware(req, res, next) {
   if (authenticate()) {
     next()
   } else {
@@ -55,7 +56,7 @@ code. The function must be registered with the agent by calling {@link
 API#instrumentWebframework}.
 
 ```js
-var newrelic = require('newrelic')
+const newrelic = require('newrelic')
 newrelic.instrumentWebframework('my-web-framework', instrumentMyWebFramework)
 ```
 
@@ -138,7 +139,7 @@ endpoint middleware that responds to a specific request. Here is what the instru
 would look like:
 
 ```js
-var Server = myWebFramework.Server
+let Server = myWebFramework.Server
 
 shim.wrapMiddlewareMounter(Server.prototype, ['all', 'get'], {
   route: shim.FIRST,
@@ -217,7 +218,7 @@ the generated content. In order to record this work as the View metric, we will
 do the following in our instrumentation:
 
 ```js
-var Server = myWebFramework.Server
+let Server = myWebFramework.Server
 
 shim.recordRender(Server.prototype, 'render', {
   view: shim.FIRST,
diff --git a/lib/attributes.js b/lib/attributes.js
index 1c650c830..b65dd7e29 100644
--- a/lib/attributes.js
+++ b/lib/attributes.js
@@ -108,7 +108,7 @@ class Attributes {
   addAttribute(destinations, key, value, truncateExempt = false) {
     if (this.attributeCount + 1 > this.limit) {
       return logger.debug(
-        `Maximum number of custom attributes have been added.
+        `Maximum number of custom attributes have been added.  
         Dropping attribute ${key} with ${value} type.`
       )
     }
@@ -151,18 +151,6 @@ class Attributes {
       }
     }
   }
-
-  /**
-   * Returns true if a given key is valid for any of the
-   * provided destinations.
-   *
-   * @param {DESTINATIONS} destinations
-   * @param {string} key
-   */
-  hasValidDestination(destinations, key) {
-    const validDestinations = this.filter(destinations, key)
-    return !!validDestinations
-  }
 }
 
 /**
diff --git a/lib/collector/serverless.js b/lib/collector/serverless.js
index f83739cbd..7bc08364d 100644
--- a/lib/collector/serverless.js
+++ b/lib/collector/serverless.js
@@ -14,9 +14,6 @@ const stringify = require('json-stringify-safe')
 const PAYLOAD_VERSION = 1
 const PAYLOAD_MARKER = 'NR_LAMBDA_MONITORING'
 
-const path = require('path')
-const defaultPipePath = path.resolve('/tmp', 'newrelic-telemetry')
-
 class ServerlessCollector {
   /**
    * Constructs a new serverless collector instance with the give agent.
@@ -27,7 +24,7 @@ class ServerlessCollector {
    *
    * @param {Agent} agent - The agent this collector will use
    */
-  constructor(agent, pipePath) {
+  constructor(agent) {
     this._agent = agent
     this.enabled = true
     this.metadata = {
@@ -38,7 +35,6 @@ class ServerlessCollector {
       agent_version: agent.version
     }
     this.payload = {}
-    this.pipePath = pipePath || process.env.NEWRELIC_PIPE_PATH || defaultPipePath
   }
 
   /**
@@ -247,36 +243,6 @@ class ServerlessCollector {
     }
   }
 
-  /**
-   * Writes payload to pipe
-   */
-  flushToPipeSync(payload) {
-    try {
-      fs.writeFileSync(this.pipePath, payload)
-      return true
-    } catch (e) {
-      logger.warn('Error attempting to write to pipe, falling back to stdout', e)
-      return false
-    }
-  }
-
-  flushToStdOut(serializedPayload, payloadLength, sync = false) {
-    if (sync) {
-      // Long log lines have been truncated at 65538
-      // Guarantees process.stdout will block, so long logs
-      // won't be truncated if process.exit() is called early.
-      const s = process.stdout
-      payloadLength > 65000 &&
-      s._handle &&
-      s._handle.setBlocking &&
-      s._handle.setBlocking(true)
-
-      fs.writeSync(process.stdout.fd, serializedPayload)
-    } else {
-      process.stdout.write(serializedPayload)
-    }
-  }
-
   /**
    * Internal method to handle flushing to stdout.
    *
@@ -292,13 +258,19 @@ class ServerlessCollector {
       payload
     ]) + '\n'
 
-    if (this.shouldUsePipe === undefined) {
-      this.shouldUsePipe = fs.existsSync(this.pipePath)
-    }
-    const didUsePipe = this.shouldUsePipe && this.flushToPipeSync(serializedPayload)
+    if (sync) {
+      // Long log lines have been truncated at 65538
+      // Guarantees process.stdout will block, so long logs
+      // won't be truncated if process.exit() is called early.
+      const s = process.stdout
+      payload.length > 65000 &&
+      s._handle &&
+      s._handle.setBlocking &&
+      s._handle.setBlocking(true)
 
-    if (!didUsePipe) {
-      this.flushToStdOut(serializedPayload, payload.length, sync)
+      fs.writeSync(process.stdout.fd, serializedPayload)
+    } else {
+      process.stdout.write(serializedPayload)
     }
   }
 }
diff --git a/lib/prioritized-attributes.js b/lib/prioritized-attributes.js
index f844a4746..925d56c67 100644
--- a/lib/prioritized-attributes.js
+++ b/lib/prioritized-attributes.js
@@ -139,18 +139,6 @@ class PrioritizedAttributes {
     }
   }
 
-  /**
-   * Returns true if a given key is valid for any of the
-   * provided destinations.
-   *
-   * @param {DESTINATIONS} destinations
-   * @param {string} key
-   */
-  hasValidDestination(destinations, key) {
-    const validDestinations = this.filter(destinations, key)
-    return !!validDestinations
-  }
-
   _getDroppableAttributeKey(incomingPriority) {
     // There will never be anything lower priority to drop
     if (incomingPriority === ATTRIBUTE_PRIORITY.LOW) {
diff --git a/lib/transaction/trace/index.js b/lib/transaction/trace/index.js
index 0493c61ca..582d22109 100644
--- a/lib/transaction/trace/index.js
+++ b/lib/transaction/trace/index.js
@@ -15,8 +15,6 @@ var {DESTINATIONS} = require('../../config/attribute-filter')
 var FROM_MILLIS = 1e-3
 const ATTRIBUTE_SCOPE = 'transaction'
 
-const REQUEST_URI_KEY = 'request.uri'
-const UNKNOWN_URI_PLACEHOLDER = '/Unknown'
 
 /**
  * A Trace holds the root of the Segment graph and produces the final
@@ -295,13 +293,11 @@ Trace.prototype._generatePayload = function _generatePayload(data) {
     syntheticsResourceId = this.transaction.syntheticsData.resourceId
   }
 
-  const requestUri = this._getRequestUri()
-
   return [
     this.root.timer.start, // start
     this.transaction.getResponseTimeInMillis(),  // response time
     this.transaction.getFullName(),              // path
-    requestUri,  // request.uri
+    this.transaction.url,  // request.uri
     data,                   // encodedCompressedData
     this.transaction.id,    // guid
     null,                   // reserved for future use
@@ -311,25 +307,6 @@ Trace.prototype._generatePayload = function _generatePayload(data) {
   ]
 }
 
-/**
- * Returns the transaction URL if attribute is not exluded globally or
- * for transaction traces. Returns '/Unknown' if included but not known.
- *
- * The URI on a trace is a special attribute. It is included as a positional field,
- * not as an "agent attribute", to avoid having to decompress on the backend.
- * But it still needs to be gaited by the same attribute exclusion/inclusion
- * rules so sensitive information can be removed.
- */
-Trace.prototype._getRequestUri = function _getRequestUri() {
-  const canAddUri = this.attributes.hasValidDestination(DESTINATIONS.TRANS_TRACE, REQUEST_URI_KEY)
-  let requestUri = null // must be null if excluded
-  if (canAddUri) {
-    requestUri = this.transaction.url || UNKNOWN_URI_PLACEHOLDER
-  }
-
-  return requestUri
-}
-
 /**
  * Serializes the trace into the expected JSON format to be sent.
  *
diff --git a/package-lock.json b/package-lock.json
index 79a57cef8..3d77abaa5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "newrelic",
-  "version": "6.13.1",
+  "version": "6.11.0",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
diff --git a/package.json b/package.json
index 63eb74349..6cfeb0061 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "newrelic",
-  "version": "6.13.1",
+  "version": "6.11.0",
   "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
   "license": "Apache-2.0",
   "contributors": [


Test patch:
diff --git a/test/unit/attributes.test.js b/test/unit/attributes.test.js
index 1e22f0318..fee46e228 100644
--- a/test/unit/attributes.test.js
+++ b/test/unit/attributes.test.js
@@ -208,65 +208,6 @@ tap.test('#get', (t) => {
   })
 })
 
-tap.test('#hasValidDestination', (t) => {
-  t.autoend()
-
-  let agent = null
-
-  t.beforeEach((done) => {
-    agent = helper.loadMockedAgent()
-    done()
-  })
-
-  t.afterEach((done) => {
-    helper.unloadAgent(agent)
-    done()
-  })
-
-  t.test('should return true if single destination valid', (t) => {
-    const attributes = new Attributes(TRANSACTION_SCOPE)
-    const hasDestination = attributes.hasValidDestination(DESTINATIONS.TRANS_EVENT, 'testAttr')
-
-    t.equal(hasDestination, true)
-    t.end()
-  })
-
-  t.test('should return true if all destinations valid', (t) => {
-    const attributes = new Attributes(TRANSACTION_SCOPE)
-    const destinations = DESTINATIONS.TRANS_EVENT | DESTINATIONS.TRANS_TRACE
-    const hasDestination = attributes.hasValidDestination(destinations, 'testAttr')
-
-    t.equal(hasDestination, true)
-    t.end()
-  })
-
-  t.test('should return true if only one destination valid', (t) => {
-    const attributeName = 'testAttr'
-    agent.config.transaction_events.attributes.exclude = [attributeName]
-    agent.config.emit('transaction_events.attributes.exclude')
-
-    const attributes = new Attributes(TRANSACTION_SCOPE)
-    const destinations = DESTINATIONS.TRANS_EVENT | DESTINATIONS.TRANS_TRACE
-    const hasDestination = attributes.hasValidDestination(destinations, attributeName)
-
-    t.equal(hasDestination, true)
-    t.end()
-  })
-
-  t.test('should return false if no valid destinations', (t) => {
-    const attributeName = 'testAttr'
-    agent.config.attributes.exclude = [attributeName]
-    agent.config.emit('attributes.exclude')
-
-    const attributes = new Attributes(TRANSACTION_SCOPE)
-    const destinations = DESTINATIONS.TRANS_EVENT | DESTINATIONS.TRANS_TRACE
-    const hasDestination = attributes.hasValidDestination(destinations, attributeName)
-
-    t.equal(hasDestination, false)
-    t.end()
-  })
-})
-
 tap.test('#reset', (t) => {
   t.autoend()
 
diff --git a/test/unit/collector/serverless.test.js b/test/unit/collector/serverless.test.js
index 3498f7785..a89fdad46 100644
--- a/test/unit/collector/serverless.test.js
+++ b/test/unit/collector/serverless.test.js
@@ -14,11 +14,9 @@ const nock = require('nock')
 const chai = require('chai')
 const expect = chai.expect
 const sinon = require('sinon')
-const fs = require('fs')
 const helper = require('../../lib/agent_helper')
 const API = require('../../../lib/collector/serverless')
 const serverfulAPI = require('../../../lib/collector/api')
-const path = require('path')
 
 describe('ServerlessCollector API', () => {
   let api = null
@@ -177,16 +175,11 @@ describe('ServerlessCollector API', () => {
     it('compresses full payload and writes formatted to stdout', (done) => {
       api.payload = {type: 'test payload'}
       api.flushPayload(() => {
-        let logPayload = null
-
-        logPayload = JSON.parse(logStub.args[0][0])
-
+        const logPayload = JSON.parse(logStub.args[0][0])
         expect(logPayload).to.be.an('array')
         expect(logPayload[0]).to.be.a('number')
-
         expect(logPayload[1]).to.equal('NR_LAMBDA_MONITORING')
         expect(logPayload[2]).to.be.a('string')
-
         done()
       })
     })
@@ -197,101 +190,8 @@ describe('ServerlessCollector API', () => {
       }
 
       api.flushPayload(() => {
-        let logPayload = null
-
-        logPayload = JSON.parse(logStub.getCall(0).args[0])
-
+        const logPayload = JSON.parse(logStub.getCall(0).args[0])
         const buf = Buffer.from(logPayload[2], 'base64')
-
-        zlib.gunzip(buf, (err, unpack) => {
-          expect(err).to.be.null
-          const payload = JSON.parse(unpack)
-          expect(payload.data).to.be.ok
-          expect(Object.keys(payload.data)).to.have.lengthOf.above(4000)
-          done()
-        })
-      })
-    })
-  })
-})
-
-
-describe('ServerlessCollector with output to custom pipe', () => {
-  let api = null
-  let agent = null
-  const customPath = path.resolve('/tmp', 'custom-output')
-
-  before(async function() {
-    // create a placeholder file so we can test custom paths
-    process.env.NEWRELIC_PIPE_PATH = customPath
-    await fs.open(customPath, 'w', (err, fd) => {
-      expect(err).to.be.null
-      expect(fd).to.be.ok
-      return fd
-    })
-  })
-
-  after(async function() {
-    // remove the placeholder file
-    await fs.unlink(customPath, (err ) => {
-      expect(err).to.be.null
-      return
-    })
-  })
-
-  beforeEach(() => {
-    nock.disableNetConnect()
-    agent = helper.loadMockedAgent({
-      serverless_mode: {
-        enabled: true
-      },
-      app_name: ['TEST'],
-      license_key: 'license key here',
-      NEWRELIC_PIPE_PATH: customPath
-    })
-    agent.reconfigure = () => {}
-    agent.setState = () => {}
-    api = new API(agent)
-  })
-
-  afterEach(() => {
-    nock.enableNetConnect()
-    helper.unloadAgent(agent)
-  })
-
-  describe('#flushPayloadToPipe', () => {
-    let writeFileSyncStub = null
-
-    beforeEach(() => {
-      writeFileSyncStub = sinon.stub(fs, 'writeFileSync').callsFake(() => {})
-    })
-
-    afterEach(() => {
-      writeFileSyncStub.restore()
-    })
-
-    it('compresses full payload and writes formatted to stdout', (done) => {
-      api.payload = {type: 'test payload'}
-      api.flushPayload(() => {
-        const writtenPayload = JSON.parse(writeFileSyncStub.args[0][1])
-        expect(writtenPayload).to.be.an('array')
-        expect(writtenPayload[0]).to.be.a('number')
-        expect(writtenPayload[1]).to.equal('NR_LAMBDA_MONITORING')
-        expect(writtenPayload[2]).to.be.a('string')
-
-        done()
-      })
-    })
-    it('handles very large payload and writes formatted to stdout', done => {
-      api.payload = {type: 'test payload'}
-      for (let i = 0; i < 4096; i++) {
-        api.payload[`customMetric${i}`] = Math.floor(Math.random() * 100000)
-      }
-
-      api.flushPayload(() => {
-        const writtenPayload = JSON.parse(writeFileSyncStub.getCall(0).args[1])
-        const buf = Buffer.from(writtenPayload[2], 'base64')
-
         zlib.gunzip(buf, (err, unpack) => {
           expect(err).to.be.null
           const payload = JSON.parse(unpack)
diff --git a/test/unit/prioritized-attributes.test.js b/test/unit/prioritized-attributes.test.js
index b9b4c4d81..c497fa7c7 100644
--- a/test/unit/prioritized-attributes.test.js
+++ b/test/unit/prioritized-attributes.test.js
@@ -444,65 +444,6 @@ tap.test('#get', (t) => {
   })
 })
 
-tap.test('#hasValidDestination', (t) => {
-  t.autoend()
-
-  let agent = null
-
-  t.beforeEach((done) => {
-    agent = helper.loadMockedAgent()
-    done()
-  })
-
-  t.afterEach((done) => {
-    helper.unloadAgent(agent)
-    done()
-  })
-
-  t.test('should return true if single destination valid', (t) => {
-    const attributes = new PrioritizedAttributes(TRANSACTION_SCOPE)
-    const hasDestination = attributes.hasValidDestination(DESTINATIONS.TRANS_EVENT, 'testAttr')
-
-    t.equal(hasDestination, true)
-    t.end()
-  })
-
-  t.test('should return true if all destinations valid', (t) => {
-    const attributes = new PrioritizedAttributes(TRANSACTION_SCOPE)
-    const destinations = DESTINATIONS.TRANS_EVENT | DESTINATIONS.TRANS_TRACE
-    const hasDestination = attributes.hasValidDestination(destinations, 'testAttr')
-
-    t.equal(hasDestination, true)
-    t.end()
-  })
-
-  t.test('should return true if only one destination valid', (t) => {
-    const attributeName = 'testAttr'
-    agent.config.transaction_events.attributes.exclude = [attributeName]
-    agent.config.emit('transaction_events.attributes.exclude')
-
-    const attributes = new PrioritizedAttributes(TRANSACTION_SCOPE)
-    const destinations = DESTINATIONS.TRANS_EVENT | DESTINATIONS.TRANS_TRACE
-    const hasDestination = attributes.hasValidDestination(destinations, attributeName)
-
-    t.equal(hasDestination, true)
-    t.end()
-  })
-
-  t.test('should return false if no valid destinations', (t) => {
-    const attributeName = 'testAttr'
-    agent.config.attributes.exclude = [attributeName]
-    agent.config.emit('attributes.exclude')
-
-    const attributes = new PrioritizedAttributes(TRANSACTION_SCOPE)
-    const destinations = DESTINATIONS.TRANS_EVENT | DESTINATIONS.TRANS_TRACE
-    const hasDestination = attributes.hasValidDestination(destinations, attributeName)
-
-    t.equal(hasDestination, false)
-    t.end()
-  })
-})
-
 tap.test('#reset', (t) => {
   t.autoend()
 
diff --git a/test/unit/trace.test.js b/test/unit/trace.test.js
index e1f65ce02..3f90022aa 100644
--- a/test/unit/trace.test.js
+++ b/test/unit/trace.test.js
@@ -718,98 +718,6 @@ describe('Trace', function() {
   })
 })
 
-tap.test('should set URI to null when request.uri attribute is excluded globally', (t) => {
-  const URL = '/test'
-
-  const agent = helper.loadMockedAgent({
-    attributes: {
-      exclude: ['request.uri']
-    }
-  })
-
-  t.tearDown(() => {
-    helper.unloadAgent(agent)
-  })
-
-  const transaction = new Transaction(agent)
-  transaction.url  = URL
-  transaction.verb = 'GET'
-
-  const trace = transaction.trace
-
-  trace.end()
-
-  trace.generateJSON(function(err, traceJSON) {
-    if (err) {
-      t.error(err)
-    }
-
-    const {3: requestUri} = traceJSON
-    t.notOk(requestUri)
-
-    t.end()
-  })
-})
-
-tap.test('should set URI to null when request.uri attribute is exluded from traces', (t) => {
-  const URL = '/test'
-
-  const agent = helper.loadMockedAgent({
-    transaction_tracer: {
-      attributes: {
-        exclude: ['request.uri']
-      }
-    }
-  })
-
-  t.tearDown(() => {
-    helper.unloadAgent(agent)
-  })
-
-  const transaction = new Transaction(agent)
-  transaction.url  = URL
-  transaction.verb = 'GET'
-
-  const trace = transaction.trace
-
-  trace.end()
-
-  trace.generateJSON(function(err, traceJSON) {
-    if (err) {
-      t.error(err)
-    }
-
-    const {3: requestUri} = traceJSON
-    t.notOk(requestUri)
-
-    t.end()
-  })
-})
-
-tap.test('should set URI to /Unknown when URL is not known/set on transaction', (t) => {
-  const agent = helper.loadMockedAgent()
-
-  t.tearDown(() => {
-    helper.unloadAgent(agent)
-  })
-
-  const transaction = new Transaction(agent)
-  const trace = transaction.trace
-
-  trace.end()
-
-  trace.generateJSON(function(err, traceJSON) {
-    if (err) {
-      t.error(err)
-    }
-
-    const {3: requestUri} = traceJSON
-    t.equal(requestUri, '/Unknown')
-
-    t.end()
-  })
-})
-
 function makeTrace(agent, callback) {
   var DURATION = 33
   var URL = '/test?test=value'