Code Monkey home page Code Monkey logo

newrelic-java-agent's Introduction

New Relic Open Source community plus project banner.

newrelic-java-agent

With New Relic's Java agent for bytecode instrumentation, you can track everything from performance issues to tiny errors within your code. Our Java agent monitors your Java app and provides visibility into the behavior of your JVM. After installing, you can quickly monitor transactions, dive deep into errors, and more.

Java agent releases follow semantic versioning conventions. See Java agent release notes for full details on releases and downloads. Java agent artifacts can also be found on Maven.

Installation

To install the Java agent you need to configure your JVM to load the agent during your application's premain start-up by passing the -javaagent:/full/path/to/newrelic.jar command-line argument. This process varies depending on your environment/application server.

For full details see:

Getting started

See the getting started guide as well as the compatibility and requirements documentation for an overview of what is supported by the Java agent.

Usage

See the following documentation for specific use cases of the Java agent:

Building

JDK requirements

The Java agent uses a variety of JDK versions when building and running tests. These need to be installed and configured for your environment.

Edit or create the ~/.gradle/gradle.properties file and add the following JDKs, ensuring that the vendors/versions match what is installed in your environment (Mac OS X examples shown).

JDK 8 is required to build the agent:

jdk8=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

Additionally, the -PtestN Gradle property can be used to run tests on a specific JDK version which may require further JDK configuration. To keep test times reasonable the project only allows testing against supported LTS Java releases as well as the latest non-LTS release of Java. For example to run tests with Java 17, the -Ptest17 Gradle property would cause the test to use jdk17 as configured below:

jdk17=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home

Gradle build

The Java agent requires JDK 8 to build; your JAVA_HOME must be set to this JDK version.

To build the agent jar, run the following command from the project root directory:
./gradlew clean jar --parallel

To build and run all checks:
./gradlew clean build --parallel

After building, Java agent artifacts are located here:

  • Agent: newrelic-agent/build/newrelicJar/newrelic.jar
  • Agent API: newrelic-api/build/libs/newrelic-api-*.jar

Non standard modules

The following modules have specific requirements to be built. The instructions for each is in the module's README.md.

IntelliJ IDEA setup

We recommend using IntelliJ IDEA for development on this project. Configure as follows:

  1. Select File > Open and select newrelic-java-agent/build.gradle.
  2. Select Open as Project.
  3. Wait for the builds, imports, and indexing to finish. This may take a few minutes due to the project's size and complexity.
  4. Import Code Style: from dev-tools/code-style/java-agent-code-style.xml, select Preferences > Editor > Code Style > gear cog > Import Scheme > IntelliJ IDEA code style XML.
  5. Add Java 8 SDK: select File > Project Structure... > Platform Settings > SDKs > Add New SDK.
  6. Configure project SDK and target language level: select File > Project Structure... > Project Settings > Project.
    • Set Project SDK to JDK 1.8
    • Set Project language level to 8 IntelliJ screen shot for Project SDK and Language Level
  7. Increase Intellij memory heap if you encounter "Low Memory" issues. Recommended: 2048 MB. To do this, select Help > Change Memory Settings > Save and Restart.

Testing

The Java agent utilizes the following four distinct test suites, each of which is supported by a test framework. Each has specific strengths and weaknesses and each serves a particular purpose.

Conventional unit tests

The unit tests are conventional JUnit tests. The supporting framework is the industry-standard JUnit dependency. Unit tests rely on a variety of different mock object frameworks combined with complex test initialization patterns that simulate agent initialization. Scala test tasks are excluded by default. Including the -PincludeScala project property includes Scala test tasks.

Run all unit tests:

./gradlew -PnoInstrumentation clean test --continue --parallel

Run an individual unit test:

./gradlew -PnoInstrumentation clean newrelic-weaver:test --tests "com.newrelic.weave.LineNumberWeaveTest.testRemoveWeaveLineNumbers" --parallel

Run an individual unit test on a specific version of Java:

./gradlew -Ptest17 -PnoInstrumentation clean newrelic-weaver:test --tests "com.newrelic.weave.LineNumberWeaveTest.testRemoveWeaveLineNumbers" --parallel

Functional tests

The functional tests are JUnit tests for which Gradle ensures that each test class runs in a separate subprocess that initializes the agent. The test framework is a combination of industry-standard JUnit, Gradle, a small Gradle test executor task, and some special classes that address limitations of the base framework.

Note: Functional tests require that the Java agent jar artifact is present in the build directory.

Functional tests are located in newrelic-java-agent/functional_test/src/test/ and are run from the root newrelic-java-agent directory as follows:

Run all functional tests:

./gradlew functional_test:test --continue --parallel

Run an individual functional test:

./gradlew functional_test:test --tests test.newrelic.test.agent.AgentTest --parallel

Instrumentation module tests

The instrumentation module tests are also JUnit tests. The framework is the industry-standard JUnit dependency modified by a custom test runner and class loader that support bytecode weaving within the test without the need to fully initialize the agent. Note: fully initializing the agent is not possible when running in an uninstrumented reusable test process like an IntelliJ test subprocess or Gradle daemon. There is also an "introspector" (somewhat equivalent to a local mock collector) for test assertions.

Some of the instrumentation tests use Testcontainers so you might need to have Docker installed to run them locally.

Instrumentation tests are located in each instrumentation module at newrelic-java-agent/instrumentation/<INSTRUMENTATION MODULE>/src/test and are run from the root newrelic-java-agent directory as follows:

Run all instrumentation module tests:

./gradlew instrumentation:test --continue --parallel

Run all tests for a specific instrumentation module:

./gradlew instrumentation:akka-http-core-10.0.11:test --parallel

Run a single test for a specific instrumentation module:

./gradlew instrumentation:vertx-web-3.2.0:test --tests com.nr.vertx.instrumentation.RoutingTest --parallel

Run all tests for a specific Scala instrumentation module:

./gradlew -PincludeScala instrumentation:sttp-2.13_2.2.3:test --parallel

Code Quality

The agent utilizes Jacoco and Spotbugs to measure and improve code quality. We also use Codecov to report code coverage. Jacoco and Spotbug tools are configured through the gradle build system. Codecov is configured and uploaded through a GitHub Actions workflow.

Jacoco

The jacocoTestReport task depends on the unit test task. It uses data generated by the test task to create the coverage reports. jacocoTestReport task creates an html and xml file of the output. We store these files locally in the respective module's build/reports/jacoco folder. The html file can be opened normally in a browser. Some subprojects have not been configured to run because the code is either too trivial to test or it is code that is only compile time dependency and not necessary to test due to the nature of how the agent instruments customer code.

To run jacoco, execute unit tests in the usual ways given under the section Convential unit tests. The jacocoTestReport task will run automatically after the unit tests complete.

Codecov

We use a codecov github action to upload the jacoco coverage reports to codecov.io. Additionally, codecov will comment on pull requests (PRs) with a quick overview of how PRs (and relevant commits) will affect the code coverage as compared to the main branch.

Spotbugs

Spotbugs is a static code analysis tool to identify bugs in Java programs. It utilizes the Spotbugs gradle plugin. The projects that are scanned by Spotbugs are:

  • newrelic-agent
  • newrelic-weaver
  • agent-bridge
  • agent-model
  • newrelic-api

To run Spotbugs, execute the following command:

./gradlew spotbugsMain --parallel

The task will generate both XML and HTML files in the build/spotbugs folder underneath each subproject's top level folder. The HTML file can be opened normally in a browser. The XML files can be imported into the Spotbugs UI.

Support

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

This troubleshooting framework steps you through common troubleshooting questions.

New Relic offers NRDiag, a client-side diagnostic utility that automatically detects common problems with New Relic agents. If NRDiag detects a problem, it suggests troubleshooting steps. NRDiag can also automatically attach troubleshooting data to a New Relic Support ticket.

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.

Please review New Relic’s General Data Privacy Notice for more information.

Contribute

We encourage your contributions to improve newrelic-java-agent. 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 our bug bounty program.

License

newrelic-java-agent is licensed under the Apache 2.0 License.

The newrelic-java-agent 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 and our Java agent licenses public documentation.

newrelic-java-agent's People

Contributors

a-feld avatar benweint avatar breedx-nr avatar caioborgesleal avatar deleonenriqueta avatar enelson-newrelic avatar gdownes avatar gfuller1 avatar grahamfuller1 avatar harshit-ap avatar jack-berg avatar jasonjkeller avatar jbedell-newrelic avatar jeffalder avatar jtduffy avatar kanderson250 avatar kford-newrelic avatar koenpunt avatar lovesh-ap avatar meiao avatar nataliewolfe avatar obenkenobi avatar pliu-newrelic avatar purple4reina avatar richard-gibson avatar sdaubin avatar tbradellis avatar tspring avatar twcrone avatar xixiapdx avatar

Stargazers

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

Watchers

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

newrelic-java-agent's Issues

Verifier fails for jdbc-postgres-9.4.1208 instrumentation

Looks like the newrelic-gradle-verify-instrumentation is failing due to an expected dependency on org.postgresql:postgresql:42.2.15.jre6. Given that the Java agent does not support Java 6 I think we can simply skip verification against the jre6 dependency in the build.gradle.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':instrumentation:jdbc-postgresql-9.4.1208:verifyPass_org.postgresql_postgresql_42.2.15.jre6'.
> A failure occurred while executing com.newrelic.agent.instrumentation.verify.VerifyWorkAction
   > Verification FAILED. Instrumentation module jdbc-postgresql-9.4.1208-1.0.jar SHOULD HAVE applied to org.postgresql:postgresql:42.2.15.jre6 and did not. You may need to adjust the range "org.postgresql:postgresql:[9.4.1208,)".
     Verifier output:
     Creating user classloader with custom classpath:
     	/home/jenkins/.gradle/caches/modules-2/files-2.1/org.postgresql/postgresql/42.2.15.jre6/d050420e338c1ce2127f79ce213fc7ed81748d82/postgresql-42.2.15.jre6.jar
     WeaveViolation{type=MISSING_ORIGINAL_BYTECODE, clazz=org/postgresql/Driver}
     WeaveViolation{type=MISSING_ORIGINAL_BYTECODE, clazz=org/postgresql/util/ObjectFactory}
     WeaveViolation{type=MISSING_ORIGINAL_BYTECODE, clazz=org/postgresql/ds/common/BaseDataSource}

H2 Database Metrics are not collected when running JDK 11

Description

When using the Java Agent with an application running JDK 8, New Relic is able to receive metrics for my H2 database. After upgrading my JDK to Open JDK 11 I can no longer see my H2 database metrics. I was able to confirm that the instrumentation for my H2 database is still being loaded.

Support Ticket #: 431564

Expected Behavior

To be able to receive metrics for our H2 database calls as we did when using JDK 8.

Troubleshooting or NR Diag results

Logs are further details are in the support ticket below.

Steps to Reproduce

There is a sample application in the support ticket.

Additional context

Internal support ticket with details: https://newrelic.zendesk.com/agent/tickets/431564

(Migrate to Jira)

API for addCustomParameter(String, Boolean)

We should add an API for NewRelic.addCustomParameter(String, Boolean). As far as I can tell, this has never existed because the original API predated support for Boolean event types

Support akka-http-core version 10.2.1

Issue Overview

APM Java Agent documentation shows compatibility up to latest versions for auto instrumentation on akka-http-core, but it does not work for the latest versions. Java agent versions 6.0.0 and 6.1.0 were tested, and instrumentation tests were run for confirmation.

As of 10/7, the latest compatible (stable release) version of akka-http-core is 10.1.12 according to instrumentation module tests. I have tested this version and it does work.

Feature Description

Please update the agent for compatibility with akka-http-core 10.2.1, the latest version at this time.

Additional context

Refer to https://support.newrelic.com/tickets/430194 for additional discussion and context.

Priority

This will be necessary for continued use of the java agent with akka-http-core, but is not an emergency.
Custom / manual instrumentation may be used as a workaround.

Info

Here are the 10/7 instrumentation tests results.

Failure for 10.2.1:

Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.2.1

Full dump:

Task :buildSrc:compileJava UP-TO-DATE
Task :buildSrc:compileGroovy NO-SOURCE
Task :buildSrc:processResources NO-SOURCE
Task :buildSrc:classes UP-TO-DATE
Task :buildSrc:jar UP-TO-DATE
Task :buildSrc:assemble UP-TO-DATE
Task :buildSrc:compileTestJava NO-SOURCE
Task :buildSrc:compileTestGroovy NO-SOURCE
Task :buildSrc:processTestResources NO-SOURCE
Task :buildSrc:testClasses UP-TO-DATE
Task :buildSrc:test NO-SOURCE
Task :buildSrc:check UP-TO-DATE
Task :buildSrc:build UP-TO-DATE
Task :agent-bridge:requiresJava7
Task :agent-bridge:requiresJava8
Task :newrelic-api:requiresJava7
Task :newrelic-api:requiresJava8
Task :newrelic-api:compileJava UP-TO-DATE
Task :newrelic-weaver-api:requiresJava7
Task :newrelic-weaver-api:requiresJava8
Task :newrelic-weaver-api:compileJava UP-TO-DATE
Task :agent-bridge:compileJava UP-TO-DATE
Task :instrumentation:akka-http-cor.0.11:requiresJava7
Task :instrumentation:akka-http-core-10.0.11:requiresJava8
Task :instrumentation:akka-http-core-10.0.11:compileJava NO-SOURCE
Task :instrumentation:akka-http-core-10.0.11:compileScala UP-TO-DATE
Task :instrumentation:akka-http-core-10.0.11:processResources NO-SOURCE
Task :instrumentation:akka-http-core-10.0.11:classes UP-TO-DATE
Task :newrelic-weaver:requiresJava7
Task :newrelic-weaver:requiresJava8
Task :newrelic-weaver-scala-api:requiresJava7
Task :newrelic-weaver-scala-api:requiresJava8
Task :newrelic-weaver-scala-api:compileJava UP-TO-DATE
Task :newrelic-weaver:compileJava UP-TO-DATE
Task :instrumentation-build:compileJava UP-TO-DATE
Task :instrumentation-build:processResources NO-SOURCE
Task :instrumentation-build:classes UP-TO-DATE
Task :newrelic-weaver:processResources UP-TO-DATE
Task :newrelic-weaver:classes UP-TO-DATE
Task :newrelic-weaver:jar UP-TO-DATE
Task :newrelic-weaver-api:processResources NO-SOURCE
Task :newrelic-weaver-api:classes UP-TO-DATE
Task :newrelic-weaver-api:jar UP-TO-DATE
Task :newrelic-weaver-scala-api:processResources NO-SOURCE
Task :newrelic-weaver-scala-api:classes UP-TO-DATE
Task :newrelic-weaver-scala-api:jar UP-TO-DATE
Task :instrumentation-build:shadowJar UP-TO-DATE
Task :instrumentation:akka-http-core-10.0.11:writeCachedWeaveAttributes UP-TO-DATE
Task :instrumentation:akka-http-core-10.0.11:jar UP-TO-DATE
Task :instrumentation:akka-http-core-10.0.11:verifyInstrumentation UP-TO-DATE
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.2.0-M1
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.9
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.5
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.7
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.3
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.4
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.6
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.8
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.2
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.10
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.11
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.0-RC1
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.12
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.0-RC2
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.1
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.1.0
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.0.15
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.0.14
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.8
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.0.12
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.9
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.0.11
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.12_10.0.13
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.7
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.6
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.2
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.5
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.4
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.3
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.11
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.12
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.10
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.1
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.0-RC1
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.0
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.1.0-RC2
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.0.15
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.0.14
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.0.13
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.0.12
Task :instrumentation:akka-http-core-10.0.11:verifyPass_classpath
Task :instrumentation:akka-http-core-10.0.11:verifyPass_com.typesafe.akka_akka-http-core_2.11_10.0.11
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.2.0-RC2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.2.1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.2.0-RC1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.9
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.2.0
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.8
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.6+7-e2ba6752
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.6
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.7
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.4
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.5
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.3
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.10
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.0-RC2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.12_10.0.0
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_3.0.0-RC1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.9-RC2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.9
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.9-RC1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.8
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.6
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.7
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.5
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.4
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.2-RC1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.2-RC3
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.2-RC2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.3
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.11.2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.11.1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.11
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4-ARTERY-M4
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4.10
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4-ARTERY-M2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4-ARTERY-M3
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_2.4-ARTERY-M1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.9
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.7
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.8
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.6+7-e2ba6752
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.6
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.5
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.4
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.3
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.10
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.0
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core_2.11_10.0.0-RC2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.11_2.0.5
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.11_2.0.4
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.11_2.0.3
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.11_2.0.2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.11_2.0.1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.11_2.0-M2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.11_2.0
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.11_2.0-M1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.11_1.0
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.10_2.0.5
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.10_2.0.4
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.10_2.0.3
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.10_2.0.2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.10_2.0.1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.10_2.0-M2
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.10_2.0-M1
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.10_2.0
Task :instrumentation:akka-http-core-10.0.11:verifyFail_com.typesafe.akka_akka-http-core-experimental_2.10_1.0
BUILD SUCCESSFUL in 20s
138 actionable tasks: 124 executed, 14 up-to-date

Gate LinkingMetadataMBean on a config directive

This should be built after #61.

Right now, we always try and register the LinkingMetadataMBean with the platform MBean server. In some configurations, this can be problematic and prevent the agent from starting. We should change this behavior so that the LInkingMetadataMBean is only registered when a config item is present.

This config item should be part of the jmx subconfig, perhaps something like jmx.registerLinkingMetadataMBean or similar.

Fix "Illegal Reflective Access" warning

Description

When the agent starts up on Java 9+ it logs the following warning messages:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.newrelic.weave.weavepackage.NewClassAppender (file:/deploy/newrelic.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.newrelic.weave.weavepackage.NewClassAppender
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

We should either find a way to suppress these message, or better yet we should fix NewClassAppender such that it doesn't use this illegal access.

This is difficult because our utility classes are appended to the appropriate classloader that pulled in an instrumentation jar. We have to find a way to provide those classes to our classloader instrumentation so it can define the classes on that classloader when necessary.

Expected Behavior

Agent works the same with no loss of features.
No Reflective Access Warning.
No problems when using "redeploys" like in tomcat.

Your Environment

Java 9+

Java Agent - Support New Synthetics Header

Description

Looks like these values are reversed. It doesn't make sense to send more SpanEvents than were seen.

Pulled from a service via NRQL query:

Supportability/SpanEvent/TotalEventsSent 92.5 M
Supportability/SpanEvent/TotalEventsSeen 40.3 M

Expected Behavior

The metric values should be reversed

Troubleshooting

Args to recordSupportabilityMetrics got reversed here.

Java NR agent v6.0.0 crashes jboss 10

Description

When starting a jboss/keycloak:8.0.2 docker container with the NR agent the container crashes

(I have minimal java knowledge so I'm not sure that the issue is directly with jboss)

Expected Behavior

I would be able to pull the latest NR agent and still have the container start

Troubleshooting or [NR Diag]

2020-08-31 09:54:47ERROR: WFLYCTL0013: Operation ("parallel-extension-add") failed - address: ([])
2020-08-31 09:54:47java.lang.RuntimeException: WFLYCTL0079: Failed initializing module org.jboss.as.logging
2020-08-31 09:54:47at [email protected]//org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:115)
2020-08-31 09:54:47at [email protected]//org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:999)
2020-08-31 09:54:47at [email protected]//org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:743)
2020-08-31 09:54:47at [email protected]//org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:467)
2020-08-31 09:54:47at [email protected]//org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1413)
2020-08-31 09:54:47at [email protected]//org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:495)
2020-08-31 09:54:47at [email protected]//org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:472)
2020-08-31 09:54:47at [email protected]//org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:434)
2020-08-31 09:54:47at [email protected]//org.jboss.as.server.ServerService.boot(ServerService.java:435)
2020-08-31 09:54:47at [email protected]//org.jboss.as.server.ServerService.boot(ServerService.java:394)
2020-08-31 09:54:47at [email protected]//org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:374)
2020-08-31 09:54:47at java.base/java.lang.Thread.run(Thread.java:834)
2020-08-31 09:54:47Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: WFLYLOG0078: The logging subsystem requires the log manager to be org.jboss.logmanager.LogManager. The subsystem has not be initialized and cannot be used. To use JBoss Log Manager you must add the system property "java.util.logging.manager" and set it to "org.jboss.logmanager.LogManager"
2020-08-31 09:54:47at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
2020-08-31 09:54:47at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
2020-08-31 09:54:47at [email protected]//org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:107)
2020-08-31 09:54:47... 11 more
2020-08-31 09:54:47Caused by: java.lang.IllegalStateException: WFLYLOG0078: The logging subsystem requires the log manager to be org.jboss.logmanager.LogManager. The subsystem has not be initialized and cannot be used. To use JBoss Log Manager you must add the system property "java.util.logging.manager" and set it to "org.jboss.logmanager.LogManager"
2020-08-31 09:54:47at [email protected]//org.jboss.as.logging.LoggingExtension.initialize(LoggingExtension.java:195)
2020-08-31 09:54:41Aug 31, 2020 4:54:41 PM org.wildfly.security.Version <clinit>
2020-08-31 09:54:41INFO: ELY00001: WildFly Elytron version 1.10.4.Final
2020-08-31 09:54:40OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
2020-08-31 09:54:37Aug 31, 2020 4:54:37 PM org.jboss.vfs.TempFileProvider create
2020-08-31 09:54:37INFO: VFS000002: Failed to clean existing content for temp file provider of type temp. Enable DEBUG level log to find what caused this
2020-08-31 09:54:37Aug 31, 2020 4:54:37 PM org.jboss.as.server.ApplicationServerService start
2020-08-31 09:54:37INFO: WFLYSRV0049: Keycloak 8.0.2 (WildFly Core 10.0.3.Final) starting
2020-08-31 09:54:36Aug 31, 2020 4:54:36 PM org.jboss.threads.Version <clinit>
2020-08-31 09:54:36INFO: JBoss Threads version 2.3.3.Final
2020-08-31 09:54:36Aug 31, 2020 4:54:36 PM org.jboss.msc.service.ServiceContainerImpl <clinit>
2020-08-31 09:54:36INFO: JBoss MSC version 1.4.11.Final
2020-08-31 09:54:34WARNING: Failed to load the specified log manager class org.jboss.logmanager.LogManager
2020-08-31 09:54:30OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
2020-08-31 09:54:30WARNING: An illegal reflective access operation has occurred
2020-08-31 09:54:30WARNING: Illegal reflective access by com.newrelic.weave.weavepackage.NewClassAppender (file:/opt/newrelic/newrelic.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
2020-08-31 09:54:30WARNING: Please consider reporting this to the maintainers of com.newrelic.weave.weavepackage.NewClassAppender
2020-08-31 09:54:30WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
2020-08-31 09:54:30WARNING: All illegal access operations will be denied in a future release

Steps to Reproduce

I think this is about the minimal setup of my project (replace the agent version to 5.9.0 to fix the startup error)
Dockerfile:

FROM jboss/keycloak:8.0.2
USER root
RUN microdnf install -y unzip && microdnf clean all
RUN curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/6.0.0/newrelic-java.zip
RUN unzip newrelic-java.zip -d /opt
USER 1000
ENV NEW_RELIC_BROWSER_MONITORING_AUTO_INSTRUMENT false
ENV NEW_RELIC_LOG_LEVEL off
COPY --chown=jboss:root fs /
RUN chmod +x /opt/jboss/tools/start.sh && chmod +x /opt/jboss/startup-scripts/*.sh
ENTRYPOINT /opt/jboss/tools/start.sh

fs/opt/jboss/startup-scripts/001-add_nr.sh

    JAVA_AGENT='-javaagent:/opt/newrelic/newrelic.jar'
    echo "NEW_RELIC_AGENT_ENABLED set to true; adding $JAVA_AGENT to JAVA_OPTS..."
    echo "JAVA_OPTS=\"\$JAVA_OPTS $JAVA_AGENT\"" >> $JBOSS_HOME/bin/standalone.conf

fs/opt/jboss/tools/start.sh

exec /opt/jboss/tools/docker-entrypoint.sh $@ 

docker-compose.yml

version: '2.0'
volumes:
  db:
networks:
  keycloak:
services:
  app:
    container_name: keycloak-app
    depends_on:
      - db
    environment:
      NEW_RELIC_APP_NAME: keycloak
      NEW_RELIC_LICENSE_KEY: 'fake'
      DB_ADDR: db
      DB_DATABASE: keycloak
      DB_PASSWORD: password
      DB_PORT: '5432'
      DB_USER: keycloak
      DB_VENDOR: postgres
    ports:
      - '8443:8443'
      - '9990:9990'
    build:
      context: ./build/app
    links:
      - db
    networks:
      keycloak:
  db:
    container_name: keycloak-db
    environment:
      POSTGRES_DB: keycloak
      POSTGRES_PASSWORD: password
      POSTGRES_USER: keycloak
    expose:
      - '5432'
    image: postgres:11.5
    networks:
      keycloak:
    restart: always
    volumes:
      - db:/var/lib/postgresql/data:rw

Your Environment

Included in docker files
docker-compose up --build

Additional context

SSL Error while connecting to NR Collector

[NOTE]: # NR Agent can not connect to NR Collector due to a sun.security.provider.certpath.SunCertPathBuilderException. Problem can be solved by providing an invalid ca_bundle_path property.

Description

[NOTE]: # Agent(6.1.0) can not connect to NR Collector. It fails with an SunCertPathBuilderException. I verified it with a simple SpringBoot Application and tested it with JDK11 and JDK8. Since the Agent should be configured from ENV variables no configuration file is provided. NEW_RELIC_LICENSE_KEY and NEW_RELIC_APP_NAME are properly set and picked up by the Agent. Anyway, Agent can not connect to the Collector.
If NEW_RELIC_CA_BUNDLE_PATH=DOES_NOT_EXIST is provided, Agent is able to establish connection to the Collector.

Please find log files attached.

Expected Behavior

[NOTE]: # Agent can connect to NR Collector without adding invalid NEW_RELIC_CA_BUNDLE_PATH path.

Steps to Reproduce

[NOTE]: # Attach agent to sample spring boot application and check the logs
Does not work

$ export NEW_RELIC_LICENSE_KEY=******
$ export NEW_RELIC_APP_NAME=DEMO
$ export NEW_RELIC_LOG_FILE_NAME=STDOUT
$ java -javaagent:newrelic.jar -jar target/demo-0.0.1-SNAPSHOT.jar
2020-10-16T09:19:50,332+0200 [82663 1] com.newrelic INFO: Configuration file not found. The agent will attempt to read required values from environment variables.
2020-10-16T09:19:50,361+0200 [82663 1] com.newrelic INFO: Using region aware collector host: collector.eu01.nr-data.net
2020-10-16T09:19:50,473+0200 [82663 1] com.newrelic INFO: Agent Host: ***** IP:*****
2020-10-16T09:19:50,473+0200 [82663 1] com.newrelic INFO: New Relic Agent v6.1.0 is initializing...
2020-10-16T09:19:51,324+0200 [82663 11] com.newrelic INFO: Instrumentation com.newrelic.instrumentation.jdbc-resultset is disabled. Skipping.
2020-10-16T09:19:53,182+0200 [82663 1] com.newrelic.agent.RPMServiceManagerImpl INFO: Configured to connect to New Relic at collector.eu01.nr-data.net:443
2020-10-16T09:19:53,945+0200 [82663 1] com.newrelic INFO: Setting audit_mode to false
2020-10-16T09:19:54,293+0200 [82663 1] com.newrelic INFO: New Relic Agent v6.1.0 has started
2020-10-16T09:19:54,293+0200 [82663 1] com.newrelic INFO: Agent class loader: com.newrelic.bootstrap.BootstrapAgent$JVMAgentClassLoader@2b71fc7e
2020-10-16T09:19:54,294+0200 [82663 1] com.newrelic INFO: Premain startup complete in 4,539ms

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
  =========|_|==============|___/=/_/_/_/
  :: Spring Boot ::        (v2.3.4.RELEASE)

2020-10-16 09:19:56.078  INFO 82663 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication v0.0.1-SNAPSHOT on ***** with PID 82663 (*****/target/demo-0.0.1-SNAPSHOT.jar started by cwa in *****)
2020-10-16 09:19:56.083  INFO 82663 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2020-10-16 09:19:58.516  INFO 82663 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2020-10-16 09:19:59.293  INFO 82663 --- [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port(s): 8080
2020-10-16T09:19:59,294+0200 [82663 31] com.newrelic INFO: Host name is *****, display host ***** for application DEMO
2020-10-16 09:19:59.319  INFO 82663 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 3.982 seconds (JVM running for 9.636)
2020-10-16T09:19:59,451+0200 [82663 31] com.newrelic INFO: Unable to connect to New Relic due to an SSL error. Consider enabling -Djavax.net.debug=all to debug your SSL configuration such as your trust store.
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) ~[?:1.8.0_202-ea]
  at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1946) ~[?:1.8.0_202-ea]
  at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:316) ~[?:1.8.0_202-ea]
  at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:310) ~[?:1.8.0_202-ea]
  at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1639) ~[?:1.8.0_202-ea]
  at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:223) ~[?:1.8.0_202-ea]
  at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037) ~[?:1.8.0_202-ea]
  at sun.security.ssl.Handshaker.process_record(Handshaker.java:965) ~[?:1.8.0_202-ea]
  at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064) ~[?:1.8.0_202-ea]
  at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367) ~[?:1.8.0_202-ea]
  at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395) ~[?:1.8.0_202-ea]
  at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379) ~[?:1.8.0_202-ea]
  at com.newrelic.agent.deps.org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.deps.org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.deps.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.deps.org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:374) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.deps.org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.deps.org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.deps.org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.deps.org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.deps.org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.deps.org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.deps.org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.transport.apache.ApacheHttpClientWrapper.execute(ApacheHttpClientWrapper.java:162) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.transport.DataSenderImpl.connectAndSend(DataSenderImpl.java:552) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.transport.DataSenderImpl.send(DataSenderImpl.java:634) [newrelic.jar:6.1.0]
  at com.newrelic.agent.transport.DataSenderImpl.invoke(DataSenderImpl.java:493) [newrelic.jar:6.1.0]
  at com.newrelic.agent.transport.DataSenderImpl.invokeNoRunId(DataSenderImpl.java:488) [newrelic.jar:6.1.0]
  at com.newrelic.agent.transport.DataSenderImpl.parsePreconnectAndReturnHost(DataSenderImpl.java:208) [newrelic.jar:6.1.0]
  at com.newrelic.agent.transport.DataSenderImpl.connect(DataSenderImpl.java:186) [newrelic.jar:6.1.0]
  at com.newrelic.agent.RPMService.doConnect(RPMService.java:287) [newrelic.jar:6.1.0]
  at com.newrelic.agent.RPMService.launch(RPMService.java:247) [newrelic.jar:6.1.0]
  at com.newrelic.agent.rpm.RPMConnectionServiceImpl$RPMConnectionTask.attemptConnection(RPMConnectionServiceImpl.java:338) [newrelic.jar:6.1.0]
  at com.newrelic.agent.rpm.RPMConnectionServiceImpl$RPMConnectionTask.access$1100(RPMConnectionServiceImpl.java:105) [newrelic.jar:6.1.0]
  at com.newrelic.agent.rpm.RPMConnectionServiceImpl$RPMConnectionTask$3.run(RPMConnectionServiceImpl.java:240) [newrelic.jar:6.1.0]
  at com.newrelic.agent.util.SafeWrappers$1.run(SafeWrappers.java:34) [newrelic.jar:6.1.0]
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_202-ea]
  at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_202-ea]
  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_202-ea]
  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_202-ea]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_202-ea]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_202-ea]
  at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202-ea]
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:397) ~[?:1.8.0_202-ea]
  at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302) ~[?:1.8.0_202-ea]
  at sun.security.validator.Validator.validate(Validator.java:262) ~[?:1.8.0_202-ea]
  at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324) ~[?:1.8.0_202-ea]
  at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229) ~[?:1.8.0_202-ea]
  at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124) ~[?:1.8.0_202-ea]
  at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1621) ~[?:1.8.0_202-ea]
  ... 38 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141) ~[?:1.8.0_202-ea]
  at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126) ~[?:1.8.0_202-ea]
  at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280) ~[?:1.8.0_202-ea]
  at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392) ~[?:1.8.0_202-ea]
  at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302) ~[?:1.8.0_202-ea]
  at sun.security.validator.Validator.validate(Validator.java:262) ~[?:1.8.0_202-ea]
  at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324) ~[?:1.8.0_202-ea]
  at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229) ~[?:1.8.0_202-ea]
  at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124) ~[?:1.8.0_202-ea]
  at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1621) ~[?:1.8.0_202-ea]
  ... 38 more
2020-10-16T09:19:59,512+0200 [82663 31] com.newrelic INFO: Remote preconnect call failed : javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.
2020-10-16T09:19:59,512+0200 [82663 31] com.newrelic.agent.rpm.RPMConnectionServiceImpl INFO: Failed to connect to collector.eu01.nr-data.net:443 for DEMO: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
^C2020-10-16T09:20:00,946+0200 [82663 6] com.newrelic.agent.core.CoreServiceImpl INFO: JVM is shutting down
2020-10-16T09:20:00,959+0200 [82663 6] com.newrelic.agent.core.CoreServiceImpl INFO: New Relic Agent has shutdown

Works

$ export NEW_RELIC_LICENSE_KEY=******
$ export NEW_RELIC_APP_NAME=DEMO
$ export NEW_RELIC_LOG_FILE_NAME=STDOUT
$ export NEW_RELIC_CA_BUNDLE_PATH=DOES_NOT_EXIST
$ java -javaagent:newrelic.jar -jar target/demo-0.0.1-SNAPSHOT.jar
2020-10-16T09:23:06,024+0200 [82973 1] com.newrelic INFO: Configuration file not found. The agent will attempt to read required values from environment variables.
2020-10-16T09:23:06,052+0200 [82973 1] com.newrelic INFO: Using region aware collector host: collector.eu01.nr-data.net
2020-10-16T09:23:06,159+0200 [82973 1] com.newrelic INFO: Agent Host: ***** IP: *****
2020-10-16T09:23:06,159+0200 [82973 1] com.newrelic INFO: New Relic Agent v6.1.0 is initializing...
2020-10-16T09:23:07,015+0200 [82973 11] com.newrelic INFO: Instrumentation com.newrelic.instrumentation.jdbc-resultset is disabled. Skipping.
2020-10-16T09:23:08,798+0200 [82973 1] com.newrelic.agent.RPMServiceManagerImpl INFO: Configured to connect to New Relic at collector.eu01.nr-data.net:443
2020-10-16T09:23:08,881+0200 [82973 1] com.newrelic WARN: Unable to create SSL context
java.io.FileNotFoundException: DOES_NOT_EXIST (No such file or directory)
  at java.io.FileInputStream.open0(Native Method) ~[?:1.8.0_202-ea]
  at java.io.FileInputStream.open(FileInputStream.java:195) ~[?:1.8.0_202-ea]
  at java.io.FileInputStream.<init>(FileInputStream.java:138) ~[?:1.8.0_202-ea]
  at java.io.FileInputStream.<init>(FileInputStream.java:93) ~[?:1.8.0_202-ea]
  at com.newrelic.agent.transport.apache.ApacheSSLManager.getKeyStore(ApacheSSLManager.java:110) ~[newrelic.jar:6.1.0]
  at com.newrelic.agent.transport.apache.ApacheSSLManager.createSSLContext(ApacheSSLManager.java:41) [newrelic.jar:6.1.0]
  at com.newrelic.agent.transport.DataSenderFactory$DefaultDataSenderFactory.buildApacheHttpClientWrapper(DataSenderFactory.java:67) [newrelic.jar:6.1.0]
  at com.newrelic.agent.transport.DataSenderFactory$DefaultDataSenderFactory.create(DataSenderFactory.java:60) [newrelic.jar:6.1.0]
  at com.newrelic.agent.transport.DataSenderFactory.create(DataSenderFactory.java:46) [newrelic.jar:6.1.0]
  at com.newrelic.agent.RPMService.<init>(RPMService.java:107) [newrelic.jar:6.1.0]
  at com.newrelic.agent.RPMServiceManagerImpl.createRPMService(RPMServiceManagerImpl.java:174) [newrelic.jar:6.1.0]
  at com.newrelic.agent.RPMServiceManagerImpl.<init>(RPMServiceManagerImpl.java:78) [newrelic.jar:6.1.0]
  at com.newrelic.agent.service.ServiceManagerImpl.doStart(ServiceManagerImpl.java:237) [newrelic.jar:6.1.0]
  at com.newrelic.agent.service.AbstractService.start(AbstractService.java:63) [newrelic.jar:6.1.0]
  at com.newrelic.agent.Agent.continuePremain(Agent.java:157) [newrelic.jar:6.1.0]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_202-ea]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_202-ea]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_202-ea]
  at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_202-ea]
  at com.newrelic.bootstrap.BootstrapAgent.startAgent(BootstrapAgent.java:147) [newrelic.jar:6.1.0]
  at com.newrelic.bootstrap.BootstrapAgent.premain(BootstrapAgent.java:84) [newrelic.jar:6.1.0]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_202-ea]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_202-ea]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_202-ea]
  at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_202-ea]
  at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386) [?:1.8.0_202-ea]
  at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401) [?:1.8.0_202-ea]
2020-10-16T09:23:09,662+0200 [82973 1] com.newrelic INFO: Setting audit_mode to false
2020-10-16T09:23:09,985+0200 [82973 1] com.newrelic INFO: New Relic Agent v6.1.0 has started
2020-10-16T09:23:09,985+0200 [82973 1] com.newrelic INFO: Agent class loader: com.newrelic.bootstrap.BootstrapAgent$JVMAgentClassLoader@2b71fc7e
2020-10-16T09:23:09,985+0200 [82973 1] com.newrelic INFO: Premain startup complete in 4,524ms

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
  =========|_|==============|___/=/_/_/_/
  :: Spring Boot ::        (v2.3.4.RELEASE)

2020-10-16 09:23:11.568  INFO 82973 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication v0.0.1-SNAPSHOT on ***** with PID 82973 (*****/target/demo-0.0.1-SNAPSHOT.jar started by cwa in *****)
2020-10-16 09:23:11.573  INFO 82973 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2020-10-16 09:23:13.733  INFO 82973 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2020-10-16 09:23:14.524  INFO 82973 --- [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port(s): 8080
2020-10-16 09:23:14.542  INFO 82973 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 3.631 seconds (JVM running for 9.153)
2020-10-16T09:23:14,983+0200 [82973 31] com.newrelic INFO: Host name is *****, display host ***** for application DEMO
2020-10-16T09:23:15,215+0200 [82973 31] com.newrelic INFO: Collector redirection to collector-001.eu01.nr-data.net:443
2020-10-16T09:23:15,354+0200 [82973 31] com.newrelic INFO: Max payload size is 1,000,000 bytes
2020-10-16T09:23:15,354+0200 [82973 31] com.newrelic INFO: Agent run id: xxx
2020-10-16T09:23:15,355+0200 [82973 31] com.newrelic INFO: Agent 82973@*****/DEMO connected to collector.eu01.nr-data.net:443
2020-10-16T09:23:15,355+0200 [82973 31] com.newrelic INFO: Reporting to: https://rpm.eu.newrelic.com/accounts/****/applications/****
2020-10-16T09:23:15,356+0200 [82973 31] com.newrelic INFO: Using region aware collector host: collector.eu01.nr-data.neta
2020-10-16T09:23:15,360+0200 [82973 31] com.newrelic INFO: Using region aware collector host: collector.eu01.nr-data.net
2020-10-16T09:23:15,386+0200 [82973 31] com.newrelic INFO: Real user monitoring is enabled for application DEMO. Auto instrumentation is enabled.
## Your Environment 
- Agent Version: 6.1.0
- JVM 8 and 11

[newrelic_agent.sslerror.8.log](https://github.com/newrelic/newrelic-java-agent/files/5389816/newrelic_agent.sslerror.8.log)
[newrelic_agent.sslerror.11.log](https://github.com/newrelic/newrelic-java-agent/files/5389817/newrelic_agent.sslerror.11.log)
[newrelic_agent.working.8.log](https://github.com/newrelic/newrelic-java-agent/files/5389818/newrelic_agent.working.8.log)
[newrelic_agent.working.11.log](https://github.com/newrelic/newrelic-java-agent/files/5389819/newrelic_agent.working.11.log)

Implement action to run instrumentation unit tests

An action should run on pull requests that runs the instrumentation unit tests via ./gradlew instrumentation:test.

Use caching.

The hardest part will be the Rabbit tests which currently require compatibility with hans/frau. If you pick up this ticket you either have to figure out how to install erlang to match hans/frau or we have to take the hit and break compatibility with hans/frau.

Solr 8 JMX metrics enhancement

TL;DR

When Solr8 is using cloud sharding, some of the JMX metrics are not reporting. It would be great if they would!

About

If we look in the Solr7JmxValues.java class we can see that the `updateHandler' is looking for beanName:

solr:dom1=core,dom2=*,category=UPDATE,scope=updateHandler,name=*

but when Solr is configured for sharding, the names are dynamically generated to an arbitrary depth, and may look more like this:

solr:dom1=core,dom2=solr-inventory,dom3=shard1,dom4=replica_n1,category=UPDATE,scope=updateHandler,name=adds

For caching, the NR Solr 7 jmx support is looking for

solr:dom1=core,dom2=*,category=CACHE,scope=searcher,name=documentCache

but Solr8 might look more like

solr:dom1=core,dom2=solr-inventory,dom3=shard1,dom4=replica_n1,category=CACHE,scope=searcher,name=documentCache

When the New Relic JMX component cannot find these beans, the data does not get reported and ends up showing up as zeros in the UI.

Feature Description

The agent should be enhanced to be able to find the sharded JMX beans. Rather than hard-coding a handful of fixed names, the agent should adapt to solr 8 and be able to list or otherwise enumerate the bean names and match the arbitrary-depth domain names, as shown above.

These beans should be queried/monitored by the agent and reported to New Relic for display in the NR1 UI.

Describe Alternatives

Solr uses dropwizard/codahale metrics internally, and so the New Relic dropwizard reporter might be able to be used to get the same telemetry. Some experimentation/exploration would be required to verify that the same information can be obtained...and also how it might map to a cohesive user experience.

Additional context

It is unknown what earliest version of Solr supports cloud/shard bean names with arbitrary domain depth. It is likely that this will continue in future versions of dropwizard.

Priority

"Really Want". More than one customer has asked for this support.

Add instrumentation for spring-webflux 5.3.0+

The spring-webflux-5.1.0 instrumentation fails to verify against the newly released (as of Oct 27, 2020) 5.3.0 version of spring-webflux.

This will likely require a new instrumentation module to address the following changes:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':instrumentation:spring-webflux-5.1.0:verifyPass_org.springframework_spring-webflux_5.3.0'.
> A failure occurred while executing com.newrelic.agent.instrumentation.verify.VerifyWorkAction
   > Verification FAILED. Instrumentation module spring-webflux-5.1.0-1.0.jar SHOULD HAVE applied to org.springframework:spring-webflux:5.3.0 and did not. You may need to adjust the range "org.springframework:spring-webflux:[5.1.0.RELEASE,)".
     Verifier output:
     Creating user classloader with custom classpath:
     	/home/jenkins/.gradle/caches/modules-2/files-2.1/org.springframework/spring-webflux/5.3.0/19c74c1e2975f9b897bbd0b506d29462b25075fb/spring-webflux-5.3.0.jar
     	/home/jenkins/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/5.3.0/8c1510ab6384cf716e5b97f11cd889fb043adc8/spring-web-5.3.0.jar
     	/home/jenkins/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/5.3.0/bd01e44fd597fd8e14fb4ff2bc11362305b3a0b8/spring-beans-5.3.0.jar
     	/home/jenkins/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.3.0/b6dda23ac18fa6db58093638cfc7a62f1c50b808/spring-core-5.3.0.jar
     	/home/jenkins/.gradle/caches/modules-2/files-2.1/io.projectreactor/reactor-core/3.4.0/683c9c676c438e5945b0f12808575f22160c5e54/reactor-core-3.4.0.jar
     	/home/jenkins/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jcl/5.3.0/a855601f78047a38d86730b27ea76e1a64849cb1/spring-jcl-5.3.0.jar
     	/home/jenkins/.gradle/caches/modules-2/files-2.1/org.reactivestreams/reactive-streams/1.0.3/d9fb7a7926ffa635b3dcaa5049fb2bfa25b3e7d0/reactive-streams-1.0.3.jar
     WeaveViolation{type=FIELD_FINAL_MISMATCH, clazz=org/springframework/web/reactive/function/server/RequestPredicates$PathPatternPredicate, field=pattern}

Add instrumentation for Reactive Relational Database Connectivity

Feature Description

In one of our latest projects, we use the reactive spring framework with the Reactive Relational Database Connectivity MySQL Implementation to access the MySQL database. With the lack of instrumentation, the NewRelic database operation page is blank. We are looking for generic instrumentation for r2dbc-spi (https://github.com/r2dbc/r2dbc-spi) in the near term. And in the longer term, instrumentation for r2dbc-mysql (https://github.com/mirromutth/r2dbc-mysql).

Priority

Really Want

Agent W3C Trace Context API

Support for W3C Trace Context in the API for customers who are have manual instrumentation. They need this API for header propagation.

The Java agent currently does not support accepting W3C trace context formatted headers from manually instrumented external services. This breaks traces for customers such as those using services based Kafka and need this API in the Java agent to propagate trace headers.

This work is required to provide full support for W3C Trace Context.


Success criteria:

  • The Java agent provides a public API that can create and accept W3C payloads over HTTP and non-HTTP
  • Customers can find documentation on how to do these things as well as look at a working example
  • Old DistributedTracePayload APIs are deprecated

Aha! Link: https://newrelic.aha.io/features/JAVA-138

Add support for Java 15

Java 15 was just released. We should bump the max version in JavaVersionUtils and add it to our unit, functional and integration tests. An ASM update doesn't look necessary, but we should look into that as well as part of this work

Java Agent - IAST Enhancements

We are preparing to do our first release from GH Actions, and first major open source release (6.0.0).
In preparation, please create CHANGELOG.md and put in a list of relevant/interesting changes.

You might consider looking at another repo for examples of a changelog.

Edge case when sending data to backend causes ConnectionPoolTimeoutException

Description

In rare cases it is possible for the agent to encounter a ConnectionPoolTimeoutException when a thread requests a connection to one of the backend agent endpoints.

This happens because the connection pool is only configured to have a single connection and the same timeout value is used for both the request to agent endpoints as well as the request to the connection manager to get a connection from the pool.

In the case where two threads make a request to the connection manager at the same time, one will successfully obtain the lone connection and the other will wait for the connection to become available again. For both threads a 120 second timeout will begin ticking down, for the the thread that has the connection to complete its request and for the thread waiting for a connection to obtain one from the pool. If the thread with the connection times out (java.net.SocketTimeoutException) the connection will be released back to the pool but the thread waiting for a connection will also have timed out (com.newrelic.agent.deps.org.apache.http.conn.ConnectionPoolTimeoutException).

Most HTTP requests aren't going to timeout over 120 seconds but in some cases it does happen.

Expected Behavior

The connection pool and HTTP client used to make requests to agent endpoints should be more robustly configured so as to avoid ConnectionPoolTimeoutExceptions as described above.

Troubleshooting

java.net.SocketTimeoutException:

2020-08-20T10:52:14,684-0700 [51325 33] com.newrelic INFO: Remote analytic_event_data call failed : java.net.SocketTimeoutException: Read timed out.
2020-08-20T10:52:14,687-0700 [51325 33] com.newrelic FINE: Unable to send events for regular transactions. Data for this harvest will be dropped.
java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method) ~[?:1.8.0_265]
	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[?:1.8.0_265]
	at java.net.SocketInputStream.read(SocketInputStream.java:171) ~[?:1.8.0_265]
	at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[?:1.8.0_265]
	at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) ~[?:1.8.0_265]
	at sun.security.ssl.InputRecord.read(InputRecord.java:503) ~[?:1.8.0_265]
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:990) ~[?:1.8.0_265]
	at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:948) ~[?:1.8.0_265]
	at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) ~[?:1.8.0_265]
	at com.newrelic.agent.deps.org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:280) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.apache.ApacheHttpClientWrapper.execute(ApacheHttpClientWrapper.java:155) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.DataSenderImpl.connectAndSend(DataSenderImpl.java:559) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.DataSenderImpl.send(DataSenderImpl.java:641) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.DataSenderImpl.invoke(DataSenderImpl.java:500) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.DataSenderImpl.invokeRunId(DataSenderImpl.java:490) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.DataSenderImpl.sendAnalyticEventsForReservoir(DataSenderImpl.java:361) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.DataSenderImpl.sendAnalyticsEvents(DataSenderImpl.java:333) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.RPMService.sendAnalyticsEventsSyncRestart(RPMService.java:500) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.RPMService.sendAnalyticsEvents(RPMService.java:481) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.service.analytics.TransactionEventsService.harvestEvents(TransactionEventsService.java:206) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.Harvestable.harvest(Harvestable.java:36) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.HarvestServiceImpl$HarvestableTracker$1.run(HarvestServiceImpl.java:464) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.util.SafeWrappers$1.run(SafeWrappers.java:34) [newrelic.jar:6.0.0-SNAPSHOT]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_265]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_265]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_265]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_265]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_265]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_265]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_265]

Followed by com.newrelic.agent.deps.org.apache.http.conn.ConnectionPoolTimeoutException:

2020-08-20T10:52:37,545-0700 [51325 32] com.newrelic INFO: Remote update_loaded_modules call failed : com.newrelic.agent.deps.org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool.
2020-08-20T10:52:37,545-0700 [51325 32] com.newrelic FINE: Error sending JSON(update_loaded_modules): ["Jars",...]
2020-08-20T10:52:37,545-0700 [51325 32] com.newrelic FINEST: com.newrelic.agent.deps.org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool
com.newrelic.agent.deps.org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool
	at com.newrelic.agent.deps.org.apache.http.impl.conn.PoolingHttpClientConnectionManager.leaseConnection(PoolingHttpClientConnectionManager.java:314) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.conn.PoolingHttpClientConnectionManager$1.get(PoolingHttpClientConnectionManager.java:280) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:190) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.deps.org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.apache.ApacheHttpClientWrapper.execute(ApacheHttpClientWrapper.java:155) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.DataSenderImpl.connectAndSend(DataSenderImpl.java:559) ~[newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.DataSenderImpl.send(DataSenderImpl.java:641) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.DataSenderImpl.invoke(DataSenderImpl.java:500) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.DataSenderImpl.invokeRunId(DataSenderImpl.java:490) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.transport.DataSenderImpl.sendModules(DataSenderImpl.java:421) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.RPMService.sendModulesSyncRestart(RPMService.java:469) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.RPMService.sendModules(RPMService.java:455) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.service.module.JarCollectorServiceImpl.beforeHarvest(JarCollectorServiceImpl.java:190) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.HarvestServiceImpl.notifyListenerBeforeHarvest(HarvestServiceImpl.java:424) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.HarvestServiceImpl.access$800(HarvestServiceImpl.java:36) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.HarvestServiceImpl$HarvestTask.doHarvest(HarvestServiceImpl.java:384) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.HarvestServiceImpl$HarvestTask.harvest(HarvestServiceImpl.java:356) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.HarvestServiceImpl$HarvestTask.run(HarvestServiceImpl.java:292) [newrelic.jar:6.0.0-SNAPSHOT]
	at com.newrelic.agent.util.SafeWrappers$1.run(SafeWrappers.java:34) [newrelic.jar:6.0.0-SNAPSHOT]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_265]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_265]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_265]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_265]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_265]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_265]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_265]

Steps to Reproduce

I was able to repro this consistently by using a proxy between the agent and backend that would cause a SocketTimeoutException by delaying requests to one of the endpoints. Each time the subsequent request that was queued up would result in a ConnectionPoolTimeoutException.

Your Environment

Java agent 6.0.0-SNAPSHOT (but should date back to when persistent connections were introduced)
apache-tomcat-9.0.31

Additional context

Internal ticket: JAVA-6257

[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. 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. 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.

Agent doesn't report spans with auto app naming enabled

When auto app naming is enabled, span events don't get reported. Instead an NPE gets thrown when the agent tries to convert tracers to span events. This happens because the agent tries to lookup app-name-specific error builders, but the agent doesn't create app-name-specific error builders, causing an NPE here: https://github.com/newrelic/newrelic-java-agent/blob/main/newrelic-agent/src/main/java/com/newrelic/agent/service/analytics/TracerToSpanEvent.java#L124

There is a temporary fix for this on branch fix-span-error-builder that defaults to the base app error builder, allowing span events to get reported. This is a step in the right direction.

Here is the stacktrace that gets logged:

java.lang.NullPointerException: null
        at com.newrelic.agent.service.analytics.TracerToSpanEvent.maybeSetError(TracerToSpanEvent.java:124) ~[newrelic.jar:6.1.0]
        at com.newrelic.agent.service.analytics.TracerToSpanEvent.createSpanEvent(TracerToSpanEvent.java:96) ~[newrelic.jar:6.1.0]
        at com.newrelic.agent.service.analytics.SpanEventsServiceImpl.createAndStoreSpanEvent(SpanEventsServiceImpl.java:107) ~[newrelic.jar:6.1.0]
        at com.newrelic.agent.service.analytics.SpanEventsServiceImpl.storeSafely(SpanEventsServiceImpl.java:86) [newrelic.jar:6.1.0]
        at com.newrelic.agent.service.analytics.SpanEventsServiceImpl.dispatcherTransactionFinished(SpanEventsServiceImpl.java:78) [newrelic.jar:6.1.0]
        at com.newrelic.agent.TransactionService.doProcessTransaction(TransactionService.java:160) [newrelic.jar:6.1.0]
        at com.newrelic.agent.TransactionService.transactionFinished(TransactionService.java:116) [newrelic.jar:6.1.0]
        at com.newrelic.agent.Transaction.finishTransaction(Transaction.java:1122) [newrelic.jar:6.1.0]

Share code for the legacy Play 1.x framework instrumentation

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

Earlier versions of the agent (4.x) had instrumentation for Play Framework 1.x. This was omitted from the 5.x release preventing us from upgrading.

Feature Description

A partial patch file or a Github Gist with the relevant bits shared. We can then fork this project and apply the necessary changes.

Describe Alternatives

None.

Additional context

This is the communication received from New Relic.

Unfortunately, the Play 1.x instrumentation implementation does not have a mechanism to load as an extension (Pointcut vs Weaver API). As you've already deduced, it would difficult to match the old instrumentation without injecting bytecode.

Despite our limited support on the following, you may extract other missing instrumentation from previous Java agent builds by extracting (unzip) the module from the newrelic.jar archive to your installed /newrelic/extensions directory (instrumentation modules are found in the /instrumentation directory).

Priority

Blocker.

Migrate LinkingMetadataMBean registration to JMXService.

The registration of the linking metadata MBean happens in premain now.

We want to move this out of premain and instead start it up as part of the JMXService. This helps to remove the clutter (desire to keep premain simple/small) and helps to reduce risk around overall agent startup.

Java Agent - Enhance Support for Jedis 5+

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) 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 must be present in your repository to grant attribution to all dependencies being used by this project. 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.

The agent doesn’t correctly query Tomcat JMX metrics when using embedded Tomcat with SpringBoot

The agent doesn’t correctly query the following Tomcat JMX metrics when using embedded Tomcat with SpringBoot:

  • type=DataSource
  • type=ThreadPool
  • type=Manager

We add Tomcat JMX values for the above categories if the server was started via one of the following two methods:

org.apache.catalina.startup.HostConfig.start()
org.apache.catalina.core.StandardServer.startInternal()

It appears that when using embedded Tomcat with Spring Boot StandardServer does get instrumented properly:

Supportability/WeaveInstrumentation/WeaveClass/com.newrelic.instrumentation.tomcat-jmx/org/apache/catalina/core/StandardServer
Supportability/WeaveInstrumentation/WeaveClass/com.newrelic.instrumentation.tomcat-8.5.2/org/apache/catalina/core/StandardServer

By default, embedded Tomcat JMX is disabled by Spring Boot. In application.properties Tomcat mbeans need to be enabled by adding: server.tomcat.mbeanregistry.enabled=true

The problem though is that the Mbean group namespaces are different, standalone Tomcat uses the prefix Catalina for queries whereas embedded Tomcat uses the prefix Tomcat. Our tomcat-jmx instrumentation only queries MBeans with the Catalina prefix thus queries initiated by embedded Tomcat fail due to an incorrect group name.

Standalone Tomcat JMX:
standalone-catalina

Embedded Tomcat JMX
embedded-tomcat

For now, the recommended workaround would be to utilize Custom JMX instrumentation by YAML and create a dashboard to view the metrics.

(migrate to Jira)

Handle JFR streaming better

The Mbean for streaming JFR data doesn't do a good job of managing the streams. Look into that and see if there's a better way we could manage the streams to reduce memory issues.

Spring Instrumentation Transaction Name is set to URI variable name from RequestMapping instead of the value

Description

The transaction name is set to the variable name for @RequestMapping instead of the resolved endpoint defined in application.properties or other config file.

Steps to Reproduce

define a variable in application.properties for a Spring Boot Project

example:

    requestmapping.path=hello

Create a controller using a URI path variable


    @RestController
    public class HelloController {

	    @RequestMapping(path = "/${requestmapping.path}")
	    public String index() {
		    return "Greetings from Spring Boot!";
	    }

    }

Download and install the agent.
Run the application with the Java Agent.

Expected Behavior

Transaction Name should resolve to the variable value not the string variable name.

additional info

New Relic APM UI:

varnameTransName

Debug

methodPath

helloPath

Seeing this in spring-4.3 module, but this looks like it will replicate in earlier versions as well.

Additional context

Can be easily replicated with a simple spring boot app as described above.
https://start.spring.io/

Somewhere here it looks like that we only read the value on RequestMapping, but it never resolves.
See debugging screenshot...

It seems that methodPath never resolves to anything:

public static String getPath(String rootPath, String methodPath, RequestMethod httpMethod) {

https://github.com/spring-projects/spring-framework/blob/d8dafbc49d66738a20e389336ed8359bb7ed2c95/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java#L99

https://github.com/spring-projects/spring-framework/blob/d8dafbc49d66738a20e389336ed8359bb7ed2c95/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java#L115

(Migrate to Jira)

AWS IMDS V2 Support

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

AWS has created a newer protocol to communicate with the Metadata server (context), that enables clients to use a session based request which is more secure. With the idea of deprecating the usage of the V1 protocol, we rely on the agent to no longer use that authentication method.

Feature Description

Adopt the session based authentication with the AWS metadata server.

Describe Alternatives

None that I can think of.

Additional context

https://krebsonsecurity.com/2019/08/what-we-can-learn-from-the-capital-one-hack/

Priority

Must Have

New Relic Java Agent 6.2.0 is broken with SpringBoot 2.3.5 if there is no response body.

Filing this on behalf of Lawrence Ong regarding Support ticket #435916 and Community post.

Description

The NewRelic Java agent with SpringBoot 2.3.5 hangs if there is no response body. Tried this with HTTP OK response with zero body and HTTP NoContent response (where we cannot add any body at all).

Sample Code - Hangs with Agent 6.2.0, works with Agent 6.1.0

@Configuration
class Routes {
    @Bean
    fun route() = router {
        ("/api" and accept(MediaType.APPLICATION_JSON)).nest {
            GET("/test") {
                ServerResponse.ok().build()
            }
            GET("/test204") {
                ServerResponse.noContent().build()
            }
        }
    }
}

Expected Behavior

Java agent should work as it did in 6.1.0 and not hang.

Troubleshooting or NR Diag results

Logs and further details are in the support ticket linked below.

Steps to Reproduce

Sample application in support ticket.

Additional context

Internal support ticket with details: https://support.newrelic.com/tickets/435916
https://discuss.newrelic.com/t/new-relic-java-agent-6-2-0-is-broken-with-springboot/121470

Ensure all verifications run on internal jenkins for each pull request

Feature Description

The verification process is currently split between tasks that run as a part of github actions, and tasks that run internally on jenkins servers on a fixed schedule (the tasks are run against the main branch ~ 1 / day).

We should eventually move all the verification tasks to github actions, and add merge checks that require that all have passed. For now though, we'd at least like to be able to run all the jenkins verification tasks for each PR branch, rather than on a fixed schedule for the main branch. This would improve the PR flow because although external contributors wouldn't be able to see the results of the builds, the team would still be able to verify that all verification checks have passed before merging, and thus improve confidence in the code.

Support for java.net.http.HttpClient

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

java.net.http.HttpClient is a standard Java http client so it would be nice to have it instrumented automatically

Feature Description

java.net.http.HttpClient is instrumented automatically along with other 3rd party libraries

Describe Alternatives

So far we are using custom instrumentation which is confusing. We can also switch to some 3rd party http client but we want to keep our client lightweight.

Additional context

none

Priority

Please help us better understand this feature request by choosing a priority from the following options:
Really Want

Aha! Link: https://newrelic.aha.io/features/JAVA-192

Auto app naming doesn't work well with distributed tracing

Description

With the temporary fix for #123, the agent still reports span events under the wrong app name. It reports all span events under the default app name from the config, which is wrong.

Expected Behavior

I would expect the agent to report span events under the app name that is on the span event.

Historical Context

This used to partially work starting in agent version 4.9.0. What used to happen is it would report the transaction event to the proper app and then all the spans for that transaction would report to the base app. Since we decided to remove transaction events from the distributed trace UI and use the root span event instead it is unclear which app the span events are coming from.

Here's an example of an auto app naming application which has a base app and a second app who's name was set by our bridge API. Notice that all span events are still reported under the base app. https://user-images.githubusercontent.com/58712431/100002710-cab3b600-2d79-11eb-87a9-67ec138f931b.png

There are two paths forward as I see it. We either provide several reservoirs for span sampling and report each one to its own application, or we keep 1 span reservoir and breakout the spans when we send them so they go to each of their respective endpoints. The first approach matches what we do with other services for auto app naming.

Aha! Link: https://newrelic.aha.io/features/JAVA-266

JDK versions in Readme do not align with required JDK versions for compilation

Description

The Readme states that JDK 7 and 8 are required to build the agent under Building > JDK requirements.
If only JDKs 7 and 8 are in ~/.gradle/gradle.properties an exception is thrown when trying to perform a Gradle sync.

Expected Behavior

I expect to be able to Gradle sync and build the agent.

Steps to Reproduce

With only jdk7 and jdk8 in my ~/.gradle/gradle.properties and running ./gradlew build I get the following

❯ ./gradlew build

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/ahorner/Documents/newrelic/newrelic-java-agent/module_test_10/build.gradle' line: 33

* What went wrong:
A problem occurred evaluating project ':module_test_10'.
> Could not get unknown property 'jdk10' for project ':module_test_10' of type org.gradle.api.Project.

Installing JDK 10 and adding it to ~/.gradle/gradle.properties:

❯ ./gradlew build

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/ahorner/Documents/newrelic/newrelic-java-agent/module_test_11/build.gradle' line: 33

* What went wrong:
A problem occurred evaluating project ':module_test_11'.
> Could not get unknown property 'jdk11' for project ':module_test_11' of type org.gradle.api.Project.

Installing JDK 11 and adding it to the properties:

❯ ./gradlew build

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/ahorner/Documents/newrelic/newrelic-java-agent/module_test_9/build.gradle' line: 33

* What went wrong:
A problem occurred evaluating project ':module_test_9'.
> Could not get unknown property 'jdk9' for project ':module_test_9' of type org.gradle.api.Project.

Installing JDK 9 and adding it to the properties file finally dismisses these exceptions.

~/.gradle/gradle.properties:

jdk7=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
jdk8=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
jdk9=/Library/Java/JavaVirtualMachines/adoptopenjdk-9.jdk/Contents/Home
jdk10=/Library/Java/JavaVirtualMachines/adoptopenjdk-10.jdk/Contents/Home
jdk11=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

Your Environment

❯ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

~
❯ javac --version
javac 11.0.7

Additional context

I would expect the docs to be updated to mention that all 5 JDKs are required, or for only 7 and 8 to be setup. Perhaps the issue is that the build step also runs the JDK-specific testing tasks.

[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.

∞T Polish

As a user of Infinite Tracing, I expect to get my k8s metadata in the same way I would with the standard agent collector pipeline. Also, as a user of Infinite Tracing, I expect that I would not lose span data when New Relic redirects my traffic to a different cell.

These represent a small amount of additional work to get all agents to the same level with Infinite Tracing. We want to get this work done by end of November. This work does not block ∞T GA.

The spec PRs:
https://source.datanerd.us/agents/agent-specs/pull/534
https://source.datanerd.us/agents/agent-specs/pull/543

Part of the work is represented here: https://newrelic.atlassian.net/browse/JAVA-5982

Aha! Link: https://newrelic.aha.io/features/JAVA-186

Newrelic Agent licensing related query

HI Newrelic Team,

If we are shipping newrelic java agent as part of our docker image with our customers but if they are actually not using it since they don't have an newrelic license procured, in that case is it fine to ship the newrelic java agent library along with our docker image ?

right now we are using the same base docker image both for both our SaaS and PaaS solution and for SaaS we have newrelic license procured but for PaaS we are shipping the newrelic agent along with the docker image but it won't be used by the customer as he doesn't have a license procured and so there won't be any sink to dump this data..

So, do you think we have to build an separate image for PaaS so that we are not distributing newrelic agent zip file that has been downloaded onto the docker image ?

Thanks

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.