Skip to content
This repository was archived by the owner on Jun 5, 2024. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: newrelic/node-newrelic-aws-sdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: baa853b062608f2cdb46be0029d8b70388226447
Choose a base ref
...
head repository: newrelic/node-newrelic-aws-sdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d2d4d9c53b0fddb5e3b610a2860c6d51ac40f4b8
Choose a head ref

Commits on Sep 20, 2022

  1. Copy the full SHA
    478760c View commit details

Commits on Sep 22, 2022

  1. Copy the full SHA
    b12d4fc View commit details
  2. Copy the full SHA
    23124cd View commit details

Commits on Sep 23, 2022

  1. Merge pull request #148 from newrelic/coreyarnold-patch-1

    add issue templates for jira linking NEWRELIC-3748
    jordigh authored Sep 23, 2022
    Copy the full SHA
    ce907cc View commit details

Commits on Oct 6, 2022

  1. Copy the full SHA
    fd1f5e3 View commit details

Commits on Oct 7, 2022

  1. Merge pull request #150 from bizob2828/fix-dynamo-port

    default dynamodb port to 443 when undefined on endpoint instance
    bizob2828 authored Oct 7, 2022
    Copy the full SHA
    eaf876a View commit details

Commits on Oct 10, 2022

  1. Copy the full SHA
    526e3f7 View commit details
  2. Copy the full SHA
    eb65ce5 View commit details
  3. Copy the full SHA
    1d0c5ef View commit details
  4. Merge pull request #151 from newrelic/release/v5.0.1

    Release v5.0.1
    jmartin4563 authored Oct 10, 2022
    Copy the full SHA
    c6c6d70 View commit details

Commits on Oct 19, 2022

  1. Temporarily lock down version of @aws-sdk/client-s3

    Version 3.192.0 released today and is busted, so until aws/aws-sdk-js-v3#4053 is fixed, we're locking down to lower versions to fix CI
    jmartin4563 committed Oct 19, 2022
    Copy the full SHA
    f9e50fe View commit details
  2. Merge pull request #152 from jmartin4563/aws-sdk-v3-version-lock

    Temporarily lock down version of @aws-sdk/client-s3
    jmartin4563 authored Oct 19, 2022
    Copy the full SHA
    9c491e3 View commit details

Commits on Oct 20, 2022

  1. Update s3-client semver range to skip 3.192.0

    Follow up from #152 now that AWS has released a new version
    jmartin4563 committed Oct 20, 2022
    Copy the full SHA
    77970a1 View commit details
  2. Merge pull request #153 from jmartin4563/unlock-version

    Update s3-client semver range to skip 3.192.0
    jmartin4563 authored Oct 20, 2022
    Copy the full SHA
    9f69a2a View commit details

Commits on Oct 24, 2022

  1. Copy the full SHA
    0d92a9b View commit details
  2. Copy the full SHA
    a75edce View commit details
  3. Copy the full SHA
    9804f6a View commit details
  4. Copy the full SHA
    26e014b View commit details
  5. Merge pull request #155 from jmartin4563/lock-down-all-packages

    Lock down all packages to max v3.193.0
    jmartin4563 authored Oct 24, 2022
    Copy the full SHA
    76e2234 View commit details

Commits on Oct 25, 2022

  1. Copy the full SHA
    9545638 View commit details

Commits on Oct 26, 2022

  1. Copy the full SHA
    eb63a30 View commit details
  2. Copy the full SHA
    458fed7 View commit details
  3. Copy the full SHA
    bf23eb8 View commit details
  4. Copy the full SHA
    bee94f5 View commit details
  5. Copy the full SHA
    5eedb51 View commit details
  6. Merge pull request #156 from bizob2828/update-deprecated-actions

    update actions that are using deprecated node 12
    bizob2828 authored Oct 26, 2022
    Copy the full SHA
    9e8cbcd View commit details
  7. Copy the full SHA
    ff6e862 View commit details
  8. Copy the full SHA
    4967ed5 View commit details

Commits on Oct 27, 2022

  1. Merge pull request #157 from jmartin4563/NR-60705-codecov

    NR-60705 wire up c8 and codecov for coverage collection
    jmartin4563 authored Oct 27, 2022
    Copy the full SHA
    5bf14e4 View commit details
  2. NEWRELIC-4422: remove usage of __NR_instrumented in tests

    I want to remove this magic property in the agent and replace it with
    a proper symbol. Having it in this test is cramping my style.
    Jordi Gutiérrez Hermoso committed Oct 27, 2022
    Copy the full SHA
    843b507 View commit details
  3. NEWRELIC-4422: patch up a test

    Jordi Gutiérrez Hermoso committed Oct 27, 2022
    Copy the full SHA
    ea6a76b View commit details
  4. Merge pull request #158 from jordigh/remove-dunder-nr

    NEWRELIC-4422: remove usage of __NR_instrumented in tests
    jordigh authored Oct 27, 2022
    Copy the full SHA
    c7a49dc View commit details

Commits on Nov 4, 2022

  1. Copy the full SHA
    ae3d723 View commit details
  2. Merge pull request #159 from bizob2828/remove-failures

    updated versions tests to test v3 vesions > 3.194.0 as AWS seems to have fixed their issues
    bizob2828 authored Nov 4, 2022
    Copy the full SHA
    c176f68 View commit details

Commits on Nov 7, 2022

  1. added defensive code to work around a breaking change in aws sdk mino…

    …r version :shakesfist:
    
    updated the versioned tests to use nr-hooks to register instrumentation
    bizob2828 committed Nov 7, 2022
    Copy the full SHA
    546b942 View commit details
  2. Merge pull request #161 from bizob2828/defensive-ddb

    Add defensive code around retrieving endpoint
    bizob2828 authored Nov 7, 2022
    Copy the full SHA
    4940778 View commit details
  3. Setting version to v5.0.2.

    bizob2828 committed Nov 7, 2022
    Copy the full SHA
    1376468 View commit details
  4. Copy the full SHA
    3a2a663 View commit details
  5. changelog tweaks

    bizob2828 committed Nov 7, 2022
    Copy the full SHA
    b2bb77f View commit details
  6. Merge pull request #162 from newrelic/release/v5.0.2

    Release v5.0.2
    bizob2828 authored Nov 7, 2022
    Copy the full SHA
    d2d4d9c View commit details
Showing with 665 additions and 252 deletions.
  1. +5 −0 .c8rc.json
  2. +6 −0 .github/ISSUE_TEMPLATE/config.yml
  3. +0 −27 .github/ISSUE_TEMPLATE/enhancement.md
  4. +0 −5 .github/ISSUE_TEMPLATE/troubleshooting.md
  5. +20 −6 .github/workflows/ci-workflow.yml
  6. +3 −3 .github/workflows/repolinter.yml
  7. +10 −0 CHANGELOG.md
  8. +7 −2 README.md
  9. +24 −1 THIRD_PARTY_NOTICES.md
  10. +19 −1 lib/util.js
  11. +3 −5 lib/v2/dynamodb.js
  12. +26 −7 lib/v3/dynamodb-util.js
  13. +372 −66 package-lock.json
  14. +8 −8 package.json
  15. +56 −2 tests/unit/util.tap.js
  16. +4 −7 tests/versioned/common.js
  17. +1 −5 tests/versioned/v2/amazon-dax-client.tap.js
  18. +2 −5 tests/versioned/v2/aws-sdk.tap.js
  19. +3 −6 tests/versioned/v2/dynamodb.tap.js
  20. +1 −5 tests/versioned/v2/http-services.tap.js
  21. +9 −8 tests/versioned/v2/instrumentation-supported.tap.js
  22. +11 −10 tests/versioned/v2/instrumentation-unsupported.tap.js
  23. +1 −5 tests/versioned/v2/s3.tap.js
  24. +1 −5 tests/versioned/v2/sns.tap.js
  25. +1 −5 tests/versioned/v2/sqs.tap.js
  26. +1 −1 tests/versioned/v3/api-gateway.tap.js
  27. +25 −9 tests/versioned/v3/client-dynamodb.tap.js
  28. +1 −1 tests/versioned/v3/elasticache.tap.js
  29. +1 −1 tests/versioned/v3/elb.tap.js
  30. +1 −1 tests/versioned/v3/lambda.tap.js
  31. +4 −9 tests/versioned/v3/lib-dynamodb.tap.js
  32. +13 −13 tests/versioned/v3/package.json
  33. +1 −1 tests/versioned/v3/rds.tap.js
  34. +1 −1 tests/versioned/v3/redshift.tap.js
  35. +1 −1 tests/versioned/v3/rekognition.tap.js
  36. +1 −1 tests/versioned/v3/s3.tap.js
  37. +1 −1 tests/versioned/v3/ses.tap.js
  38. +1 −6 tests/versioned/v3/sns.tap.js
  39. +1 −6 tests/versioned/v3/sqs.tap.js
  40. +19 −6 third_party_manifest.json
5 changes: 5 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"reporter": ["html", "lcov"],
"all": true,
"exclude": ["tests/*", "coverage/*", ".eslintrc.js"]
}
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
blank_issues_enabled: false
contact_links:
- name: Troubleshooting
url: https://github.com/newrelic/node-newrelic-aws-sdk/blob/main/README.md#support
about: Check out the README for troubleshooting directions

27 changes: 0 additions & 27 deletions .github/ISSUE_TEMPLATE/enhancement.md

This file was deleted.

5 changes: 0 additions & 5 deletions .github/ISSUE_TEMPLATE/troubleshooting.md

This file was deleted.

26 changes: 20 additions & 6 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -11,9 +11,9 @@ jobs:
node-version: [lts/*]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
@@ -29,15 +29,22 @@ jobs:
node-version: [14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm install
- name: Run Unit Tests
run: npm run unit
- name: Post Unit Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/unit/
files: lcov.info
flags: unit-tests-${{ matrix.node-version }}

versioned:
runs-on: ubuntu-latest
@@ -47,9 +54,9 @@ jobs:
node-version: [14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
@@ -60,3 +67,10 @@ jobs:
- name: Run Versioned Tests (npm v7+ / Node 16+)
if: ${{ matrix.node-version != '14.x' }}
run: npm run versioned:npm7
- name: Post Versioned Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/versioned/
files: lcov.info
flags: versioned-tests-${{ matrix.node-version }}
6 changes: 3 additions & 3 deletions .github/workflows/repolinter.yml
Original file line number Diff line number Diff line change
@@ -15,14 +15,14 @@ jobs:
steps:
- name: Test Default Branch
id: default-branch
uses: actions/github-script@v2
uses: actions/github-script@v6
with:
script: |
const data = await github.repos.get(context.repo)
const data = await github.rest.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
uses: actions/checkout@v3
- name: Run Repolinter
if: ${{ steps.default-branch.outputs.result == 'true' }}
uses: newrelic/repolinter-action@v1
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
### v5.0.2 (2022-11-07)

* Fixed a crash when using versions >3.192.0 of AWS sdk v3 where a customer would see an error of `error: TypeError: config.endpoint is not a function`.

* Updated versioned tests to exclude 3.194.0-3.196.0 from tests because they contain breaking changes.

### v5.0.1 (2022-10-10)

* Updated DynamoDB instrumentation to default port to 443 when not specified from the endpoint.

### v5.0.0 (2022-07-28)

* **BREAKING** Removed support for Node 12.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![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 Plus header](https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)

# New Relic AWS SDK Instrumentation [![aws-sdk Instrumentation CI][1]][2]
# New Relic AWS SDK Instrumentation
[![npm status badge][5]][6] [![aws-sdk Instrumentation CI][1]][2] [![codecov][3]][4]

New Relic's official AWS SDK package instrumentation for use with [the Node.js agent](https://github.com/newrelic/node-newrelic). Provides instrumentation for the [AWS SDK (`aws-sdk`)](https://www.npmjs.com/package/aws-sdk) npm package.

@@ -86,3 +87,7 @@ The New Relic AWS SDK Instrumentation package is licensed under the [Apache 2.0]

[1]: https://github.com/newrelic/node-newrelic-aws-sdk/workflows/aws-sdk%20Instrumentation%20CI/badge.svg
[2]: https://github.com/newrelic/node-newrelic-aws-sdk/actions?query=workflow%3A%22aws-sdk+Instrumentation+CI%22
[3]: https://codecov.io/gh/newrelic/node-newrelic-aws-sdk/branch/main/graph/badge.svg?token=26ZH9QhLNn
[4]: https://codecov.io/gh/newrelic/node-newrelic-aws-sdk
[5]: https://img.shields.io/npm/v/@newrelic/aws-sdk.svg
[6]: https://www.npmjs.com/package/@newrelic/aws-sdk
25 changes: 24 additions & 1 deletion THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
* [@newrelic/newrelic-oss-cli](#newrelicnewrelic-oss-cli)
* [@newrelic/test-utilities](#newrelictest-utilities)
* [aws-sdk](#aws-sdk)
* [c8](#c8)
* [eslint-config-prettier](#eslint-config-prettier)
* [eslint-plugin-header](#eslint-plugin-header)
* [eslint-plugin-node](#eslint-plugin-node)
@@ -458,7 +459,7 @@ This product includes source derived from [@newrelic/newrelic-oss-cli](https://g

### @newrelic/test-utilities

This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v6.1.1](https://github.com/newrelic/node-test-utilities/tree/v6.1.1)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v6.1.1/LICENSE):
This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v7.1.1](https://github.com/newrelic/node-test-utilities/tree/v7.1.1)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v7.1.1/LICENSE):

```
Apache License
@@ -875,6 +876,28 @@ This product includes source derived from [aws-sdk](https://github.com/aws/aws-s
```

### c8

This product includes source derived from [c8](https://github.com/bcoe/c8) ([v7.12.0](https://github.com/bcoe/c8/tree/v7.12.0)), distributed under the [ISC License](https://github.com/bcoe/c8/blob/v7.12.0/LICENSE.txt):

```
Copyright (c) 2017, Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice
appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```

### eslint-config-prettier

This product includes source derived from [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) ([v8.3.0](https://github.com/prettier/eslint-config-prettier/tree/v8.3.0)), distributed under the [MIT License](https://github.com/prettier/eslint-config-prettier/blob/v8.3.0/LICENSE):
20 changes: 19 additions & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@
*/

'use strict'
const UNKNOWN = 'Unknown'

function grabLastUrlSegment(url = '/') {
// cast URL as string, and an empty
// string for null, undefined, NaN etc.
@@ -14,6 +16,22 @@ function grabLastUrlSegment(url = '/') {
return lastItem
}

/**
* Retrieves the db segment params from endpoint and command parameters
*
* @param {Object} endpoint instance of ddb endpoint
* @param {Object} params parameters passed to a ddb command
* @returns {Object}
*/
function setDynamoParameters(endpoint, params) {
return {
host: endpoint && (endpoint.host || endpoint.hostname),
port_path_or_id: (endpoint && endpoint.port) || 443,
collection: (params && params.TableName) || UNKNOWN
}
}

module.exports = {
grabLastUrlSegment
grabLastUrlSegment,
setDynamoParameters
}
8 changes: 3 additions & 5 deletions lib/v2/dynamodb.js
Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@ const DOC_CLIENT_OPERATIONS = [
'scan'
]

const { setDynamoParameters } = require('../util')

function instrument(shim, AWS) {
shim.setDatastore(shim.DYNAMODB)

@@ -43,11 +45,7 @@ function instrument(shim, AWS) {

return {
name: operationName,
parameters: {
host: this.endpoint && this.endpoint.host,
port_path_or_id: this.endpoint && this.endpoint.port,
collection: (params && params.TableName) || 'Unknown'
},
parameters: setDynamoParameters(this.endpoint, params),
callback: shim.LAST,
opaque: true
}
33 changes: 26 additions & 7 deletions lib/v3/dynamodb-util.js
Original file line number Diff line number Diff line change
@@ -4,8 +4,7 @@
*/

'use strict'

const UNKNOWN = 'Unknown'
const { setDynamoParameters } = require('../util')

/**
* Returns the spec for Dynamo commands
@@ -18,18 +17,32 @@ const UNKNOWN = 'Unknown'
*/
function getDynamoSpec(shim, original, name, args) {
const [{ input }] = args
const collection = (input && input.TableName) || UNKNOWN
const host = this.endpoint && this.endpoint.hostname
const portPathOrId = this.endpoint && this.endpoint.port
return {
name: this.commandName,
parameters: { host, port_path_or_id: portPathOrId, collection },
parameters: setDynamoParameters(this.endpoint, input),
callback: shim.LAST,
opaque: true,
promise: true
}
}

/**
* AWS sdk v 3.194?.0 released a breaking change.
* See: https://github.com/aws/aws-sdk-js-v3/issues/4122
* What this means is config.endpoint is not always a function
* unless you provide an endpoint override to your library constructor
* This function will derive the endpoint in that scenario by grabbing the region
* and building the URL
*/
async function getEndpoint(config) {
if (typeof config.endpoint === 'function') {
return await config.endpoint()
}

const region = await config.region()
return new URL(`https://dynamodb.${region}.amazonaws.com`)
}

/**
* Middleware hook that records the middleware chain
* when command is in a list of monitored commands.
@@ -43,7 +56,13 @@ function getDynamoSpec(shim, original, name, args) {
function dynamoMiddleware(shim, config, next, context) {
const { commandName } = context
return async function wrappedMiddleware(args) {
const endpoint = await config.endpoint()
let endpoint = null
try {
endpoint = await getEndpoint(config)
} catch (err) {
shim.logger.debug(err, 'Failed to get the endpoint.')
}

const getSpec = getDynamoSpec.bind({ endpoint, commandName })
const wrappedNext = shim.recordOperation(next, getSpec)
return wrappedNext(args)
Loading