Skip to content

Commit 07c9ada

Browse files
authored
Merge branch 'main' into option-change-handling
2 parents d6415f6 + fc662b1 commit 07c9ada

File tree

74 files changed

+1108
-221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1108
-221
lines changed

.fossa.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ targets:
187187
- type: gradle
188188
path: ./
189189
target: ':instrumentation:jdbc:library'
190+
- type: gradle
191+
path: ./
192+
target: ':instrumentation:jfinal-3.2:javaagent'
190193
- type: gradle
191194
path: ./
192195
target: ':instrumentation:jmx-metrics:javaagent'

.github/renovate.json5

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,18 @@
77
ignorePaths: [
88
'instrumentation/**',
99
],
10-
// needed in order to get patch-only updates in package rules below
11-
// unfortunately you can't combine updateTypes and separateMinorPatch in the same package rule
12-
// so we have to apply it globally here, see
13-
// https://github.com/renovatebot/renovate/discussions/8399#discussioncomment-305798
14-
separateMinorPatch: true,
1510
packageRules: [
1611
{
1712
// this is to reduce the number of renovate PRs
1813
matchManagers: [
1914
'github-actions',
2015
'dockerfile',
16+
'regex',
2117
],
2218
extends: [
2319
'schedule:weekly',
2420
],
2521
groupName: 'weekly update',
26-
separateMinorPatch: false, // overrides separateMinorPatch specified above
2722
},
2823
{
2924
matchPackageNames: [
@@ -43,6 +38,14 @@
4338
ignoreUnstable: false,
4439
allowedVersions: '!/\\-SNAPSHOT$/',
4540
},
41+
{
42+
// currently using gradle plugin org.playframework.play 3.1.0 milestone releases
43+
// but don't want to pick up SNAPSHOT releases
44+
matchPackageNames: [
45+
'org.playframework.play:**',
46+
],
47+
allowedVersions: '!/\\-SNAPSHOT$/',
48+
},
4649
{
4750
groupName: 'quarkus packages',
4851
matchPackageNames: [
@@ -143,11 +146,7 @@
143146
matchPackageNames: [
144147
'uk.org.webcompere:system-stubs-jupiter',
145148
],
146-
matchUpdateTypes: [
147-
'major',
148-
'minor',
149-
],
150-
enabled: false,
149+
allowedVersions: '/^2\.0\./',
151150
},
152151
{
153152
// wiremock 3+ requires Java 11+
@@ -218,11 +217,7 @@
218217
matchPackageNames: [
219218
'ch.qos.logback:**',
220219
],
221-
matchUpdateTypes: [
222-
'major',
223-
'minor',
224-
],
225-
enabled: false,
220+
allowedVersions: '/^1\.2\./',
226221
},
227222
{
228223
// intentionally using slf4j 1 in this smoke tests
@@ -253,18 +248,26 @@
253248
],
254249
},
255250
{
256-
// intentionally aligning both netty 4.0 and 4.1 version in this convention
251+
// intentionally aligning netty 4.0 versions in this convention
257252
matchFileNames: [
258253
'conventions/src/main/kotlin/otel.java-conventions.gradle.kts',
259254
],
260255
matchPackageNames: [
261256
'io.netty:netty-bom',
262257
],
263-
matchUpdateTypes: [
264-
'major',
265-
'minor',
258+
matchCurrentVersion: '/^4\\.0\\./',
259+
allowedVersions: '/^4\\.0\\./',
260+
},
261+
{
262+
// intentionally aligning netty 4.1 versions in this convention
263+
matchFileNames: [
264+
'conventions/src/main/kotlin/otel.java-conventions.gradle.kts',
266265
],
267-
enabled: false,
266+
matchPackageNames: [
267+
'io.netty:netty-bom',
268+
],
269+
matchCurrentVersion: '/^4\\.1\\./',
270+
allowedVersions: '/^4\\.1\\./',
268271
},
269272
{
270273
// intentionally using scala 2.11 in otel.scala-conventions.gradle.kts
@@ -274,14 +277,10 @@
274277
matchPackageNames: [
275278
'org.scala-lang:scala-library',
276279
],
277-
matchUpdateTypes: [
278-
'major',
279-
'minor',
280-
],
281-
enabled: false,
280+
allowedVersions: '/^2\.11\./',
282281
},
283282
{
284-
// intentionally using Java 11 in some examples
283+
// intentionally testing against specific major Java versions
285284
matchPackageNames: [
286285
'eclipse-temurin',
287286
],
@@ -319,14 +318,10 @@
319318
matchFileNames: [
320319
'dependencyManagement/build.gradle.kts',
321320
],
322-
matchUpdateTypes: [
323-
'major',
324-
'minor',
325-
],
326-
enabled: false,
327321
matchPackageNames: [
328322
'ch.qos.logback:**',
329323
],
324+
allowedVersions: '/^1\.3\./',
330325
},
331326
{
332327
// intentionally using Spring Boot 2 in dependency management (for Java 8 support)
@@ -370,6 +365,17 @@
370365
depNameTemplate: 'java',
371366
extractVersionTemplate: '^(?<version>\\d+)',
372367
},
368+
{
369+
customType: 'regex',
370+
datasourceTemplate: 'docker',
371+
managerFilePatterns: [
372+
'**/build.gradle.kts',
373+
],
374+
matchStrings: [
375+
'"(?<depName>eclipse-temurin):(?<currentValue>[^"@]+)@(?<currentDigest>sha256:[0-9a-f]+)"',
376+
'"(?<depName>ibm-semeru-runtimes):(?<currentValue>[^"@]+)@(?<currentDigest>sha256:[0-9a-f]+)"',
377+
],
378+
},
373379
{
374380
customType: 'regex',
375381
datasourceTemplate: 'pypi',

conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ plugins {
66
id("io.opentelemetry.instrumentation.javaagent-shadowing")
77
}
88

9+
val failOnContextLeakProperty = providers.gradleProperty("failOnContextLeak")
10+
.map { it != "false" }
11+
.orElse(true)
12+
13+
val testIndyProperty = providers.gradleProperty("testIndy")
14+
.map { it == "true" }
15+
.orElse(false)
16+
917
val denyUnsafe = gradle.startParameter.projectProperties["denyUnsafe"] == "true"
1018
extra["denyUnsafe"] = denyUnsafe
1119

@@ -74,6 +82,15 @@ class JavaagentTestArgumentsProvider(
7482
@InputFile
7583
@PathSensitive(PathSensitivity.RELATIVE)
7684
val shadowJar: File,
85+
86+
@get:Input
87+
val failOnContextLeak: Boolean,
88+
89+
@get:Input
90+
val testIndy: Boolean,
91+
92+
@get:Input
93+
val denyUnsafe: Boolean,
7794
) : CommandLineArgumentProvider {
7895
override fun asArguments(): Iterable<String> {
7996
val list = mutableListOf(
@@ -83,13 +100,13 @@ class JavaagentTestArgumentsProvider(
83100
"-Dotel.javaagent.testing.javaagent-jar-path=${agentShadowJar.absolutePath}",
84101
"-Dotel.javaagent.experimental.initializer.jar=${shadowJar.absolutePath}",
85102
"-Dotel.javaagent.testing.additional-library-ignores.enabled=false",
86-
"-Dotel.javaagent.testing.fail-on-context-leak=${findProperty("failOnContextLeak") != false}",
103+
"-Dotel.javaagent.testing.fail-on-context-leak=$failOnContextLeak",
87104
// prevent sporadic gradle deadlocks, see SafeLogger for more details
88105
"-Dotel.javaagent.testing.transform-safe-logging.enabled=true",
89106
// Reduce noise in assertion messages since we don't need to verify this in most tests. We check
90107
// in smoke tests instead.
91108
"-Dotel.javaagent.add-thread-details=false",
92-
"-Dotel.javaagent.experimental.indy=${findProperty("testIndy") == "true"}",
109+
"-Dotel.javaagent.experimental.indy=$testIndy",
93110
// suppress repeated logging of "No metric data to export - skipping export."
94111
// since PeriodicMetricReader is configured with a short interval
95112
"-Dio.opentelemetry.javaagent.slf4j.simpleLogger.log.io.opentelemetry.sdk.metrics.export.PeriodicMetricReader=INFO",
@@ -123,22 +140,26 @@ afterEvaluate {
123140
// this dependency.
124141
dependsOn(agentForTesting.buildDependencies)
125142

143+
val failOnContextLeakOverride = failOnContextLeakProperty.get()
144+
val testIndyEnabled = testIndyProperty.get()
145+
126146
jvmArgumentProviders.add(
127147
JavaagentTestArgumentsProvider(
128148
agentShadowJar,
129-
shadowJar.archiveFile.get().asFile
149+
shadowJar.archiveFile.get().asFile,
150+
failOnContextLeakOverride,
151+
testIndyEnabled,
152+
denyUnsafe
130153
)
131154
)
132155

133156
// We do fine-grained filtering of the classpath of this codebase's sources since Gradle's
134157
// configurations will include transitive dependencies as well, which tests do often need.
158+
val mainResourcesDir = project.layout.buildDirectory.dir("resources/main").get().asFile.absoluteFile
159+
val mainClassesDir = project.layout.buildDirectory.dir("classes/java/main").get().asFile.absoluteFile
160+
135161
classpath = classpath.filter {
136-
if (file(layout.buildDirectory.dir("resources/main")).equals(it) || file(
137-
layout.buildDirectory.dir(
138-
"classes/java/main"
139-
)
140-
).equals(it)
141-
) {
162+
if (it.absoluteFile == mainResourcesDir || it.absoluteFile == mainClassesDir) {
142163
// The sources are packaged into the testing jar, so we need to exclude them from the test
143164
// classpath, which automatically inherits them, to ensure our shaded versions are used.
144165
return@filter false

dependencyManagement/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ val DEPENDENCIES = listOf(
9595
"commons-io:commons-io:2.21.0",
9696
"commons-lang:commons-lang:2.6",
9797
"commons-logging:commons-logging:1.3.5",
98-
"commons-validator:commons-validator:1.10.0",
98+
"commons-validator:commons-validator:1.10.1",
9999
"io.netty:netty:3.10.6.Final",
100100
"io.opentelemetry.contrib:opentelemetry-azure-resources:${otelContribVersion}",
101101
"io.opentelemetry.contrib:opentelemetry-aws-resources:${otelContribVersion}",

docs/supported-libraries.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ These are the supported libraries and frameworks:
9696
| [JBoss Log Manager](https://github.com/jboss-logging/jboss-logmanager) | 1.1+ | N/A | none |
9797
| [JDBC](https://docs.oracle.com/javase/8/docs/api/java/sql/package-summary.html) | Java 8+ | [opentelemetry-jdbc](../instrumentation/jdbc/library) | [Database Client Spans], [Database Client Metrics]&nbsp;[6] |
9898
| [Jedis](https://github.com/xetorthio/jedis) | 1.4+ | N/A | [Database Client Spans], [Database Client Metrics]&nbsp;[6] |
99+
| [JFinal](https://github.com/jfinal/jfinal) | 3.2+ | N/A | Provides `http.route` [2], Controller Spans [3] |
99100
| [JMS](https://javaee.github.io/javaee-spec/javadocs/javax/jms/package-summary.html) | 1.1+ | N/A | [Messaging Spans] |
100101
| [Jodd Http](https://http.jodd.org/) | 4.2+ | N/A | [HTTP Client Spans], [HTTP Client Metrics] |
101102
| [JSP](https://javaee.github.io/javaee-spec/javadocs/javax/servlet/jsp/package-summary.html) | 2.3.x only | N/A | Controller Spans [3] |

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/EmittedMetricsParser.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
package io.opentelemetry.instrumentation.docs.parsers;
77

8+
import static io.opentelemetry.instrumentation.docs.parsers.TelemetryParser.normalizeWhenCondition;
9+
810
import com.fasterxml.jackson.core.JsonProcessingException;
911
import io.opentelemetry.instrumentation.docs.internal.EmittedMetrics;
1012
import io.opentelemetry.instrumentation.docs.utils.FileManager;
@@ -62,8 +64,7 @@ private static Map<String, List<EmittedMetrics.MetricsByScope>> parseAllMetricFi
6264
path -> {
6365
String content = FileManager.readFileToString(path.toString());
6466
if (content != null) {
65-
String when = content.substring(0, content.indexOf('\n'));
66-
String whenKey = when.replace("when: ", "");
67+
String whenKey = normalizeWhenCondition(content);
6768

6869
int metricsIndex = content.indexOf("metrics_by_scope:");
6970
if (metricsIndex != -1) {

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/EmittedSpanParser.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
package io.opentelemetry.instrumentation.docs.parsers;
77

8+
import static io.opentelemetry.instrumentation.docs.parsers.TelemetryParser.normalizeWhenCondition;
9+
810
import com.fasterxml.jackson.core.JsonProcessingException;
911
import io.opentelemetry.instrumentation.docs.internal.EmittedSpans;
1012
import io.opentelemetry.instrumentation.docs.internal.TelemetryAttribute;
@@ -49,8 +51,7 @@ public static Map<String, EmittedSpans> getSpansByScopeFromFiles(
4951
path -> {
5052
String content = FileManager.readFileToString(path.toString());
5153
if (content != null) {
52-
String when = content.substring(0, content.indexOf('\n'));
53-
String whenKey = when.replace("when: ", "");
54+
String whenKey = normalizeWhenCondition(content);
5455

5556
spansByScope.putIfAbsent(whenKey, new StringBuilder("spans_by_scope:\n"));
5657

@@ -64,7 +65,8 @@ public static Map<String, EmittedSpans> getSpansByScopeFromFiles(
6465
}
6566
});
6667
} catch (IOException e) {
67-
logger.severe("Error reading span files: " + e.getMessage());
68+
logger.severe(
69+
"Error reading span files from " + instrumentationDirectory + ": " + e.getMessage());
6870
}
6971
}
7072

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/SpanParser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class SpanParser {
2626
// We want to ignore test related attributes
2727
private static final List<String> EXCLUDED_ATTRIBUTES =
2828
List.of(
29+
"asdf",
2930
"x-test-",
3031
"test-baggage-",
3132
"test_message",

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/TelemetryParser.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,25 @@ static boolean scopeIsValid(String telemetryScope, String moduleScope) {
7373
|| scopeAllowList.getOrDefault(moduleScope, emptySet()).contains(telemetryScope);
7474
}
7575

76+
/**
77+
* Normalizes the 'when' condition from the given content by stripping quotes and whitespace.
78+
*
79+
* @param content the content containing the 'when' condition
80+
* @return normalized when condition
81+
*/
82+
static String normalizeWhenCondition(String content) {
83+
if (content == null) {
84+
return "";
85+
}
86+
87+
String when = content.substring(0, content.indexOf('\n'));
88+
String whenCondition = when.replace("when: ", "").strip();
89+
// Remove surrounding quotes if present (to avoid double-quoting in output)
90+
if (whenCondition.startsWith("\"") && whenCondition.endsWith("\"")) {
91+
whenCondition = whenCondition.substring(1, whenCondition.length() - 1);
92+
}
93+
return whenCondition;
94+
}
95+
7696
private TelemetryParser() {}
7797
}

instrumentation-docs/src/test/java/io/opentelemetry/instrumentation/docs/parsers/EmittedMetricsParserTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.junit.jupiter.api.io.TempDir;
2222
import org.mockito.MockedStatic;
2323

24-
@SuppressWarnings("NullAway")
2524
class EmittedMetricsParserTest {
2625

2726
@Test

0 commit comments

Comments
 (0)