Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Migrated @newrelic/koa into mainline agent repo #2148

Merged
merged 451 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
451 commits
Select commit Hold shift + click to select a range
1df7952
Adds additional files to npm ignore.
michaelgoin Jul 13, 2020
5e62c03
Merge pull request #63 from michaelgoin/update-npm-ignore
astormnewrelic Jul 14, 2020
2225ebc
Adds additional dependency language to bottom of third party notices.
michaelgoin Jul 16, 2020
80efd2f
Merge pull request #64 from michaelgoin/add-notices-language
michaelgoin Jul 16, 2020
db9624e
Updates to Readme, guidelines and templates
Jul 21, 2020
2fcce90
updated security policy link
Jul 21, 2020
d8b4098
updates to templates and readme
Jul 21, 2020
4f250e3
template updates
Jul 21, 2020
a8085e4
Contributing doc update
Jul 21, 2020
4f0b231
Update CONTRIBUTING.md
carlo-808 Jul 21, 2020
432db17
Merge pull request #65 from newrelic/carlonewrelic/guidelines_updates
michaelgoin Jul 21, 2020
6792686
Bumps node-test-utilities to ^4.0.0.
michaelgoin Jul 23, 2020
d6710b1
Merge pull request #66 from michaelgoin/bump-test-utils
michaelgoin Jul 23, 2020
22e6b71
Null check for context.matched
nikostoulas Jan 14, 2020
84c879e
Merge pull request #29 from nikostoulas/patch-1
astormnewrelic Jul 23, 2020
58e03be
ci: Add Open Source Policy Workflow
tangollama Aug 28, 2020
e97049f
Merge pull request #67 from newrelic/feature/repolinter-action
carlo-808 Sep 1, 2020
917b62e
Update readme with community-plus header
Sep 1, 2020
d03e00f
Merge pull request #69 from newrelic/carlo/readme-community-plus
michaelgoin Sep 1, 2020
bdd127d
Check if transaction is null before accessing nameState property
jgeurts Sep 26, 2020
603d9f7
Merge pull request #70 from jgeurts/issue-33
nijotz Sep 28, 2020
525a9fb
Add a test for null transaction
nijotz Sep 28, 2020
c1cc2f6
Add Node.js 14 to CI
jgeurts Sep 29, 2020
6e78a81
Merge pull request #72 from nijotz/test-for-null-tx-check
michaelgoin Sep 29, 2020
bb23933
Updated README as part of the repo consistency project
paperclypse Oct 2, 2020
34b9ffa
Merge pull request #73 from jgeurts/node-14
michaelgoin Oct 13, 2020
81ab318
Merge pull request #74 from paperclypse/main
michaelgoin Oct 13, 2020
57614fd
Updates release notes for 4.1.0 release.
michaelgoin Oct 13, 2020
41552d2
Merge pull request #76 from newrelic/v4.1.0
michaelgoin Oct 13, 2020
d1a8da3
4.1.0
michaelgoin Oct 13, 2020
1c10627
Removed Node v8.x from CI
nijotz Oct 28, 2020
90bfbcb
Removed code of conduct file (fixes #71)
nijotz Oct 28, 2020
57f1597
Merge pull request #77 from nijotz/remove-v8
nijotz Oct 28, 2020
741e2e1
Update third party notices/manifest
nijotz Nov 2, 2020
f9d75ec
Release v5.0.0
nijotz Nov 2, 2020
2d59301
Merge pull request #78 from nijotz/release/v5.0.0
nijotz Nov 2, 2020
b6f01b6
5.0.0
nijotz Nov 2, 2020
8ef1af7
initial test for node 16 compatibility
May 26, 2021
cd35078
bump newrelic/test-utilities to v5.1
May 26, 2021
bf8ff51
Merge pull request #80 from carlo-808/bump-test-utilities
michaelgoin May 27, 2021
f94694f
Explicitly list @koa/router in supported modules.
michaelgoin Jun 1, 2021
1ec2b39
Merge pull request #82 from newrelic/michaelgoin-patch-1
carlo-808 Jun 1, 2021
97354bd
upgraded to v15 of tap and committed package-lock to repo
bizob2828 Jun 4, 2021
dcb5bef
lint fix
bizob2828 Jun 4, 2021
4bbff57
Merge pull request #83 from bizob2828/tap-15
michaelgoin Jun 4, 2021
34644cd
added workflow_dispatch to allow manual triggers of ci
bizob2828 Jul 16, 2021
21aaafe
Merge pull request #79 from newrelic/carlo/node16-test
bizob2828 Jul 16, 2021
4d2fba2
updates engines to be >=12, dropping 10 in ci has already landed
bizob2828 Jul 16, 2021
eff1812
removed methods as a dep of package, removed deprecated tap methods
bizob2828 Jul 16, 2021
99cf934
updated module to use files list vs .npmignore
bizob2828 Jul 16, 2021
b35add6
lint fix
bizob2828 Jul 16, 2021
1053e9e
Merge pull request #84 from bizob2828/main
carlo-808 Jul 16, 2021
88fe8db
Merge pull request #86 from bizob2828/specify-files
carlo-808 Jul 16, 2021
0a36dd3
Merge pull request #85 from bizob2828/remove-methods-pkg
carlo-808 Jul 16, 2021
0c119a0
Release/v6.0.0
Jul 19, 2021
7f73b02
update supported version in NEWS
Jul 19, 2021
b32fa27
update supported version in NEWS (again.. sigh
Jul 19, 2021
fa47a98
Merge pull request #88 from carlo-808/Release/v6.0.0
bizob2828 Jul 20, 2021
f2412a4
6.0.0
bizob2828 Jul 20, 2021
6b7baba
update files list to include versioned tests so they can run in main …
bizob2828 Jul 20, 2021
ff26f6a
Merge pull request #89 from bizob2828/include-versioned-tests
michaelgoin Jul 20, 2021
6ab376c
release 6.0.1
bizob2828 Jul 20, 2021
50533ad
Merge pull request #90 from bizob2828/release/v6.0.1
carlo-808 Jul 20, 2021
8cb4c8b
6.0.1
bizob2828 Jul 20, 2021
139b460
6.0.1
bizob2828 Jul 20, 2021
292bcd1
Merge remote-tracking branch 'upstream/main'
bizob2828 Jul 22, 2021
734a343
upgraded setup-node to v2 and changed linting version to `lts/*`
bizob2828 Jul 22, 2021
ae4e000
Merge pull request #91 from bizob2828/update-setup-node
michaelgoin Jul 22, 2021
b7dc3c5
lint fixes after upgrading rules
bizob2828 Aug 6, 2021
04dff63
removed eslintrc files within tests
bizob2828 Aug 6, 2021
c987d69
added newrelic eslint pkg
bizob2828 Aug 16, 2021
4c348d0
Merge pull request #92 from bizob2828/shared-eslint-rules
michaelgoin Aug 18, 2021
a36d9e3
added husky + lint staged and hook to update third party manifest/not…
bizob2828 Aug 25, 2021
d432e55
Merge pull request #94 from bizob2828/third-party-notices-automation
michaelgoin Aug 25, 2021
cf89395
Modifies koa test to remove context-less async hop.
michaelgoin Oct 27, 2021
126e21f
Merge pull request #95 from michaelgoin/promise-context-test-update
garbados Dec 3, 2021
844cfbf
added job to automatically add issues/pr to Node.js Engineering board
bizob2828 Dec 20, 2021
d49fc50
Merge pull request #96 from bizob2828/add-to-board
michaelgoin Dec 21, 2021
d8cc720
added workflow to prepare release
bizob2828 Jan 5, 2022
c74bccb
Merge pull request #97 from bizob2828/prep-release
garbados Jan 6, 2022
11942b5
Setting version to v6.1.0.
bizob2828 Jan 11, 2022
7206dba
Adds auto-generated release notes.
bizob2828 Jan 11, 2022
ec91e3e
added create-release workflow
bizob2828 Jan 11, 2022
66b085b
changelog updates
bizob2828 Jan 11, 2022
b0b7230
Removes usage of tracer.
michaelgoin Nov 30, 2021
b2da788
Bumps @newrelic/test-utilities to ^6.3.0.
michaelgoin Jan 11, 2022
355c3e3
Merge pull request #99 from newrelic/release-creation
bizob2828 Jan 12, 2022
786b865
Merge pull request #98 from newrelic/release/v6.1.0
bizob2828 Jan 12, 2022
25b6bee
Merge pull request #100 from michaelgoin/remove-tracer-usage
michaelgoin Jan 12, 2022
54645c6
changed secret for gh token to use org level secret
bizob2828 Jan 13, 2022
4e9a2e5
Merge pull request #101 from bizob2828/swap-gh-token
bizob2828 Jan 14, 2022
e3dd0e5
Setting version to v6.1.1.
bizob2828 Feb 7, 2022
f3a0f66
Adds auto-generated release notes.
bizob2828 Feb 7, 2022
76e4797
Merge pull request #103 from newrelic/release/v6.1.1
bizob2828 Feb 7, 2022
a8630ca
Fixed several dev dep audit warnings.
michaelgoin Feb 11, 2022
88a8722
Merge pull request #104 from michaelgoin/audit-fix
bizob2828 Feb 15, 2022
a48c98f
fixed discuss link in README
bizob2828 Feb 17, 2022
c841cd3
Merge pull request #105 from bizob2828/fix-readme
michaelgoin Feb 17, 2022
7a4d92e
Bump urijs from 1.19.7 to 1.19.8
dependabot[bot] Feb 26, 2022
b3d4d1f
Merge pull request #107 from newrelic/dependabot/npm_and_yarn/urijs-1…
michaelgoin Feb 28, 2022
b691270
package.json: do not bundle versioned tests
Mar 1, 2022
b2cfbf9
Merge pull request #108 from jordigh/remove-versioned-tests
michaelgoin Mar 1, 2022
64ace4e
Bump urijs from 1.19.8 to 1.19.9
dependabot[bot] Mar 3, 2022
a10468e
Merge pull request #109 from newrelic/dependabot/npm_and_yarn/urijs-1…
michaelgoin Mar 4, 2022
af2de38
Setting version to v6.1.2.
Mar 7, 2022
757c536
Add release notes.
Mar 7, 2022
50a468f
Merge pull request #110 from newrelic/release/v6.1.2
Mar 7, 2022
7fe353a
Bump urijs from 1.19.9 to 1.19.10
dependabot[bot] Mar 8, 2022
db50326
Merge pull request #111 from newrelic/dependabot/npm_and_yarn/urijs-1…
michaelgoin Mar 8, 2022
6b8ae48
Bump moment from 2.29.1 to 2.29.2
dependabot[bot] Apr 9, 2022
bdd6bfd
Merge pull request #112 from newrelic/dependabot/npm_and_yarn/moment-…
michaelgoin Apr 11, 2022
f39354f
Bumps tap to ^16.0.1.
michaelgoin Apr 11, 2022
42b547c
npm audit fix.
michaelgoin Apr 11, 2022
262d6ba
Bump urijs from 1.19.10 to 1.19.11
dependabot[bot] Apr 13, 2022
ca6ed48
Merge pull request #114 from newrelic/dependabot/npm_and_yarn/urijs-1…
michaelgoin Apr 13, 2022
f5f5f02
Merge pull request #113 from michaelgoin/bump-tap
bizob2828 Apr 14, 2022
2a34480
Bump async from 2.6.3 to 2.6.4
dependabot[bot] Apr 29, 2022
f841114
Merge pull request #115 from newrelic/dependabot/npm_and_yarn/async-2…
bizob2828 May 3, 2022
89e78dd
Bump protobufjs from 6.11.2 to 6.11.3
dependabot[bot] Jun 2, 2022
2647c90
Merge pull request #116 from newrelic/dependabot/npm_and_yarn/protobu…
Jun 2, 2022
64d6e41
Updates CI to run against Node versions 14-18.
michaelgoin Jul 12, 2022
1e2cc96
Merge pull request #117 from michaelgoin/ci-node-18
bizob2828 Jul 18, 2022
ebe76f9
Bump moment from 2.29.2 to 2.29.4
dependabot[bot] Jul 18, 2022
9f931e9
Merge pull request #118 from newrelic/dependabot/npm_and_yarn/moment-…
bizob2828 Jul 18, 2022
047e2f9
Sets engines field to >= 14. Dropping support for Node 12.
michaelgoin Jul 25, 2022
6958a7b
Merge pull request #119 from michaelgoin/drop-node-12
bizob2828 Jul 25, 2022
229461f
Setting version to v7.0.0.
bizob2828 Jul 27, 2022
ae17ef6
Adds auto-generated release notes.
bizob2828 Jul 27, 2022
89a7592
updated changelog for 7.0.0 release
bizob2828 Jul 27, 2022
6330b73
Merge pull request #120 from newrelic/release/v7.0.0
bizob2828 Jul 27, 2022
431003d
update actions that are using deprecated node 12
bizob2828 Oct 25, 2022
6ccd5c8
also fixed the troubleshooting link
bizob2828 Oct 26, 2022
efe2b22
updated repolinter github/script to latest
bizob2828 Oct 26, 2022
be95223
updated reference to github sdk after bumping github-script to v6
bizob2828 Oct 26, 2022
054e741
Merge pull request #122 from bizob2828/update-deprecated-actions
bizob2828 Oct 27, 2022
866b676
NR-60782 wire up c8 and codecov for coverage collection
jmartin4563 Oct 27, 2022
eaf9863
Merge pull request #124 from jmartin4563/NR-60782-codecov
jmartin4563 Oct 27, 2022
4d32462
NEWRELIC-4422: modify tests to not check for __NR_original
Nov 3, 2022
0e0024f
NEWRELIC-4422: remove __NR prefixes in favour of symbols
Nov 3, 2022
0e2af07
fix tests to use shim.isWrapped instead
Nov 7, 2022
dcd4a3d
Merge pull request #125 from jordigh/remove-dunder
bizob2828 Nov 8, 2022
d0aeac6
Setting version to v7.1.0.
Nov 14, 2022
e135516
Adds auto-generated release notes.
Nov 14, 2022
8de2ce6
Merge pull request #127 from newrelic/release/v7.1.0
Nov 14, 2022
ad9182d
npm audit fix
jmartin4563 Dec 8, 2022
d340f17
Update the latest version of newrelic
jmartin4563 Dec 9, 2022
cbd2580
docs: update slack invite link
coreyarnold Dec 9, 2022
fb929a4
Merge pull request #129 from newrelic/coreyarnold-patch-2
jmartin4563 Dec 9, 2022
4b31387
Bump qs from 6.5.2 to 6.5.3
dependabot[bot] Dec 12, 2022
94fcd5d
Merge pull request #130 from newrelic/dependabot/npm_and_yarn/qs-6.5.3
jmartin4563 Dec 12, 2022
a195a92
NEWRELIC-5567 update to latest test utils
jmartin4563 Dec 12, 2022
0040160
NEWRELIC-5567 debugging potential koa-route issue
jmartin4563 Dec 12, 2022
535b62a
NEWRELIC-5896 Updated koa instrumentation to support ESM
jmartin4563 Dec 15, 2022
6b8e19a
Merge pull request #133 from jmartin4563/NEWRELIC-5896-koa-mjs
bizob2828 Dec 15, 2022
054a248
Setting version to v7.1.1.
jmartin4563 Dec 16, 2022
ca1c73c
Adds auto-generated release notes.
jmartin4563 Dec 16, 2022
89db190
Clean up 7.1.1 release notes
jmartin4563 Dec 16, 2022
5210a87
Merge pull request #134 from newrelic/release/v7.1.1
jmartin4563 Dec 16, 2022
4ac71bc
Merge branch 'main' into NEWRELIC-5567-koa-clm-tests
jmartin4563 Dec 19, 2022
e039f34
NEWRELIC-5567 update package-lock post conflict resolution
jmartin4563 Dec 19, 2022
3750c2e
NEWRELIC-5567 bump to latest agent version
jmartin4563 Dec 19, 2022
b32badc
NEWRELIC-5567 wire up clm tests to harness
jmartin4563 Dec 19, 2022
67b37f7
Merge pull request #128 from jmartin4563/NEWRELIC-5567-koa-clm-tests
bizob2828 Dec 20, 2022
abfc961
NEWRELIC-5683 added lockfile checks/linting to CI workflow
jmartin4563 Dec 20, 2022
963fdd3
Merge pull request #135 from jmartin4563/NEWRELIC-5683-lockfile-lint
bizob2828 Dec 21, 2022
806733a
Bump json5 from 2.2.1 to 2.2.2
dependabot[bot] Jan 8, 2023
1119d8c
Merge pull request #136 from newrelic/dependabot/npm_and_yarn/json5-2…
bizob2828 Jan 9, 2023
5ddc04e
docs: update API docs to remove docs/ path component
Jan 20, 2023
56fe393
Merge pull request #138 from jordigh/api-docs
Jan 20, 2023
8b45535
chore: update to newest community plus header
jmartin4563 Mar 13, 2023
a9dbc1b
Merge pull request #139 from jmartin4563/fix-oss-header
bizob2828 Mar 14, 2023
53bc646
added new shimName to nr-hooks to reuse shim ids
bizob2828 Mar 20, 2023
6879c33
bumped test-utils
bizob2828 Mar 23, 2023
b7c09e0
Merge pull request #141 from newrelic/shim-fixes
bizob2828 Apr 19, 2023
a863dea
updated tests to include shimName when registering instrumentation. a…
bizob2828 Apr 19, 2023
639d029
Merge pull request #144 from bizob2828/moar-shim-fixes
bizob2828 Apr 19, 2023
373ca6c
Setting version to v7.2.0.
bizob2828 Apr 19, 2023
e07c467
Adds auto-generated release notes.
bizob2828 Apr 19, 2023
1232c93
changelog edits
bizob2828 Apr 19, 2023
c15c512
Merge pull request #146 from newrelic/release/v7.2.0
bizob2828 Apr 19, 2023
56e4206
removed upper limit on router and made assertions work with all versi…
bizob2828 Apr 19, 2023
976a5db
limit samples to 5 to avoid CI from OOM on coverage
bizob2828 Apr 24, 2023
17440fb
Merge pull request #147 from bizob2828/unpin-koa-router
bizob2828 Apr 24, 2023
26f4c56
Move versioned test sampling config to package.json so agent runs als…
jmartin4563 Apr 25, 2023
ab770de
Fix usage of getShim() to return the correct shim
jmartin4563 Apr 26, 2023
401e2c1
Merge pull request #148 from jmartin4563/fix-c8-oom
bizob2828 Apr 26, 2023
060923a
updated test utils and use helper.getShim instead of local one
bizob2828 May 3, 2023
2a8f2bc
Merge pull request #149 from newrelic/update-get-shim
mrickard May 5, 2023
b53ace0
Removed index.js entry point for running standalone.
mrickard May 5, 2023
2c60757
Updated nr-hooks.tap.js to use helper.getShim
mrickard May 5, 2023
909f9a7
Refactored versioned tests to register instrumentation via hooks file
mrickard May 8, 2023
743992a
Replaced var with const or let
mrickard May 8, 2023
2d056a9
Merge pull request #150 from mrickard/NEWRELIC-4879/add-tests
bizob2828 May 8, 2023
3d87b4d
chore: update explorer hub link in readme
jmartin4563 May 31, 2023
1a8e026
Merge pull request #151 from jmartin4563/fix-readme-forum-link
jmartin4563 May 31, 2023
3c3b131
fix: package.json & package-lock.json to reduce vulnerabilities
snyk-bot Jun 27, 2023
990f484
Merge pull request #152 from newrelic/snyk-fix-5410d6cbc3d5feb5584e8f…
bizob2828 Jun 27, 2023
8a83a82
docs: updated readme to specify this no longer is a standalone package
bizob2828 Jun 28, 2023
9cbac28
Merge pull request #154 from bizob2828/update-readme
bizob2828 Jun 28, 2023
16c81cf
Bump protobufjs from 7.2.3 to 7.2.4
dependabot[bot] Jul 8, 2023
42ccac6
Merge pull request #155 from newrelic/dependabot/npm_and_yarn/protobu…
bizob2828 Jul 10, 2023
b19ea85
chore: added node 20 and drop node 14 in CI
bizob2828 Jul 10, 2023
6fc6d6a
Merge pull request #156 from bizob2828/node-20
bizob2828 Jul 18, 2023
8910d09
Bump word-wrap from 1.2.3 to 1.2.4
dependabot[bot] Jul 19, 2023
dccbc12
Merge pull request #159 from newrelic/dependabot/npm_and_yarn/word-wr…
bizob2828 Jul 19, 2023
bfe96e8
chore!: Dropped Node 14
mrickard Aug 9, 2023
b713f07
chore: Updated lockfile
mrickard Aug 9, 2023
3dc22e6
Merge pull request #160 from mrickard/NR-142039/drop-node-14
bizob2828 Aug 16, 2023
b1795c2
Setting version to v8.0.0.
mrickard Aug 17, 2023
60219cc
Adds auto-generated release notes.
mrickard Aug 17, 2023
936132c
chore: Updated News.md
mrickard Aug 17, 2023
4d15a18
chore: Updated News.md (Node 20 support)
mrickard Aug 17, 2023
bbf4058
Merge pull request #162 from newrelic/release/v8.0.0
bizob2828 Aug 18, 2023
bb5b801
chore: updated @newrelic/test-utilities and newrelic to latest
bizob2828 Aug 30, 2023
b2438a2
Merge pull request #163 from bizob2828/update-test-utils
bizob2828 Aug 30, 2023
1a73dd9
Bump @babel/traverse
dependabot[bot] Oct 17, 2023
eded44b
Merge pull request #164 from newrelic/dependabot/npm_and_yarn/babel/t…
mrickard Oct 20, 2023
5983db3
chore: removed newrelic as peer dep as standalone is no longer supported
bizob2828 Oct 24, 2023
72afad7
Merge pull request #165 from bizob2828/remove-peer-dep
mrickard Oct 25, 2023
4e11d65
Setting version to v8.0.1.
mrickard Oct 25, 2023
b857bc0
Adds auto-generated release notes.
mrickard Oct 25, 2023
26d7320
chore: Edited News.md
mrickard Oct 25, 2023
34033a7
Merge pull request #166 from newrelic/release/v8.0.1
bizob2828 Oct 25, 2023
3f3ad8d
Bump axios and newrelic
dependabot[bot] Nov 10, 2023
29f605f
Patched Babel vulnerable to arbitrary code execution when compiling s…
imhunterand Nov 12, 2023
676117c
Merge pull request #167 from newrelic/dependabot/npm_and_yarn/axios-a…
bizob2828 Nov 13, 2023
df88119
Merge pull request #168 from imhunterand/patch-1
bizob2828 Nov 13, 2023
fc46530
Bump follow-redirects from 1.15.3 to 1.15.4
dependabot[bot] Jan 11, 2024
51b9a4a
Merge pull request #169 from newrelic/dependabot/npm_and_yarn/follow-…
mrickard Jan 11, 2024
9f1eff7
refactor: Updated koa instrumentation to construct specs at instrumen…
bizob2828 Feb 22, 2024
9ce50cf
chore: updated newrelic to get specs on shim instance
bizob2828 Feb 27, 2024
b981669
Merge pull request #171 from newrelic/update-to-specs
bizob2828 Feb 28, 2024
134a21e
Setting version to v9.0.0.
Mar 12, 2024
463aafc
Adds auto-generated release notes.
Mar 12, 2024
b5154b3
chore: changelog edits
bizob2828 Mar 12, 2024
a84e5da
Merge pull request #172 from newrelic/release/v9.0.0
svetlanabrennan Mar 12, 2024
29cfb2e
build(deps-dev): bump follow-redirects from 1.15.5 to 1.15.6
dependabot[bot] Mar 17, 2024
60d5f1a
Merge pull request #173 from newrelic/dependabot/npm_and_yarn/follow-…
svetlanabrennan Mar 18, 2024
168fdf5
chore: updated recordParamware to construct spec
bizob2828 Mar 20, 2024
b2068d2
Merge pull request #175 from newrelic/fix-paramware
bizob2828 Mar 22, 2024
cbf31f2
chore: Updated CI process for releases (#176)
svetlanabrennan Mar 29, 2024
7da8ac6
test: Removed v1 versioned tests (#177)
svetlanabrennan Apr 1, 2024
8ab4637
ci: Fixed spelling of `use_new_release` in prepare-release.yml (#178)
bizob2828 Apr 1, 2024
e8fe445
ci: Fixed `changelog_file` to be `NEWS.md` (#179)
bizob2828 Apr 1, 2024
e9974b6
chore: release v9.1.0 (#180)
github-actions[bot] Apr 1, 2024
aedc482
ci: removed changelog.json file (#181)
svetlanabrennan Apr 2, 2024
54db8c4
ci: Removed `use_new_release` input from prepare release workflow (#182)
svetlanabrennan Apr 4, 2024
dc7acd0
chore: Merged koa external repo into newrelic repo
jsumners-nr Apr 16, 2024
a338a21
refactor koa into newrelic repo structure
jsumners-nr Apr 16, 2024
28d478b
chore: migrated koa versioned tests to use agent_helper, moved symbol…
bizob2828 Apr 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
349 changes: 139 additions & 210 deletions THIRD_PARTY_NOTICES.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/instrumentation/grpc-js/grpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const recordExternal = require('../../metrics/recorders/http_external')
const recordHttp = require('../../metrics/recorders/http')
const specs = require('../../shim/specs')
const { TransactionSpec } = require('../../shim/specs')
const { DESTINATIONS } = require('../../config/attribute-filter')
const DESTINATION = DESTINATIONS.TRANS_EVENT | DESTINATIONS.ERROR_EVENT
const semver = require('semver')
Expand Down Expand Up @@ -149,7 +149,7 @@ function wrapRegister(shim, original) {

args[1] = shim.bindCreateTransaction(
instrumentedHandler,
new specs.TransactionSpec({ type: shim.WEB })
new TransactionSpec({ type: shim.WEB })
)

return original.apply(this, args)
Expand Down
9 changes: 9 additions & 0 deletions lib/instrumentation/http-methods.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2021 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

'use strict'
const http = require('http')
const methodsLower = http.METHODS.map((method) => method.toLowerCase())
module.exports.METHODS = methodsLower
197 changes: 197 additions & 0 deletions lib/instrumentation/koa/instrumentation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
/*
* Copyright 2020 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

'use strict'
const symbols = require('../../symbols')
const { MiddlewareSpec, MiddlewareMounterSpec } = require('../../shim/specs')

module.exports = function initialize(shim, Koa) {
// Koa's exports are different depending on using CJS or MJS - https://github.com/koajs/koa/issues/1513
const proto = Koa.prototype || Koa.default?.prototype

if (!shim || !Koa || !proto || Object.keys(proto).length > 1) {
shim.logger.debug(
'Koa instrumentation function called with incorrect arguments, not instrumenting.'
)
return
}

shim.setFramework(shim.KOA)

shim.wrapMiddlewareMounter(
proto,
'use',
new MiddlewareMounterSpec({
wrapper: wrapMiddleware
})
)
shim.wrapReturn(proto, 'createContext', wrapCreateContext)

// The application is used to handle unhandled errors in the application. We
// want to notice those.
shim.wrap(proto, 'emit', function wrapper(shim, original) {
return function wrappedEmit(evt, err, ctx) {
if (evt === 'error' && ctx) {
shim.noticeError(ctx.req, err)
}
return original.apply(this, arguments)
}
})
}

function wrapMiddleware(shim, middleware) {
// Skip middleware that are already wrapped.
if (shim.isWrapped(middleware)) {
return middleware
}

if (middleware.router) {
shim.logger.info(
[
'Found uninstrumented router property on Koa middleware.',
'This may indicate either an unsupported routing library is being used,',
'or a particular version of a supported library is not fully instrumented.'
].join(' ')
)
}

return shim.recordMiddleware(
middleware,
new MiddlewareSpec({
type: shim.MIDDLEWARE,
promise: true,
appendPath: true,
next: shim.LAST,
req: function getReq(shim, fn, fnName, args) {
return args[0] && args[0].req
}
})
)
}

/**
* Many of the properties on the `context` object are just aliases for the same
* property on the `request` or `response` objects. We take advantage of this
* by just intercepting the `request` or `response` property and don't touch
* the `context` property.
* See: https://github.com/koajs/koa/blob/master/lib/context.js#L186-L241
*
* @param {Shim} shim instance of shim
* @param {function} _fn createContext function
* @param {string} _fnName name of function
* @param {object} context koa ctx object
*/
function wrapCreateContext(shim, _fn, _fnName, context) {
wrapResponseBody(shim, context)
wrapMatchedRoute(shim, context)
wrapResponseStatus(shim, context)
}

function wrapResponseBody(shim, context) {
// The `context.body` and `context.response.body` properties are how users set
// the response contents. It is roughly equivalent to `res.send()` in Express.
// Under the hood, these set the `_body` property on the `context.response`.
context[symbols.koaBody] = context.response.body
context[symbols.koaBodySet] = false

Object.defineProperty(context.response, '_body', {
get: () => context[symbols.koaBody],
set: function setBody(val) {
if (!context[symbols.koaRouter]) {
shim.savePossibleTransactionName(context.req)
}
context[symbols.koaBody] = val
context[symbols.koaBodySet] = true
}
})
}

function wrapMatchedRoute(shim, context) {
context[symbols.koaMatchedRoute] = null
context[symbols.koaRouter] = false

Object.defineProperty(context, '_matchedRoute', {
get: () => context[symbols.koaMatchedRoute],
set: (val) => {
const match = getLayerForTransactionName(context)

// match should never be undefined given _matchedRoute was set
if (match) {
const currentSegment = shim.getActiveSegment()

// Segment/Transaction may be null, see:
// - https://github.com/newrelic/node-newrelic-koa/issues/32
// - https://github.com/newrelic/node-newrelic-koa/issues/33
if (currentSegment) {
const transaction = currentSegment.transaction

if (context[symbols.koaMatchedRoute]) {
transaction.nameState.popPath()
}

transaction.nameState.appendPath(match.path)
transaction.nameState.markPath()
}
}

context[symbols.koaMatchedRoute] = val
// still true if somehow match is undefined because we are
// using koa-router naming and don't want to allow default naming
context[symbols.koaRouter] = true
}
})
}

function wrapResponseStatus(shim, context) {
// Sometimes people just set `context.status` or `context.response.status`
// without setting a body. When this happens we'll want to use that as the
// response point to name the transaction. `context.status` is just an alias
// for `context.response.status` so we only wrap the latter.
const statusDescriptor = getInheritedPropertyDescriptor(context.response, 'status')
if (!statusDescriptor) {
shim.logger.debug('Failed to find status descriptor on context.response')
return
} else if (!statusDescriptor.get || !statusDescriptor.set) {
shim.logger.debug(statusDescriptor, 'Status descriptor missing getter/setter pair')
return
}

Object.defineProperty(context.response, 'status', {
get: () => statusDescriptor.get.call(context.response),
set: function setStatus(val) {
if (!context[symbols.koaBodySet] && !context[symbols.koaRouter]) {
shim.savePossibleTransactionName(context.req)
}
return statusDescriptor.set.call(this, val)
}
})
}

function getLayerForTransactionName(context) {
// Context.matched might be null
// See https://github.com/newrelic/node-newrelic-koa/pull/29
if (!context.matched) {
return null
}
for (let i = context.matched.length - 1; i >= 0; i--) {
const layer = context.matched[i]
if (layer.opts.end) {
return layer
}
}

return null
}

function getInheritedPropertyDescriptor(obj, property) {
let proto = obj
let descriptor = null
do {
descriptor = Object.getOwnPropertyDescriptor(proto, property)
proto = Object.getPrototypeOf(proto)
} while (!descriptor && proto)

return descriptor
}
35 changes: 35 additions & 0 deletions lib/instrumentation/koa/nr-hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2020 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

'use strict'

const InstrumentationDescriptor = require('../../instrumentation-descriptor')

module.exports = [
{
type: InstrumentationDescriptor.TYPE_WEB_FRAMEWORK,
moduleName: 'koa',
shimName: 'koa',
onRequire: require('./instrumentation')
},
{
type: InstrumentationDescriptor.TYPE_WEB_FRAMEWORK,
moduleName: 'koa-router',
shimName: 'koa',
onRequire: require('./router-instrumentation')
},
{
type: InstrumentationDescriptor.TYPE_WEB_FRAMEWORK,
moduleName: '@koa/router',
shimName: 'koa',
onRequire: require('./router-instrumentation')
},
{
type: InstrumentationDescriptor.TYPE_WEB_FRAMEWORK,
moduleName: 'koa-route',
shimName: 'koa',
onRequire: require('./route-instrumentation')
}
]
33 changes: 33 additions & 0 deletions lib/instrumentation/koa/route-instrumentation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2020 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

'use strict'

const { METHODS } = require('../http-methods')
const { MiddlewareSpec } = require('../../shim/specs')

module.exports = function instrumentRoute(shim, route) {
shim.setFramework(shim.KOA)

METHODS.forEach(function wrap(method) {
shim.wrap(route, method, function wrapMethod(shim, methodFn) {
return function wrappedMethod() {
const middleware = methodFn.apply(route, arguments)
return shim.recordMiddleware(
middleware,
new MiddlewareSpec({
route: arguments[0],
next: shim.LAST,
name: shim.getName(arguments[1]),
promise: true,
req: function getReq(shim, fn, fnName, args) {
return args[0] && args[0].req
}
})
)
}
})
})
}
Loading
Loading