Skip to content

Commit

Permalink
Merge branch 'main' into release/csec/v1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lovesh-ap authored Sep 26, 2024
2 parents f4680cc + 8cb150e commit 573ddd8
Show file tree
Hide file tree
Showing 125 changed files with 6,076 additions and 229 deletions.
6 changes: 3 additions & 3 deletions .github/actions/setup-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ runs:
with:
distribution: 'temurin'
java-version: |
22
23
21
17
11
Expand All @@ -31,7 +31,7 @@ runs:
s|jdk11=11|jdk11=${JAVA_HOME_11_X64}|
s|jdk17=17|jdk17=${JAVA_HOME_17_X64}|
s|jdk21=21|jdk21=${JAVA_HOME_21_X64}|
s|jdk22=22|jdk22=${JAVA_HOME_22_X64}|" gradle.properties.gha
s|jdk23=23|jdk23=${JAVA_HOME_23_X64}|" gradle.properties.gha
cat gradle.properties.gha >> gradle.properties
- name: Setup Gradle
Expand All @@ -41,7 +41,7 @@ runs:

- name: Setup Gradle options
shell: bash
run: echo "GRADLE_OPTIONS=--console=plain --parallel -Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=JAVA_HOME_8_X64,JAVA_HOME_11_X64,JAVA_HOME_17_X64,JAVA_HOME_21_X64,JAVA_HOME_22_X64" >> $GITHUB_ENV
run: echo "GRADLE_OPTIONS=--console=plain --parallel -Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=JAVA_HOME_8_X64,JAVA_HOME_11_X64,JAVA_HOME_17_X64,JAVA_HOME_21_X64,JAVA_HOME_23_X64" >> $GITHUB_ENV

- name: Download S3 instrumentation jar zip
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/GHA-Functional-Tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
##max-parallel: 1 ## used to force sequential
fail-fast: false
matrix:
java-version: [ 8, 11, 17, 21, 22 ]
java-version: [ 8, 11, 17, 21, 23 ]
steps:
- name: Checkout Java agent
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # pin@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/GHA-Unit-Tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
# max-parallel: 1 ## used to force sequential vs. concurrent
fail-fast: false
matrix:
java-version: [ 8, 11, 17, 21, 22 ]
java-version: [ 8, 11, 17, 21, 23 ]
steps:
- name: Checkout Java agent
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # pin@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Java-Instrumentation-Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
java-version: [ 8, 11, 17, 21, 22 ]
java-version: [ 8, 11, 17, 21, 23 ]
name: Java ${{ matrix.java-version }}
timeout-minutes: 120
# needs: install-all-java
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/Test-AITs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ jobs:
with:
distribution: 'zulu'
java-version: |
22
23
21
17
11
Expand All @@ -212,14 +212,14 @@ jobs:
echo "JDK_zulu_11=${JAVA_HOME_11_X64}" >> $GITHUB_ENV
echo "JDK_zulu_17=${JAVA_HOME_17_X64}" >> $GITHUB_ENV
echo "JDK_zulu_21=${JAVA_HOME_21_X64}" >> $GITHUB_ENV
echo "JDK_zulu_22=${JAVA_HOME_22_X64}" >> $GITHUB_ENV
echo "JDK_zulu_23=${JAVA_HOME_23_X64}" >> $GITHUB_ENV
- name: Set up Javas
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # pin@v4
with:
distribution: 'temurin'
java-version: |
22
23
21
17
11
Expand Down Expand Up @@ -272,10 +272,10 @@ jobs:
<toolchain>
<type>jdk</type>
<provides>
<version>22</version>
<version>23</version>
</provides>
<configuration>
<jdkHome>${JAVA_HOME_22_X64}</jdkHome>
<jdkHome>${JAVA_HOME_23_X64}</jdkHome>
</configuration>
</toolchain>
</toolchains>
Expand Down Expand Up @@ -312,12 +312,12 @@ jobs:
ZULU11=${JDK_zulu_11} \
ZULU17=${JDK_zulu_17} \
ZULU21=${JDK_zulu_21} \
ZULU22=${JDK_zulu_22} \
ZULU23=${JDK_zulu_23} \
JAVA8JRE=${JAVA_HOME_8_X64} \
JAVA11JRE=${JAVA_HOME_11_X64} \
JAVA17JRE=${JAVA_HOME_17_X64} \
JAVA21JRE=${JAVA_HOME_21_X64} \
JAVA22JRE=${JAVA_HOME_22_X64} \
JAVA23JRE=${JAVA_HOME_23_X64} \
conf/autoconfigure
. conf/testenv java
cat conf/java_local_config.yml
Expand Down
36 changes: 33 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,39 @@ Noteworthy changes to the agent are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Version 8.14.0
## New features and improvements

* The Java agent supports disabling AI Monitoring at the account/organization level [1972](https://github.com/newrelic/newrelic-java-agent/pull/1972)
* HikariCP instrumentation now captures additional metrics [1976](https://github.com/newrelic/newrelic-java-agent/pull/1976)
* Adds new instrumentation module for `kafka-clients-metrics-3.7.0` [2001](https://github.com/newrelic/newrelic-java-agent/pull/2001)
* Adds new instrumentation module for `jedis-5.0.0` [1969](https://github.com/newrelic/newrelic-java-agent/pull/1969)
* Adds new instrumentation module for `vertx-sqlclient-4.4.2` [2004](https://github.com/newrelic/newrelic-java-agent/pull/2004)
* The `newrelic-scala-api` for Scala 3 will now be published to Maven [1995](https://github.com/newrelic/newrelic-java-agent/pull/1995)
* New AWS MQ attributes will be added to spans [1977](https://github.com/newrelic/newrelic-java-agent/pull/1977)
* Clarify Javadoc comments for `@Trace` API [2009](https://github.com/newrelic/newrelic-java-agent/pull/2009)

## Fixes

* Fixes a `netty-reactor` issue that was causing high memory usage [1978](https://github.com/newrelic/newrelic-java-agent/pull/1978)
* Netty instrumentation will start transactions for HTTP/2 requests [1994](https://github.com/newrelic/newrelic-java-agent/pull/1994)

## Deprecations

The following instrumentation modules are deprecated and will be removed in the next major release:

- `aws-wrap-0.7.0`
- `java.completable-future-jdk8`
- `play-2.3`
- `spring-3.0.0`
- `netty-3.4`
- `Struts v1`

## IAST

- CSEC Version bump to 1.4.1 [2010](https://github.com/newrelic/newrelic-java-agent/pull/2010)
- Changelog: https://github.com/newrelic/csec-java-agent/releases/tag/1.4.1

## Version 8.13.0
## New features and improvements

Expand All @@ -28,14 +61,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Add security-related class excludes during normal class transformer creation [1918](https://github.com/newrelic/newrelic-java-agent/pull/1918)
* Add null checks to vertx 4.5.1 instrumentation [1927](https://github.com/newrelic/newrelic-java-agent/pull/1927)



## IAST

* CSEC Version bump to 1.4.0 [1956](https://github.com/newrelic/newrelic-java-agent/pull/1956)
* [Changelog](https://github.com/newrelic/csec-java-agent/releases/tag/1.4.0)


## Deprecations

- The browser footer injection APIs have been deprecated and will be removed in a future agent release. The header injection API now adds both the header and footer scripts. [1679](https://github.com/newrelic/newrelic-java-agent/pull/1679)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,16 @@ public interface CollectionFactory {
* @param <V> the type of value stored/returned
*/
<K, V> Function<K, V> memorize(Function<K, V> loader, int maxSize);

/**
* Create a time based eviction cache in which an entry's age is determined on a last-access basis.
*
* @param <K> key type
* @param <V> cached type
* @param ageInSeconds how old, in seconds, a cache entry must be to be evicted after last access
* @param initialCapacity the initial capacity of the cache
* @param loader the function to calculate the value for a key, used if the key is not cached
* @return a time based concurrent cache
*/
<K, V> Function<K, V> createAccessTimeBasedCache(long ageInSeconds, int initialCapacity, Function<K, V> loader);
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,12 @@ public <K, V> Function<K, V> memorize(Function<K, V> loader, int maxSize) {
return loader.apply(k1);
});
}

/**
* Note: In this implementation, this method will return the loader function as is.
*/
@Override
public <K, V> Function<K, V> createAccessTimeBasedCache(long ageInSeconds, int initialCapacity, Function<K, V> loader) {
return loader;
}
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ ext {
// SynchronizedAnnotationNode, SynchronizedClassNode, SynchronizedFieldNode, SynchronizedInnerClassNode, SynchronizedMethodNode,
// SynchronizedModuleExportNode, SynchronizedModuleNode, SynchronizedModuleOpenNode, SynchronizedModuleProvideNode, SynchronizedModuleRequireNode,
// SynchronizedTypeAnnotationNode
asmVersion="9.6"
asmVersion="9.7"
}
4 changes: 2 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ repositories {
dependencies {
// This is how we do our NR-specific patching. That is, moving Log4jPlugins,
// changing Logger.getLogger, and checking for unmapped dependencies.
implementation("org.ow2.asm:asm:9.6")
implementation("org.ow2.asm:asm-commons:9.6")
implementation("org.ow2.asm:asm:9.7")
implementation("org.ow2.asm:asm-commons:9.7")

// Shadow is used here because several classes implement the Transformer interface
implementation("com.github.jengelman.gradle.plugins:shadow:6.0.0")
Expand Down
117 changes: 117 additions & 0 deletions dev-tools/live-templates
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<template name="nrAtTrace" value="@com.newrelic.api.agent.Trace" description="@Trace" toReformat="true" toShortenFQNames="true">
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="nrAtTraceAsync" value="@com.newrelic.api.agent.Trace(async = true)" description="@Trace(async = true)" toReformat="true" toShortenFQNames="true">
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="nrAtTraceDispatcher" value="@com.newrelic.api.agent.Trace(dispatcher = true)" description="@Trace(dispatcher = true)" toReformat="true" toShortenFQNames="true">
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="nrAtWeave" value="@com.newrelic.api.agent.weaver.Weave(type = com.newrelic.api.agent.weaver.MatchType.$MATCH_TYPE$, originalName = &quot;$CLASS_NAME$&quot;)" description="@Weave(originalName = &quot;java.my.Class&quot;, type = Match..." toReformat="true" toShortenFQNames="true">
<variable name="MATCH_TYPE" expression="enum(&quot;ExactClass&quot;, &quot;BaseClass&quot;, &quot;Interface&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="CLASS_NAME" expression="regularExpression(concat(currentPackage(), &quot;.&quot;, fileNameWithoutExtension()), &quot;_.*&quot;, &quot;&quot;)&quot;" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="nrCallOriginal" value="com.newrelic.api.agent.weaver.Weaver.callOriginal();" description="Weaver.callOriginal();" toReformat="true" toShortenFQNames="true">
<context>
<option name="JAVA_EXPRESSION" value="true" />
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="nrCallOriginalReturn" value="return com.newrelic.api.agent.weaver.Weaver.callOriginal();" description="return Weaver.callOriginal();" toReformat="true" toShortenFQNames="true">
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="nrConfig" value="com.newrelic.api.agent.NewRelic.getAgent().getConfig().getValue(&quot;$NAME$&quot;, $VALUE$);" description="NewRelic.getAgent().getConfig().getValue(...)" toReformat="true" toShortenFQNames="true">
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="VALUE" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_EXPRESSION" value="true" />
</context>
</template>
<template name="nrHttpParams" value="com.newrelic.api.agent.HttpParameters $PARAMS$ = com.newrelic.api.agent.HttpParameters&#10; .library($LIBRARY$)&#10; .uri($URI$)&#10; .procedure($PROC$)&#10; .inboundHeaders($INBOUND_HEADERS$)&#10; .status($STATUS_CODE$, $STATUS_TEXT$)&#10; .build();" description="HttpParams params = HttpParams.library()...build();" toReformat="true" toShortenFQNames="true">
<variable name="PARAMS" expression="suggestVariableName()" defaultValue="" alwaysStopAt="true" />
<variable name="LIBRARY" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="URI" expression="variableOfType(&quot;java/net/URI.java&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="PROC" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="INBOUND_HEADERS" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="STATUS_CODE" expression="variableOfType(&quot;int&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="STATUS_TEXT" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="nrLog" value="com.newrelic.api.agent.NewRelic.getAgent().getLogger().log(java.util.logging.Level.$LEVEL$, &quot;$MSG$&quot;);" description="NewRelic.getAgent().getLogger().log(Level..." toReformat="true" toShortenFQNames="true">
<variable name="LEVEL" expression="enum(&quot;SEVERE&quot;, &quot;WARNING&quot;, &quot;INFO&quot;, &quot;FINE&quot;, &quot;FINER&quot;, &quot;FINEST&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="MSG" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="nrMessageConsumeParams" value="com.newrelic.api.agent.MessageConsumeParameters $PARAMS$ = com.newrelic.api.agent.MessageConsumeParameters&#10; .library($LIBRARY$, $OTEL_LIBRARY$)&#10; .destinationType($DEST_TYPE$)&#10; .destinationName($DEST_NAME$)&#10; .inboundHeaders($OUTBOUND_HEADERS$)&#10; .cloudRegion($REGION$)&#10; .cloudAccountId($ACCOUNT_ID$)&#10; .build();" description="MessageProducerParams params = MessageProducerParams.builder()..." toReformat="true" toShortenFQNames="true">
<variable name="PARAMS" expression="suggestVariableName()" defaultValue="" alwaysStopAt="true" />
<variable name="LIBRARY" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="OTEL_LIBRARY" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="DEST_TYPE" expression="enum(&quot;com.newrelic.api.agent.DestinationType.NAMED_QUEUE&quot;,&quot;com.newrelic.api.agent.DestinationType.TEMP_QUEUE&quot;,&quot;com.newrelic.api.agent.DestinationType.NAMED_TOPIC&quot;,&quot;com.newrelic.api.agent.DestinationType.TEMP_TOPIC&quot;,&quot;com.newrelic.api.agent.DestinationType.EXCHANGE&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="DEST_NAME" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="OUTBOUND_HEADERS" expression="variableOfType(&quot;com.newrelic.api.agent.OutboundHeaders&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="REGION" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="ACCOUNT_ID" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="nrMessageProduceParams" value="com.newrelic.api.agent.MessageProduceParameters $PARAMS$ = com.newrelic.api.agent.MessageProduceParameters&#10; .library($LIBRARY$, $OTEL_LIBRARY$)&#10; .destinationType($DEST_TYPE$)&#10; .destinationName($DEST_NAME$)&#10; .outboundHeaders($OUTBOUND_HEADERS$)&#10; .cloudRegion($REGION$)&#10; .cloudAccountId($ACCOUNT_ID$)&#10; .build();" description="MessageProducerParams params = MessageProducerParams.builder()..." toReformat="true" toShortenFQNames="true">
<variable name="PARAMS" expression="suggestVariableName()" defaultValue="" alwaysStopAt="true" />
<variable name="LIBRARY" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="OTEL_LIBRARY" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="DEST_TYPE" expression="enum(&quot;com.newrelic.api.agent.DestinationType.NAMED_QUEUE&quot;,&quot;com.newrelic.api.agent.DestinationType.TEMP_QUEUE&quot;,&quot;com.newrelic.api.agent.DestinationType.NAMED_TOPIC&quot;,&quot;com.newrelic.api.agent.DestinationType.TEMP_TOPIC&quot;,&quot;com.newrelic.api.agent.DestinationType.EXCHANGE&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="DEST_NAME" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="OUTBOUND_HEADERS" expression="variableOfType(&quot;com.newrelic.api.agent.OutboundHeaders&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="REGION" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="ACCOUNT_ID" expression="variableOfType(&quot;java.lang.String&quot;)" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="nrReportAsExternal" value="com.newrelic.api.agent.NewRelic.getAgent().getTracedMethod().reportAsExternal($PARAMS$);" description="NewRelic.getAgent().getTracedMethod().reportAsExternal(params);" toReformat="true" toShortenFQNames="true">
<variable name="PARAMS" expression="variableOfType(&quot;com.newrelic.api.agent.ExternalParameters&quot;)" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="nrSegment" value="com.newrelic.api.agent.Segment $SEGMENT$ = com.newrelic.api.agent.NewRelic.getAgent().getTransaction().startSegment(&quot;$CATEGORY$&quot;, &quot;$NAME$&quot;);" description="Segment segment = NewRelic.getAgent().getTransaction().startSegment();" toReformat="true" toShortenFQNames="true">
<variable name="SEGMENT" expression="suggestVariableName()" defaultValue="" alwaysStopAt="true" />
<variable name="CATEGORY" expression="enum(&quot;category&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="NAME" expression="enum(&quot;optional name&quot;)" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="nrToken" value="com.newrelic.api.agent.Token $TOKEN$ = com.newrelic.api.agent.NewRelic.getAgent().getTransaction().getToken();" description="Token token = NewRelic.getAgent().getTransaction().getToken();" toReformat="true" toShortenFQNames="true">
<variable name="TOKEN" expression="suggestVariableName()" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="nrTracedMethod" value="com.newrelic.api.agent.TracedMethod $TRACER$ = com.newrelic.api.agent.NewRelic.getAgent().getTracedMethod();" description="TracedMethod tracedMethod = NewRelic.getAgent().getTracedMethod();" toReformat="true" toShortenFQNames="true">
<variable name="TRACER" expression="suggestVariableName()" defaultValue="tracer" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="nrTx" value="com.newrelic.api.agent.Transaction $TRANSACTION$ = com.newrelic.api.agent.NewRelic.getAgent().getTransaction();" description="Transaction transaction = NewRelic.getAgent().getTransaction();" toReformat="true" toShortenFQNames="true">
<variable name="TRANSACTION" expression="enum(&quot;transaction&quot;, &quot;tx&quot;)" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
Loading

0 comments on commit 573ddd8

Please sign in to comment.