Git Product home page Git Product logo

node-newrelic-superagent's Introduction

⚠️ This package has been deprecated. The functionality has been merged into the core newrelic module.

New Relic Open Source community plus project banner.

New Relic SuperAgent instrumentation

npm status badge superagent Instrumentation CI codecov

New Relic's official SuperAgent framework instrumentation for use with the New Relic Node.js agent.

This module is a dependency of the agent and is installed by default when you install the agent.

Installation and Getting Started

This package is a dependency of the the Node.js Agent, and should not need to install it manually.

For more information, please see the agent installation guide and compatibility and requirements.

Our API and developer documentation for writing instrumentation will be of help. We particularly recommend the tutorials and various "shim" API documentation.

Testing

The module includes a suite of unit and functional tests which should be used to verify that your changes don't break existing functionality.

All tests are stored in tests/ and are written using Node-Tap with the extension .tap.js.

To run the full suite, run: npm test.

Individual test scripts include:

npm run unit
npm run versioned

Support

Should you need assistance with New Relic products, you are in good hands with several support channels.

If the issue has been confirmed as a bug or is a feature request, please file a GitHub issue.

Support Channels

Privacy

At New Relic we take your privacy and the security of your information seriously, and are committed to protecting your information. We must emphasize the importance of not sharing personal data in public forums, and ask all users to scrub logs and diagnostic information for sensitive information, whether personal, proprietary, or otherwise.

We define “Personal Data” as any information relating to an identified or identifiable individual, including, for example, your name, phone number, post code or zip code, Device ID, IP address and email address.

For more information, review New Relic’s General Data Privacy Notice.

Contribute

We encourage your contributions to improve the superagent instrumentation module! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.

If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at [email protected].

A note about vulnerabilities

As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.

If you would like to contribute to this project, review these guidelines.

To all contributors, we thank you! Without your contribution, this project would not be what it is today. We also host a community project page dedicated to New Relic SuperAgent (Node).

License

New Relic SuperAgent instrumentation is licensed under the Apache 2.0 License.

New Relic SuperAgent instrumentation also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.

node-newrelic-superagent's People

Contributors

astormnewrelic avatar bizob2828 avatar carlo-808 avatar coreyarnold avatar dependabot[bot] avatar garbados avatar jmartin4563 avatar jsumners-nr avatar lykkin avatar michaelgoin avatar mrickard avatar nataliewolfe avatar nijotz avatar paperclypse avatar psvet avatar snyk-bot avatar svetlanabrennan avatar tangollama avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-newrelic-superagent's Issues

License file is missing

Inside of the package.json for this package, the license attribute is filled out as such:

{
  "license": "SEE LICENSE IN LICENSE"
}

However, the supporting LICENSE file is not included in this codebase or shipped with the tarball as it is in the other New Relic npm packages. This causes errors for automated tools.

superagent 7.1.0 breaks in versioned tests

Description

It looks like 7.1.0 has changed some signatures when calling certain methods.

Steps to Reproduce

npm run versioned

Additional context

It is failing with

# Subtest: SuperAgent instrumentation with async/await
    # Subtest: should maintain transaction context with promises
        not ok 1 - The "options.lookup" property must be of type function. Received null
          ---
          stack: >
            /home/runner/work/node-newrelic/node-newrelic/lib/shim/shim.js:1314:22
          
            LegacyContextManager.runInContext (/home/runner/work/node-newrelic/node-newrelic/lib/context-manager/legacy-context-manager.js:59:23)
          
            Shim.applySegment (/home/runner/work/node-newrelic/node-newrelic/lib/shim/shim.js:1304:25)
          
            TLSSocket.connectWrapper [as connect] (/home/runner/work/node-newrelic/node-newrelic/lib/instrumentation/core/net.js:88:27)
          
            LegacyContextManager.runInContext (/home/runner/work/node-newrelic/node-newrelic/lib/context-manager/legacy-context-manager.js:59:23)
          
            Agent.wrapped (/home/runner/work/node-newrelic/node-newrelic/lib/transaction/tracer/index.js:204:37)
          at:
            line: 1032
            column: 5
            file: node:net
            function: lookupAndConnect
          type: TypeError
          code: ERR_INVALID_ARG_TYPE
          tapCaught: unhandledRejection
          test: should maintain transaction context with promises
          ...
        
        1..1
        # failed 1 test
    not ok 1 - should maintain transaction context with promises # time=60.056ms
    
    1..1
    # failed 1 test
not ok 1 - SuperAgent instrumentation with async/await # time=476.788ms
  ---
  autoend: true
  ...

1..1
# failed 1 test
# time=482.953ms

[Repolinter] Open Source Policy Issues

Repolinter Report

🤖This issue was automatically generated by repolinter-action, developed by the Open Source and Developer Advocacy team at New Relic. This issue will be automatically updated or closed when changes are pushed. If you have any problems with this tool, please feel free to open a GitHub issue or give us a ping in #help-opensource.

This Repolinter run generated the following results:

❗ Error ❌ Fail ⚠️ Warn ✅ Pass Ignored Total
0 0 0 7 0 7

Passed #

Click to see rules

license-file-exists #

Found file (LICENSE). New Relic requires that all open source projects have an associated license contained within the project. This license must be permissive (e.g. non-viral or copyleft), and we recommend Apache 2.0 for most use cases. For more information please visit https://docs.google.com/document/d/1vML4aY_czsY0URu2yiP3xLAKYufNrKsc7o4kjuegpDw/edit.

readme-file-exists #

Found file (README.md). New Relic requires a README file in all projects. This README should give a general overview of the project, and should point to additional resources (security, contributing, etc.) where developers and users can learn further. For more information please visit https://github.com/newrelic/open-by-default.

readme-starts-with-community-plus-header #

The first 5 lines contain all of the requested patterns. (README.md). The README of a community plus project should have a community plus header at the start of the README. If you already have a community plus header and this rule is failing, your header may be out of date, and you should update your header with the suggested one below. For more information please visit https://opensource.newrelic.com/oss-category/.

readme-contains-link-to-security-policy #

Contains a link to the security policy for this repository (README.md). New Relic recommends putting a link to the open source security policy for your project (https://github.com/newrelic/<repo-name>/security/policy or ../../security/policy) in the README. For an example of this, please see the "a note about vulnerabilities" section of the Open By Default repository. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

readme-contains-discuss-topic #

Contains a link to the appropriate discuss.newrelic.com topic (README.md). New Relic recommends directly linking the your appropriate discuss.newrelic.com topic in the README, allowing developer an alternate method of getting support. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

code-of-conduct-should-not-exist-here #

New Relic has moved the CODE_OF_CONDUCT file to a centralized location where it is referenced automatically by every repository in the New Relic organization. Because of this change, any other CODE_OF_CONDUCT file in a repository is now redundant and should be removed. Note that you will need to adjust any links to the local CODE_OF_CONDUCT file in your documentation to point to the central file (README and CONTRIBUTING will probably have links that need updating). For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view. Did not find a file matching the specified patterns. All files passed this test.

third-party-notices-file-exists #

Found file (THIRD_PARTY_NOTICES.md). A THIRD_PARTY_NOTICES.md file can be present in your repository to grant attribution to all dependencies being used by this project. This document is necessary if you are using third-party source code in your project, with the exception of code referenced outside the project's compiled/bundled binary (ex. some Java projects require modules to be pre-installed in the classpath, outside the project binary and therefore outside the scope of the THIRD_PARTY_NOTICES). Please review your project's dependencies and create a THIRD_PARTY_NOTICES.md file if necessary. For JavaScript projects, you can generate this file using the oss-cli. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view.

[Repolinter] Open Source Policy Issues

Repolinter Report

🤖This issue was automatically generated by repolinter-action, developed by the Open Source and Developer Advocacy team at New Relic. This issue will be automatically updated or closed when changes are pushed. If you have any problems with this tool, please feel free to open a GitHub issue or give us a ping in #help-opensource.

This Repolinter run generated the following results:

❗ Error ❌ Fail ⚠️ Warn ✅ Pass Ignored Total
0 1 0 5 0 6

Fail #

readme-starts-with-community-plus-header #

The README of a community plus project should have a community plus header at the start of the README. If you already have a community plus header and this rule is failing, your header may be out of date. For more information please visit https://opensource.newrelic.com/oss-category/. Below is a list of files or patterns that failed:

  • README.md: The first 1 lines do not contain the pattern(s): Open source Community Plus header (see https://opensource.newrelic.com/oss-category).
    • 🔨 Suggested Fix: prepend [![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) to file

Passed #

Click to see rules

license-file-exists #

Found file (LICENSE). New Relic requires that all open source projects have an associated license contained within the project. This license must be permissive (e.g. non-viral or copyleft), and we recommend Apache 2.0 for most use cases. For more information please visit https://docs.google.com/document/d/1vML4aY_czsY0URu2yiP3xLAKYufNrKsc7o4kjuegpDw/edit.

readme-file-exists #

Found file (README.md). New Relic requires a README file in all projects. This README should give a general overview of the project, and should point to additional resources (security, contributing, etc.) where developers and users can learn further. For more information please visit https://github.com/newrelic/open-by-default.

readme-contains-link-to-security-policy #

Contains a link to the security policy for this repository (README.md). New Relic recommends putting a link to the open source security policy for your project (https://github.com/newrelic/<repo-name>/security/policy or ../../security/policy) in the README. For an example of this, please see the "a note about vulnerabilities" section of the Open By Default repository. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

readme-contains-discuss-topic #

Contains a link to the appropriate discuss.newrelic.com topic (README.md). New Relic recommends directly linking the your appropriate discuss.newrelic.com topic in the README, allowing developer an alternate method of getting support. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

third-party-notices-file-exists #

Found file (THIRD_PARTY_NOTICES.md). A THIRD_PARTY_NOTICES.md file can be present in your repository to grant attribution to all dependencies being used by this project. This document is necessary if you are using third-party source code in your project, with the exception of code referenced outside the project's compiled/bundled binary (ex. some Java projects require modules to be pre-installed in the classpath, outside the project binary and therefore outside the scope of the THIRD_PARTY_NOTICES). Please review your project's dependencies and create a THIRD_PARTY_NOTICES.md file if necessary. For JavaScript projects, you can generate this file using the oss-cli. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view.

Remove coveralls

Right now, it is setup in Travis which we've migrated away from.

Also, code-coverage is not a metric currently heavily valued by the team to track.

  • Remove from readme (or can punt that to readme story)
  • Remove dependency from module
  • Update third party notices

superagent: drop node 14

Is your feature request related to a problem? Please describe.

  • Update package engines stanza to >=16.
  • Update versioned tests engines to remove 14

Convert CI to GitHub Actions

  • Users can run unit tests at a minimum.

Would aim for all tests functioning for external PR's (forked repos) with these efforts.

Switch to 'main' as default branch

We've settled on main as the new default branch name.

This will involve creating and migrating to the new branch before deleting the prior. We'll also want to ensure we change the base of any existing PR's etc.

Hanselman has some helpful instructions on the blog: https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx. I'm sure there are other useful resources out there as well.

  • Change default branch in repo settings
  • Change the base of all open PRs
  • Copy master branch protection rules to main
  • Edit any release documents to reference main instead of master
  • Setup Snyk to use main

[Repolinter] Open Source Policy Issues

Repolinter Report

🤖This issue was automatically generated by repolinter-action, developed by the Open Source and Developer Advocacy team at New Relic. This issue will be automatically updated or closed when changes are pushed. If you have any problems with this tool, please feel free to open a GitHub issue or give us a ping in #help-opensource.

This Repolinter run generated the following results:

❗ Error ❌ Fail ⚠️ Warn ✅ Pass Ignored Total
0 1 0 6 0 7

Fail #

code-of-conduct-file-does-not-exist #

New Relic has moved the CODE_OF_CONDUCT file to a centralized location where it is referenced automatically by every repository in the New Relic organization. Because of this change, any other CODE_OF_CONDUCT file in a repository is now redundant and should be removed. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view. Found files. Below is a list of files or patterns that failed:

  • CODE_OF_CONDUCT.md
    • 🔨 Suggested Fix: Remove file

Passed #

Click to see rules

license-file-exists #

Found file (LICENSE). New Relic requires that all open source projects have an associated license contained within the project. This license must be permissive (e.g. non-viral or copyleft), and we recommend Apache 2.0 for most use cases. For more information please visit https://docs.google.com/document/d/1vML4aY_czsY0URu2yiP3xLAKYufNrKsc7o4kjuegpDw/edit.

readme-file-exists #

Found file (README.md). New Relic requires a README file in all projects. This README should give a general overview of the project, and should point to additional resources (security, contributing, etc.) where developers and users can learn further. For more information please visit https://github.com/newrelic/open-by-default.

readme-starts-with-community-plus-header #

The first 5 lines contain all of the requested patterns. (README.md). The README of a community plus project should have a community plus header at the start of the README. If you already have a community plus header and this rule is failing, your header may be out of date, and you should update your header with the suggested one below. For more information please visit https://opensource.newrelic.com/oss-category/.

readme-contains-link-to-security-policy #

Contains a link to the security policy for this repository (README.md). New Relic recommends putting a link to the open source security policy for your project (https://github.com/newrelic/<repo-name>/security/policy or ../../security/policy) in the README. For an example of this, please see the "a note about vulnerabilities" section of the Open By Default repository. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

readme-contains-discuss-topic #

Contains a link to the appropriate discuss.newrelic.com topic (README.md). New Relic recommends directly linking the your appropriate discuss.newrelic.com topic in the README, allowing developer an alternate method of getting support. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

third-party-notices-file-exists #

Found file (THIRD_PARTY_NOTICES.md). A THIRD_PARTY_NOTICES.md file can be present in your repository to grant attribution to all dependencies being used by this project. This document is necessary if you are using third-party source code in your project, with the exception of code referenced outside the project's compiled/bundled binary (ex. some Java projects require modules to be pre-installed in the classpath, outside the project binary and therefore outside the scope of the THIRD_PARTY_NOTICES). Please review your project's dependencies and create a THIRD_PARTY_NOTICES.md file if necessary. For JavaScript projects, you can generate this file using the oss-cli. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view.

Readme Updates

Summary

  • Should conform to new open source template.
    • See the internal repo template project.
  • Clear instructions for development and "building".
  • For Explorer's Hub... perhaps we just want to point to the main agent topic? This is the link to the main agent area: https://discuss.newrelic.com/c/support-products-agents/node-js-agent/
  • Update any out of date information

Depending on the amount of content, may want to run by the docs team. They had a bit of consistency and branding changes to the main agent readme.

Minimal code cleanup

We are already in decent shape but do a pass for general things outlined in the Engineering Plan.

Regex @nijotz used on the last story:

rg --pcre2 '(?<!SELECT)(// |^ *\*(?!/))(?! Copyright|.*Apache|.*eslint)'

404 Not found on npm

I get "npm ERR! 404 Not Found: @newrelic/superagent@latest" when doing "npm install @newrelic/superagent"

superagent: add node 20

Is your feature request related to a problem? Please describe.

  • Add Node 20 to CI and drop 14

Add copyright to all source files

Every source file in the repository should contain the copyright block heading on top:

/*
* Copyright 2020 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

This includes bash scripts (slightly different commenting style) and code examples. Does not include copy-paste templates.

NOTE: we want the Apache-2.0 license to land first so these are consistent and that license is the current active for the commit(s) applying these changes.


Useful Script

  • Does not update non-JS files.
  • May break when there’s a code directive that needs to be at the top.
  • May need additional modifications for a particular repository.
  • Run git ls-files | grep '\.js$' | grep -Ev '(.eslintrc|^newrelic)' to see list of files
tmp=$(mktemp)   # Create a temporary file
trap "rm -f $tmp; exit 1" 0 1 2 3 13 15

header="/*
 * Copyright 2020 New Relic Corporation. All rights reserved.
 * SPDX-License-Identifier: Apache-2.0
 */
"

for file in $(git ls-files | grep '\.js$' | grep -Ev '(.eslintrc|^newrelic)')
do
    {
    echo -e "$header"
    cat $file
    } > $tmp
    mv $tmp $file
    echo $file
done

rm -f $tmp
trap 0

Update prep-release workflow

This repo is using the old way of prepping a release that requires updating the release notes.

Need to update the prep release workflow to use the correct workflow like we do in the node agent repo.

newrelic/node-newrelic-aws-sdk#232

Update Pull Requests settings in Settings > General to squash merges, use PR title and delete head branches

314513799-3b49e6c9-4b34-471d-9046-f43f01feed37

Shipping large amounts of redundant files

As a general note: Most of your npm packages (including newlic, @newrelic/koa, @newrelic/native-metrics) appear to be rather large and seem to be shipping many redundant files such as tests, source files or even vendored dependencies.

As for the superagent package:

The following files should probably not be shipped:

.eslintignore
.eslintrc
.travis.yml
CHANGELOG.md
newrelic_agent.log
tests

Please note that newrelic_agent.log is 14 megabytes and seems to contain build log data, I have not yet looked into the kind of log data in there but it certainly shouldn't be on npm.

Please look into using the files property in package.json to reduce package bloat.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.