newrelic 7.1.3 → 7.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/NEWS.md +72 -0
  2. package/THIRD_PARTY_NOTICES.md +33 -2
  3. package/bin/test-naming-rules.js +4 -4
  4. package/lib/collector/facts.js +22 -8
  5. package/lib/collector/http-agents.js +20 -7
  6. package/lib/collector/remote-method.js +18 -4
  7. package/lib/config/index.js +34 -42
  8. package/lib/feature_flags.js +6 -2
  9. package/lib/grpc/connection.js +39 -15
  10. package/lib/instrumentation/core/async_hooks.js +106 -14
  11. package/lib/instrumentation/core/http.js +5 -0
  12. package/lib/shim/shim.js +6 -1
  13. package/lib/spans/create-span-event-aggregator.js +1 -0
  14. package/lib/spans/span-event.js +6 -3
  15. package/lib/spans/streaming-span-event.js +6 -3
  16. package/lib/transaction/index.js +29 -0
  17. package/newrelic.js +1 -1
  18. package/package.json +19 -6
  19. package/CONTRIBUTING.md +0 -135
  20. package/Migration Guide.md +0 -271
  21. package/ROADMAP_Node.md +0 -24
  22. package/SECURITY.md +0 -5
  23. package/THIRD_PARTY_NOTICES_ADDENDUM.md +0 -213
  24. package/bin/ca-gen.js +0 -91
  25. package/bin/cassandra-setup.sh +0 -11
  26. package/bin/check-workflow-run.js +0 -74
  27. package/bin/clean.sh +0 -18
  28. package/bin/compare-bench-results.js +0 -172
  29. package/bin/create-github-release.js +0 -109
  30. package/bin/create-release-tag.js +0 -95
  31. package/bin/docker-env-vars.sh +0 -15
  32. package/bin/docker-services.sh +0 -49
  33. package/bin/git-commands.js +0 -110
  34. package/bin/github.js +0 -144
  35. package/bin/npm-commands.js +0 -31
  36. package/bin/prepare-release.js +0 -359
  37. package/bin/publish-docs.sh +0 -16
  38. package/bin/run-bench.js +0 -137
  39. package/bin/run-versioned-tests.sh +0 -24
  40. package/bin/smoke.sh +0 -8
  41. package/bin/ssl.sh +0 -87
  42. package/bin/update-ca-bundle.sh +0 -20
  43. package/bin/update-cats.sh +0 -8
  44. package/jsdoc-conf.json +0 -18
  45. package/third_party_manifest.json +0 -619
@@ -1,213 +0,0 @@
1
- # Third Party License Addendum
2
-
3
- Developers Note: The following license could not be autogenerated by the New Relic OSS cli tool and needs to be manually copied to the `THIRD_PARTY_LICENSE.md` after running the tool.
4
-
5
- ## Footer
6
-
7
- Portions copyright Node.js contributors. Depending on your existing libraries and package management settings,
8
- your systems may call externally maintained libraries in addition to those listed above.
9
- See [here](https://nodejs.org/en/docs/meta/topics/dependencies/) and [here](https://github.com/nodejs/node/blob/v4.3.1/LICENSE)
10
- for additional details regarding externally maintained libraries and certain related licenses and notices.”
11
-
12
- ## ADDITIONAL LICENSE(S)
13
-
14
- ---
15
-
16
- <!-- licence -->
17
- ### Symantec
18
-
19
- This product includes certificates from Symantec which are used under the
20
- following license (https://docs.broadcom.com/doc/root-certificate-license-agreement-en):
21
-
22
- ```
23
- ROOT CERTIFICATE LICENSE AGREEMENT
24
- SYMANTEC CORPORATION AND/OR ITS AFFILIATES (“SYMANTEC”) IS WILLING TO PROVIDE THE
25
- ROOT CERTIFICATES TO YOU AS THE INDIVIDUAL, THE COMPANY, OR THE LEGAL ENTITY THAT
26
- WILL BE UTILIZING THE ROOT CERTIFICATES (REFERENCED BELOW AS “YOU” OR “YOUR”)
27
- ONLY ON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS OF THIS AGREEMENT
28
- (“AGREEMENT”). READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY
29
- BEFORE USING THE ROOT CERTIFICATES. THIS IS A LEGAL AND ENFORCEABLE CONTRACT
30
- BETWEEN YOU AND SYMANTEC. BY USING THE ROOT CERTIFICATES, YOU AGREE TO THE
31
- TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THESE TERMS AND
32
- CONDITIONS, MAKE NO FURTHER USE OF THE ROOT CERTIFICATES. UNLESS OTHERWISE
33
- DEFINED HEREIN, CAPITALIZED TERMS WILL HAVE THE MEANING GIVEN IN THE “DEFINITIONS”
34
- SECTION OF THIS AGREEMENT AND SUCH CAPITALIZED TERMS MAY BE USED IN THE
35
- SINGULAR OR IN THE PLURAL, AS THE CONTEXT REQUIRES.
36
-
37
- ROOT CERTIFICATE TERMS AND CONDITIONS
38
- 1. DEFINITIONS.
39
- "Certificate" means an electronic file that, at least, states a name or identifies the issuing Certificate
40
- Authority, identifies the subscriber, contains the subscriber's public key, identifies the Certificate's
41
- operational period, contains a Certificate serial number, and contains a digital signature of the issuing
42
- Certificate Authority.
43
- “Certificate Authority” or “CA” means a person or entity authorized to issue, suspend, or revoke
44
- Certificates.
45
- “Intermediate CA” means a CA Certificate signed by a Root Certificate Intermediate that issues
46
- Certificates either to end-entities or other Certificate Authorities, but not to both.
47
- "Products" means all versions of Your product or service with which the Root Certificates are incorporated
48
- (including successor products and services or any major or minor upgrades thereto).
49
- "Root Certificate" means a self-signed Certificate issued by a top-level Certificate Authority to itself, which
50
- includes such Certificate Authority's public key. The Root Certificates and Root Certificate files to be
51
- provided by Company to Customer pursuant to this Agreement are available for download at
52
- https://www.verisign.com/support/roots.html, https://www.thawte.com/roots/index.html or
53
- https://www.geotrust.com/resources/rootcertificates/index.html.
54
- 2. LICENSE. During the term of this Agreement, Symantec grants You a royalty-free, non-exclusive, nontransferable license to (a) use the Root Certificate for the purposes of testing (without the right to modify);
55
- (b) make copies of Root Certificates only in order to embed and incorporate them, unmodified and in full,
56
- as roots in Your Products; (c) distribute the Root Certificates as embedded and incorporated in such
57
- Products; and (d) use the relevant logos and trademarks of Symantec in Your marketing materials,
58
- advertisements, product data sheets, product packaging and websites solely conjunction with the
59
- distribution of the Root Certificates in accordance with Symantec’s published guidelines for such usage.
60
- You shall not have the right to further distribute the Root Certificates other than as described herein
61
- without an additional license grant, in a separate writing, from Symantec.
62
- 3. RESTRICTIONS. You may not: (a) modify or create any derivative works of Root Certificates; (b)
63
- assign, sublicense, sell, rent, or lease Symantec's root keys or Root Certificates; (c) use such Root
64
- Certificates except as expressly permitted under this Agreement; (d) remove or alter any trademark, logo,
65
- copyright, or other proprietary notices, legends, symbols, or labels provided in the Root Certificates; or (e)
66
- certify, or cause a third party to certify, the public key contained in the Root Certificates by issuing or
67
- creating a Certificate containing such public key.
68
- 4. CUSTOMER’S OBLIGATIONS.
69
- 4.1. During the term of this Agreement, You shall use commercially reasonable efforts regularly check the
70
- applicable Symantec URL for updates to the Root Certificates and update Root Certificates embedded
71
- into Your Products with the most currently available Root Certificates, unmodified and in full, or as a patch
72
- or update. If Symantec updates its Root Certificates,, You shall use commercially reasonable efforts to (i)
73
- discontinue all copying and use of the Root Certificates which have been replaced, and (ii) to use
74
- Symantec’s then-current Root Certificates. Any updates to the Root Certificates are incorporated into and
75
- subject to the terms of this Agreement.
76
- 4.2. You shall appoint at least one (1) individual as the administrative contact designated to address any
77
- Root Certificate issues and shall provide the contact information for such individual to dl-tssroot@symantec.com.
78
- 4.3 In the event You become aware of or suspect any event that diminishes the integrity of Symantec's
79
- data or public key system ("Compromise"), You shall immediately notify Symantec at dl-tss-
80
- root@symantec.com of such Compromise, and take reasonable steps to assist and cooperate with
81
- Symantec to remedy the Compromise.
82
- 4.4 In the event that Symantec modifies these terms of use for the Root certificates for all end users,
83
- Symantec shall post the modified terms for the Agreement on the applicable URL and may post the
84
- modified terms on the Symantec corporate website. You shall be responsible for regularly checking the
85
- applicable URL for modifications to this Agreement. Such modifications shall be effective and binding on
86
- Customer within thirty (30) days of Symantec’s posting such modifications to its website. If you do not
87
- accept the modified Agreement, discontinue use of the Root Certificates and this Agreement will be
88
- deemed as terminated.
89
- 5. CONFIDENTIALITY.
90
- 5.1. Confidential Information. "Confidential Information" means the root private keys corresponding to the
91
- public key in a Root Certificate, and any confidential, trade secret, or other proprietary information
92
- disclosed by a party to the other party under this Agreement, except for Information that: (i) is public
93
- knowledge at the time of disclosure, (ii) was known by the receiving party before disclosure by the
94
- disclosing party, or becomes public knowledge or otherwise known to the receiving party after such
95
- disclosure, other than by breach of a confidentiality obligation, or (iii) is independently developed by the
96
- receiving party by persons without access to Confidential Information of the disclosing party.
97
- 5.2. Protection of Confidential Information. The receiving party shall: (i) not disclose the Confidential
98
- information to any third party, (ii) not use the Confidential Information except for purposes of performing
99
- this Agreement, and (iii) take steps consistent with its protection of its own confidential and proprietary
100
- information (but in no event exercise less than reasonable care) to prevent unauthorized disclosure of the
101
- Confidential Information. Each party acknowledges that breach of this Section 5 may cause irreparable
102
- harm to the disclosing party entitling the disclosing party to injunctive relief, among other remedies.
103
- 5.3. Mutual Cooperation. Each party will notify and cooperate with the other party in enforcing the
104
- disclosing party's rights if such party becomes aware of a threatened or actual violation of the
105
- confidentiality requirements of this Section 5. Each party shall have confidentiality agreements with its
106
- employees, agents or independent contractors sufficient in scope to fulfill its confidentiality obligations
107
- under this Agreement.
108
- 6. INTELLECTUAL PROPERTY. You acknowledge that Symantec, including its wholly owned
109
- subsidiaries, retains all intellectual property rights and title (including any patent, copyright, trademark,
110
- trade secret, and other rights) in and to the Root Certificates, the public and private keys corresponding to
111
- such Root Certificates ("Symantec Intellectual Property"). This Agreement does not give You any
112
- intellectual property rights in the Symantec intellectual property except for the license granted in Section
113
- 2. To the extent You use Symantec's trademarks or logos as permitted herein, You agree to comply with
114
- all usage requirements set forth in the then current version of Symantec's Logo and Trademark Usage
115
- Guide (http://www.symantec.com/about/profile/policies/trademarks.jsp) and any other guides and
116
- procedures of Symantec.
117
- 7. NO WARRANTIES. THE ROOT CERTIFICATES, INCLUDING UPDATES, ARE PROVIDED "AS IS"
118
- WITHOUT ANY WARRANTY WHATSOEVER. SYMANTEC HEREBY DISCLAIMS ALL WARRANTIES,
119
- WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING WITHOUT LIMITATION, ANY
120
- IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
121
- NONINFRINGEMENT OF THIRD PARTY RIGHTS.
122
- 8. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY WILL
123
- SYMANTEC OR ITS LICENSORS BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY
124
- CONSEQUENTIAL, INDIRECT, SPECIAL, INCIDENTAL, OR EXEMPLARY DAMAGES, WHETHER
125
- FORESEEABLE OR UNFORESEEABLE, EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE
126
- POSSIBILITY OF SUCH DAMAGES. YOU WILL TAKE REASONABLE MEASURES TO INSURE THAT
127
- THE TERMS AND CONDITIONS SET FORTH IN THE PRECEDING SENTENCE OF THIS SECTION 8
128
- ARE INCORPORATED INTO ANY AGREEMENT BETWEEN YOU AND YOUR CUSTOMERS OR
129
- LICENSEES. SYMANTEC SHALL NOT BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY
130
- DAMAGES CAUSED BY YOUR OR A THIRD PARTY’S CONTINUED USE OF ANY OUTDATED
131
- ROOTS FOR WHICH AN UPDATED VERSION IS MADE AVAILABLE BY SYMANTEC. FURTHER,
132
- UNDER NO CIRCUMSTANCES WILL SYMANTEC'S LIABILITY FOR ANY ACTION OR CLAIM EXCEED
133
- USD$1,000, REGARDLESS OF WHETHER SUCH ACTION OR CLAIM IS BASED IN CONTRACT,
134
- TORT, STRICT LIABILITY, OR OTHERWISE.
135
- 9. TERM AND TERMINATION.
136
- 9.1. Term. This Agreement shall become effective as of the earlier of, Your first use of the Root
137
- Certificates, and shall remain in effect until the earlier of (i) Your discontinued use of the Root Certificates;
138
- (ii) termination by either party under the terms of Section 9.2, below; or (iii) Symantec’s notice to You that
139
- Symantec is no longer providing Root Certificates for use.
140
- 9.2. Termination for Default/Insolvency. Either party shall be entitled to terminate this Agreement in the
141
- event of a failure by the other party to perform any of its material obligations under this Agreement if such
142
- breach is not cured within thirty (30) days after receipt of written notice thereof from the non-defaulting
143
- party or within forty-eight (48) hours after receipt of such written notice if a breach by You may
144
- compromise the security of the Symantec Trust Network or other system. This Agreement shall terminate
145
- upon the election of and notice from a party to the other if the other party is adjudged insolvent or
146
- bankrupt, or the institution of any proceedings by or against the other party seeking relief, reorganization,
147
- or arrangement under any laws relating to insolvency, or any assignment for the benefit of creditors, or
148
- the appointment of a receiver, liquidator, or trustee of any of the other party's property or assets, or the
149
- liquidation, dissolution, or winding up of the other party's business.
150
- 9.3. Effect of Expiration or Termination. Upon expiration or termination of this Agreement, except for a
151
- breach by You, You may continue to distribute the current version of Your Products which incorporate the
152
- Root Certificates. Any updates or upgrades thereto may not include the Root Certificates and You shall
153
- stop making copies of Root Certificates, shall stop including Root Certificates in Your Products, and shall
154
- stop using Symantec’s logos and trademarks. The provisions of Sections 3, 4.3, 5, 6, 7, 8, 9.3, and 10
155
- shall survive termination of this Agreement.
156
- 10. GENERAL.
157
- 10.1. Governing Laws. This Agreement and any disputes relating to the services provided hereunder shall
158
- be governed and interpreted according to each of the following laws, respectively, without regard to its
159
- conflicts of law provisions: (a) the laws of the State of California, if You are located in North America or
160
- Latin America; or (b) the law of England, if You are located in Europe, Middle East or Africa; or (c) the
161
- laws of Singapore, if You are located in Asia Pacific including Japan. The United Nations Convention on
162
- Contracts for the International Sale of Goods shall not apply to this Agreement.
163
- 10.2. Binding Upon Successors; Assignment. This Agreement shall be binding upon, and inure to the
164
- benefit of, the successors, executors, heirs, representatives, administrators, and assigns of the parties
165
- hereto. Notwithstanding the foregoing, You may not assign Your rights or obligations under this
166
- Agreement without the prior written consent of Symantec. Any such purported assignment of this
167
- Agreement without obtaining written consent shall be void and of no effect.
168
- 10.3. Severability; Enforcement; No Waiver. The unenforceability of any provision or provisions of this
169
- Agreement shall not impair the enforceability of any other part of this Agreement. If any provision of this
170
- Agreement shall be deemed invalid or unenforceable, in whole or in part, this Agreement shall be deemed
171
- amended to delete or modify, as necessary, the invalid or unenforceable provision to render it valid,
172
- enforceable, and, insofar as possible, consistent with the original intent of the parties. The failure of a
173
- party, at any time or from time to time, to require performance of any obligations of the other party
174
- hereunder shall not be deemed a waiver and shall not affect its right to enforce any provision of this
175
- Agreement at a subsequent time.
176
- 10.4. Entire Agreement; Amendments; Waivers. This Agreement constitutes the entire understanding and
177
- agreement of the parties, whether written or oral, with respect to the subject matter hereof and supersede
178
- all prior and contemporaneous agreements or understandings between the parties. Any term or provision
179
- of this Agreement may be amended, and the observance of any term of this Agreement may be waived,
180
- only by writing signed by the parties to be bound thereby.
181
- 10.5. Compliance with Law, Export Requirements and Foreign Reshipment Liability. Each party shall
182
- comply with all applicable federal, state and local laws and regulations in connection with its performance
183
- under this Agreement. Services, including documentation, may include controlled technology or technical
184
- data (collectively “Controlled Technology”) that is subject to the U.S. Export Administration Regulations
185
- (EAR), and diversion contrary to U.S. law is prohibited. You agree to comply with all relevant laws
186
- including the U.S. EAR and the laws of any country from which Controlled Technology is exported. All
187
- Controlled Technology is prohibited for export or re-export to Cuba, North Korea, Iran, Sudan and Syria
188
- and to any country or its nationals subject to relevant embargo or sanction or to any entity or person for
189
- which an export license is required per any relevant restricted party list, without first obtaining a license.
190
- Furthermore, You hereby agree that You will not use or allow use of Controlled Technology in connection
191
- with chemical, biological, or nuclear weapons, or missiles, drones or space launch vehicles capable of
192
- delivering such weapons. Symantec shall have the right to suspend performance of any of its obligations
193
- under this Agreement, without any prior notice being required and without any liability to Customer, if You
194
- fail to comply with this provision.
195
- 10.6. Notices. You will make all notices, demands or requests to Symantec with respect to this Agreement
196
- in writing to the "Contact" address listed on the website from where you downloaded the Root Certificates,
197
- with a copy to: General Counsel – Legal Department, Symantec Corporation, 350 Ellis Street, Mountain
198
- View, California 94043, USA. Notices shall be effective on the date received (unless the notice specifies a
199
- later date) only if it is sent by a courier service that confirms delivery in writing or if sent by certified or
200
- registered mail, postage prepaid, return receipt requested. Symantec may post notices and updates
201
- regarding the Agreement or the Root Certificates at the URL provided to You for the Root Certificates.
202
- You shall be responsible for regularly checking the applicable URL for notices from Symantec regarding
203
- the Agreement or the Root Certificates. No notices, demands, or requests to Symantec with respect to
204
- this Agreement may be delivered by electronic mail. You shall immediately notify Symantec of any legal
205
- notices served on You that might affect Symantec, and shall promptly forward the original or a copy of
206
- such notice to Symantec.
207
- 10.7. Independent Parties. The relationship between You and Symantec is that of independent
208
- contractors. Neither party nor its employees, consultants, contractors, or agents are agents, employees,
209
- or joint venturers of the other party, nor do they have any authority to bind the other party by contract or
210
- otherwise to any obligation.
211
- Root Certificate License Agreement v3.0 (January 2014)
212
- ```
213
- <!-- licencestop -->
package/bin/ca-gen.js DELETED
@@ -1,91 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /*
4
- * Copyright 2020 New Relic Corporation. All rights reserved.
5
- * SPDX-License-Identifier: Apache-2.0
6
- */
7
-
8
- 'use strict'
9
- /* eslint-disable no-console */
10
-
11
- const fs = require('fs')
12
- const path = require('path')
13
- const glob = require('glob')
14
-
15
- const CERT_PATH = path.join(__dirname, '..', '..', 'SSL_CA_cert_bundle', '*.pem')
16
-
17
- const OUTFILE =
18
- path.join(__dirname, '..', 'lib', 'collector', 'ssl', 'certificates')
19
-
20
- const HEADER =
21
- `/**\n
22
- * certificates.js - CA bundle for SSL communication with RPM.\n
23
- *\n
24
- * This file contains the X509 certificates used to communicate with New Relic\n
25
- * over SSL.\n
26
- */\n\n`
27
-
28
- class Certificate {
29
- constructor(name, body) {
30
- this.name = name
31
- this.body = body
32
- }
33
-
34
- toEntry() {
35
- let output = ` // ${this.name}\n`
36
- const rawPEM = this.body.split('\n')
37
-
38
- for (let i = 0; i < rawPEM.length; i++) {
39
- const line = rawPEM[i]
40
- // some Thawte certificates have Windows line endings
41
- line = line.replace('\r', '')
42
- if (line.match(/END CERTIFICATE/)) {
43
- output += ` "${line}\\n"`
44
- break
45
- }
46
- output += ` "${line}\\n" +\n`
47
- }
48
-
49
- return output
50
- }
51
- }
52
-
53
- function loadCerts(root, callback) {
54
- glob(root, (error, files) => {
55
- if (error) {
56
- return callback(error, null)
57
- }
58
-
59
- const certificates = []
60
- console.log(`Loading ${files.length} certficates.`)
61
-
62
- for (let i = 0; i < files.length; i++) {
63
- const file = files[i]
64
- const certificate = new Certificate(
65
- path.basename(file, '.pem'),
66
- fs.readFileSync(file, 'ascii')
67
- )
68
-
69
- certificates.push(certificate)
70
- }
71
-
72
- callback(null, certificates)
73
- })
74
- }
75
-
76
- function dumpCerts(error, certs) {
77
- if (error) {
78
- console.log(`got ${error.message} reading certs--bailing out`)
79
- process.exit(1)
80
- }
81
-
82
- fs.writeFileSync(
83
- OUTFILE,
84
- HEADER +
85
- 'module.exports = [\n' +
86
- certs.map((cert) => cert.toEntry()).join(',\n\n') +
87
- '\n]\n'
88
- )
89
- }
90
-
91
- loadCerts(CERT_PATH, dumpCerts)
@@ -1,11 +0,0 @@
1
- #! /bin/bash
2
-
3
- # Copyright 2020 New Relic Corporation. All rights reserved.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- sudo apt-get install python openjdk-8-jre -y
7
- echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
8
- curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
9
- sudo apt-get update
10
- sudo apt-get install cassandra
11
- sudo service cassandra start
@@ -1,74 +0,0 @@
1
- 'use strict'
2
-
3
- const Github = require('./github')
4
-
5
- const SUCCESS_MSG = '*** [OK] ***'
6
-
7
- const formatRun = (run) => {
8
- return {
9
- name: run.name,
10
- repository: run.repository.name,
11
- repoOwner: run.repository.owner.login,
12
- branch: run.head_branch,
13
- status: run.status,
14
- url: run.url,
15
- workflow_id: run.workflow_id,
16
- event: run.event
17
- }
18
- }
19
-
20
- async function checkWorkflowRun(repoOwner, branch) {
21
- const github = new Github(repoOwner)
22
-
23
- try {
24
- const results = {
25
- ci: false,
26
- smokeTest: false
27
- }
28
-
29
- const latestRun = await github.getLatestWorkflowRun('ci-workflow.yml', branch)
30
-
31
- if (latestRun === undefined) {
32
- console.log('No ci workflow run found.')
33
- } else {
34
- console.log('CI workflow run details: ', JSON.stringify(formatRun(latestRun)))
35
- if (latestRun.status === 'completed' && latestRun.conclusion === 'success') {
36
- results.ci = true
37
- }
38
- }
39
-
40
- const latestSmokeTestRun = await github.getLatestWorkflowRun('smoke-test-workflow.yml', branch)
41
-
42
- if (latestSmokeTestRun === undefined) {
43
- console.log('No smoke test workflow run found.')
44
- } else {
45
- console.log('Smoke-test workflow run details: ', JSON.stringify(formatRun(latestSmokeTestRun)))
46
-
47
- if (latestSmokeTestRun.status === 'completed' && latestSmokeTestRun.conclusion === 'success') {
48
- results.smokeTest = true
49
- }
50
- }
51
-
52
- if (results.ci && results.smokeTest) {
53
- console.log(SUCCESS_MSG)
54
- console.log('Latest ci and smoke-test runs were successful!')
55
- return true
56
- }
57
-
58
- if (!results.ci) {
59
- console.log('Latest ci workflow run result was not \'completed\' and \'success\'.')
60
- }
61
-
62
- if (!results.smokeTest) {
63
- console.log('Latest smoke-test workflow run result was not \'completed\' and \'success\'.')
64
- }
65
-
66
- return false
67
- } catch (err) {
68
- console.error(err)
69
-
70
- return false
71
- }
72
- }
73
-
74
- module.exports = checkWorkflowRun
package/bin/clean.sh DELETED
@@ -1,18 +0,0 @@
1
- #! /bin/sh
2
-
3
- # Copyright 2020 New Relic Corporation. All rights reserved.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- SSLKEY="test/lib/test-key.key"
7
- CACERT="test/lib/ca-certificate.crt"
8
- CAINDEX="test/lib/ca-index"
9
- CASERIAL="test/lib/ca-serial"
10
- CERTIFICATE="test/lib/self-signed-test-certificate.crt"
11
-
12
- find . -depth -type d -name node_modules -print0 | xargs -0 rm -rf
13
- find . -name package-lock.json -print0 | xargs -0 rm -rf
14
- find . -name newrelic_agent.log -print0 | xargs -0 rm -rf
15
- rm -rf npm-debug.log newrelic_agent.log .coverage_data cover_html
16
- rm -rf $SSLKEY $CACERT $CAINDEX $CASERIAL $CERTIFICATE
17
- rm -rf test/lib/*.old test/lib/*.attr
18
- rm -rf docs/
@@ -1,172 +0,0 @@
1
- /*
2
- * Copyright 2020 New Relic Corporation. All rights reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
-
6
- 'use strict'
7
- /* eslint-disable no-console */
8
-
9
- const async = require('async')
10
- const fs = require('fs')
11
-
12
- if (process.argv.length !== 4) {
13
- console.log('Usage: %s %s <baseline> <upstream>', process.argv[0], process.argv[1])
14
- console.log(' <baseline> JSON file containing benchmark results for upstream')
15
- console.log(' upstream comparison.')
16
- console.log(' <downstream> JSON file containing benchmark results from')
17
- console.log(' downstream branch to compare against base.')
18
- process.exit(1)
19
- }
20
-
21
- async.map(process.argv.slice(2), (file, cb) => {
22
- fs.readFile(file, {encoding: 'utf8'}, (err, data) => {
23
- if (err) {
24
- return cb(err)
25
- }
26
-
27
- let parsed = null
28
- try {
29
- parsed = JSON.parse(data)
30
- } catch (parseError) {
31
- return cb(parseError)
32
- }
33
-
34
- cb(null, parsed)
35
- })
36
- }, (err, resultFiles) => {
37
- if (err) {
38
- console.log('Failed to load files.')
39
- console.log(err)
40
- process.exit(2)
41
- }
42
-
43
- const baseline = resultFiles[0]
44
- const downstream = resultFiles[1]
45
-
46
- const baselineFiles = Object.keys(baseline)
47
- const downstreamFiles = Object.keys(downstream)
48
- const warnings = []
49
-
50
- diffArrays(baselineFiles, downstreamFiles).forEach((file) => {
51
- warnings.push(`- **WARNING**: File "${file}" in base but not branch.`)
52
- })
53
- diffArrays(downstreamFiles, baselineFiles).forEach((file) => {
54
- warnings.push(`- **NOTE**: File "${file}" in branch but not base.`)
55
- })
56
-
57
- let allPassing = true
58
- const details = baselineFiles.sort().map((testFile) => {
59
- const base = baseline[testFile]
60
- const down = downstream[testFile]
61
-
62
- if (!down) {
63
- return [
64
- '<details>',
65
- `<summary>${testFile} file missing from branch</summary>`,
66
- '',
67
- '</details>'
68
- ].join('\n')
69
- }
70
-
71
- let filePassing = true
72
- const baseTests = Object.keys(base)
73
- const downTests = Object.keys(down)
74
-
75
- diffArrays(baseTests, downTests).forEach((test) => {
76
- warnings.push(`- **WARNING**: Test "${test}" in base but not branch.`)
77
- })
78
- diffArrays(downTests, baseTests).forEach((test) => {
79
- warnings.push(`- **NOTE**: Test "${test}" in branch but not base.`)
80
- })
81
-
82
- const results = baseTests.sort().map((test) => {
83
- const passes = compareResults(base[test], down[test])
84
- filePassing = filePassing && passes
85
-
86
- return [
87
- '<details>',
88
- `<summary>${test}: ${passMark(passes)}</summary>`,
89
- '',
90
- formatResults(base[test], down[test]),
91
- '</details>',
92
- ''
93
- ].join('\n')
94
- }).join('\n')
95
- allPassing = allPassing && filePassing
96
-
97
- return [
98
- '<details>',
99
- `<summary>${testFile}: ${passMark(filePassing)}</summary>`,
100
- '',
101
- results,
102
- '',
103
- '-----------------------------------------------------------------------',
104
- '</details>'
105
- ].join('\n')
106
- }).join('\n\n')
107
-
108
- if (warnings.length) {
109
- console.log('### WARNINGS')
110
- console.log(warnings.join('\n'))
111
- console.log('')
112
- }
113
-
114
- console.log(`### Benchmark Results: ${passMark(allPassing)}`)
115
- console.log('')
116
- console.log('### Details')
117
- console.log('_Lower is better._')
118
- console.log(details)
119
-
120
- if (!allPassing) {
121
- process.exitCode = -1
122
- }
123
- })
124
-
125
- function diffArrays(a, b) {
126
- return a.filter((elem) => !b.includes(elem))
127
- }
128
-
129
- function compareResults(base, down) {
130
- const delta = down.mean - base.mean
131
- const deltaPercent = delta / base.mean
132
- if (Math.abs(delta) < 0.1) {
133
- return deltaPercent < 100
134
- }
135
- return deltaPercent < 2
136
- }
137
-
138
- function passMark(passes) {
139
- return passes ? '✔' : '✘'
140
- }
141
-
142
- function formatResults(base, down) {
143
- return [
144
- 'Field | Upstream (ms) | Downstream (ms) | Delta (ms) | Delta (%)',
145
- '----- | ------------: | --------------: | ---------: | --------:',
146
- formatField('numSamples'),
147
- formatField('mean'),
148
- formatField('stdDev'),
149
- formatField('max'),
150
- formatField('min'),
151
- formatField('5thPercentile'),
152
- formatField('95thPercentile'),
153
- formatField('median')
154
- ].join('\n')
155
-
156
- function formatField(field) {
157
- const baseValue = base[field]
158
- const downValue = down[field]
159
- const diffValue = downValue - baseValue
160
- const diffPercent = (100 * diffValue / baseValue).toFixed(2)
161
- const prefix = diffValue >= 0 ? '+' : ''
162
-
163
- return (
164
- `${field} | ${fixValue(baseValue)} | ${fixValue(downValue)} |` +
165
- ` ${fixValue(diffValue)} | ${prefix}${diffPercent}%`
166
- )
167
- }
168
-
169
- function fixValue(value) {
170
- return value % 1 ? value.toFixed(5) : value
171
- }
172
- }