Skip to content
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
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c7097b5804d3ffa8a21d34b837c3a2a2435b619a
Choose a base ref
...
head repository: newrelic/node-newrelic
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2a8915327e8bc4d3a40c5a0dfe85222a51056752
Choose a head ref
Loading
Showing 640 changed files with 64,488 additions and 35,715 deletions.
5 changes: 5 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"reporter": ["lcov"],
"exclude": ["test/*", "*.mjs", "**/*.mjs"],
"clean": true
}
35 changes: 34 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -10,9 +10,42 @@ module.exports = {
plugins: ['jsdoc'],
rules: {
'consistent-return': 'off',
'jsdoc/require-jsdoc': 'off'
'jsdoc/require-jsdoc': 'off',
'jsdoc/no-undefined-types': [
'warn',
{
definedTypes: [
'Logger',
'Agent',
'Shim',
'TraceSegment',
'Transaction',
'Exception',
'MetricAggregator'
]
}
]
},
parserOptions: {
ecmaVersion: '2020'
},
parserOptions: {
ecmaVersion: 2020
},
ignorePatterns: ['test/versioned-external'],
overrides: [
{
files: ['**/*.mjs'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2022
},
rules: {
// TODO: remove this when we decide on how to address
// here: https://issues.newrelic.com/browse/NEWRELIC-3321
'node/no-unsupported-features/es-syntax': 'off'
}
},
{
files: ['newrelic.js'],
rules: {
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Troubleshooting
url: https://github.com/newrelic/node-newrelic/blob/main/README.md#support
about: Check out the README for troubleshooting directions
5 changes: 0 additions & 5 deletions .github/ISSUE_TEMPLATE/troubleshooting.md

This file was deleted.

22 changes: 15 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -6,14 +6,22 @@ This code is leveraged to monitor critical services. Please consider the followi
* 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.
Ensure that your Pull Request title adheres to our Conventional Commit standards
as described in CONTRIBUTING.md
Please update the Pull Request description to add relevant context or documentation about
the submitted change.
-->
## Description

Please provide a brief description of the changes introduced in this pull request.
What problem does it solve? What is the context of this change?

## How to Test

## Proposed Release Notes
Please describe how you have tested these changes. Have you run the code against an example application?
What steps did you take to ensure that the changes are working correctly?

## Links
## Related Issues

## Details
Please include any related issues or pull requests in this section, using the format `Closes #<issue number>` or `Fixes #<issue number>` if applicable.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: "npm"
# Disable version updates for npm dependencies, security updates don't use this configuration
# See: https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates
open-pull-requests-limit: 0
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "security"
prefix-development: "chore"
include: "scope"
14 changes: 14 additions & 0 deletions .github/workflows/add-to-board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Auto Assign to Project(s)

on:
issues:
types: [opened]
pull_request_target:
types: [opened]

jobs:
add-to-board:
uses: newrelic/node-newrelic/.github/workflows/board.yml@main
# See board.yml explaining why this has to be done
secrets:
gh_token: ${{ secrets.NODE_AGENT_GH_TOKEN }}
70 changes: 70 additions & 0 deletions .github/workflows/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This is intended to be called in any of our repos.
# To use you can look at `add-to-board.yml` as a reference.
# You should be able to just call `uses: newrelic/node-newrelic/.github/workflows/board.yml@main`
# If for some reason the "todo" or "needs pr" columns are different than the default, you can pass in
# via
# with:
# todo_column: 'TODO Column'
# pr_column: 'PR Column'
#
# If you do not want to add to the Node.js Engineering Board, you'll have to find the guid of the project
# by using the GitHub API
# `gh api -H "Accept: application/vnd.github.inertia-preview+json" orgs/newrelic/projects --jq ".[] | select(.name == \"<Name of Boarda>"\").id"`
#
# You can find a project via `orgs/newrelic/projects`, `repos/newrelic/<repo-name>/projects`

name: Add Issues/PRs to project board
on:
workflow_call:
inputs:
project_id:
description: Id of Project in GitHub
default: 5864688 # Node.js Engineering Board https://github.com/orgs/newrelic/projects/41
required: false
type: number
todo_column:
description: Name of the To-Do column in project
default: 'Triage Needed: Unprioritized Features'
required: false
type: string
pr_column:
description: Name of the In Review column in project
default: 'Needs PR Review'
required: false
type: string
# Cannot rely on environment secrets(i.e. from node-newrelic settings)
# in a reusable workflow. We must pass it in, see add-to-board.yml
# See: https://github.community/t/reusable-workflows-secrets-and-environments/203695/4
secrets:
gh_token:
description: Token used to make gh api calls, must have org level perms
required: true

jobs:
assign_to_project:
env:
# Cannot use `secrets.GITHUB_TOKEN` because the project board
# exists at org level. You cannot add permissions outside the scope
# of the given repo
GITHUB_TOKEN: ${{ secrets.gh_token }}
PROJECT_ID: ${{ inputs.project_id }}
HEADER: "Accept: application/vnd.github.inertia-preview+json"
runs-on: ubuntu-latest
name: Assign Issues and/or PRs to Project
steps:
- name: Assign PR to Project
if: github.event_name == 'pull_request_target'
run: |
PR_ID=${{ github.event.pull_request.id }}
COLUMN=$(gh api -H "$HEADER" projects/$PROJECT_ID/columns --jq ".[] | select(.name == \"$COLUMN_NAME\").id")
gh api -H "$HEADER" -X POST projects/columns/$COLUMN/cards -f content_type='PullRequest' -F content_id=$PR_ID
env:
COLUMN_NAME: ${{ inputs.pr_column}}
- name: Assign Issue to Project
if: github.event_name == 'issues'
run: |
ISSUE_ID=${{ github.event.issue.id }}
COLUMN=$(gh api -H "$HEADER" projects/$PROJECT_ID/columns --jq ".[] | select(.name == \"$COLUMN_NAME\").id")
gh api -H "$HEADER" -X POST projects/columns/$COLUMN/cards -f content_type='Issue' -F content_id=$ISSUE_ID
env:
COLUMN_NAME: ${{ inputs.todo_column}}
117 changes: 100 additions & 17 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -11,45 +11,77 @@ 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
run: npm ci
- name: Run Linting
run: npm run lint
- name: Inspect Lockfile
run: npm run lint:lockfile

ci:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [lts/*]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
- name: Run CI Script Unit Tests
run: npm run unit:scripts

unit:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
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 ci
- name: Run Unit Tests
run: npm run unit
- name: Archive Unit Test Coverage
uses: actions/upload-artifact@v3
with:
name: unit-tests-${{ matrix.node-version }}
path: ./coverage/unit/lcov.info
- name: Run ESM Unit Tests
run: npm run unit:esm
- name: Archive ESM Unit Test Coverage
uses: actions/upload-artifact@v3
with:
name: esm-unit-tests-${{ matrix.node-version }}
path: ./coverage/esm-unit/lcov.info

integration:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
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
@@ -58,31 +90,82 @@ jobs:
run: npm run services
- name: Run Integration Tests
run: npm run integration
- name: Archive Integration Test Coverage
uses: actions/upload-artifact@v3
with:
name: integration-tests-${{ matrix.node-version }}
path: ./coverage/integration/lcov.info

versioned:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
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 ci
- name: Run Docker Services
run: npm run services
- name: Run Versioned Tests (npm v6 / Node 10-14)
if: ${{ matrix.node-version != '16.x' }}
run: npm run versioned:npm6
- name: Run Versioned Tests (npm v6 / Node 12/14)
if: ${{ matrix.node-version == '14.x' }}
run: TEST_CHILD_TIMEOUT=600000 npm run versioned:npm6
env:
VERSIONED_MODE: ${{ github.ref == 'refs/heads/main' && '--minor' || '--major' }}
- name: Run Versioned Tests (npm v7 / Node 16)
if: ${{ matrix.node-version == '16.x' }}
run: npm run versioned:npm7
JOBS: 4 # 2 per CPU seems to be the sweet spot in GHA (July 2022)
C8_REPORTER: lcovonly
- name: Run Versioned Tests (npm v7 / Node 16+)
if: ${{ matrix.node-version != '14.x' }}
run: TEST_CHILD_TIMEOUT=600000 npm run versioned:npm7
env:
VERSIONED_MODE: ${{ github.ref == 'refs/heads/main' && '--minor' || '--major' }}
JOBS: 4 # 2 per CPU seems to be the sweet spot in GHA (July 2022)
C8_REPORTER: lcovonly
- name: Archive Versioned Test Coverage
uses: actions/upload-artifact@v3
with:
name: versioned-tests-${{ matrix.node-version }}
path: ./coverage/versioned/lcov.info

codecov:
needs: [unit, integration, versioned]
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Post Unit Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: unit-tests-${{ matrix.node-version }}
flags: unit-tests-${{ matrix.node-version }}
- name: Post ESM Unit Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: esm-unit-tests-${{ matrix.node-version }}
flags: esm-unit-tests-${{ matrix.node-version }}
- name: Post Integration Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: integration-tests-${{ matrix.node-version }}
flags: integration-tests-${{ matrix.node-version }}
- name: Post Versioned Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: versioned-tests-${{ matrix.node-version }}
flags: versioned-tests-${{ matrix.node-version }}
Loading