Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/auto-spotless-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up Gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand All @@ -48,7 +48,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up Gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up Gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ jobs:
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Set up Java 17
- name: Set up Java
if: matrix.language == 'java'
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
if: matrix.language == 'java'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/owasp-dependency-check-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Increase gradle daemon heap size
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down Expand Up @@ -234,7 +234,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up Gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Pull requests for bug fixes are always welcome!

## Building and Testing

While most modules target Java 8, building this project requires Java 17 or higher.
While most modules target Java 8, building this project requires Java 21 or higher.

To build the project:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;

/** A simple HTTP client based on OkHttp. Not meant for high throughput. */
final class SimpleHttpClient {
Expand Down Expand Up @@ -83,8 +82,7 @@ public String fetchString(
+ response.message());
return "";
}
ResponseBody body = response.body();
return body != null ? body.string() : "";
return response.body().string();
} catch (IOException e) {
logger.log(FINE, "SimpleHttpClient fetch string failed.", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;

final class XraySamplerClient {

Expand Down Expand Up @@ -125,11 +124,7 @@ private static String readResponse(Response response, String endpoint) throws IO
return "";
}

ResponseBody body = response.body();
if (body != null) {
return body.string();
}
return "";
return response.body().string();
}

// Visible for testing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ tasks {

// TODO (trask) use animal sniffer
disable("Java8ApiChecker")
disable("AndroidJdkLibsChecker")

// apparently disabling android doesn't disable this
disable("StaticOrDefaultInterfaceMethod")
Expand Down
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ group = "io.opentelemetry.contrib"
base.archivesName.set("opentelemetry-${project.name}")

// Version to use to compile code and run tests.
val DEFAULT_JAVA_VERSION = JavaVersion.VERSION_17
val DEFAULT_JAVA_VERSION = JavaVersion.VERSION_21

java {
toolchain {
Expand Down Expand Up @@ -60,6 +60,7 @@ tasks {
if (name.contains("Test")) {
// serialVersionUI is basically guaranteed to be useless in tests
compilerArgs.add("-Xlint:-serial")
compilerArgs.add("-Xlint:-this-escape")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ConsistentVariableThresholdSampler extends ConsistentThresholdSampl
private volatile String description = "";

protected ConsistentVariableThresholdSampler(double samplingProbability) {
setSamplingProbability(samplingProbability);
updateSamplingProbability(samplingProbability);
}

@Override
Expand All @@ -30,6 +30,10 @@ public long getThreshold() {
}

public void setSamplingProbability(double samplingProbability) {
updateSamplingProbability(samplingProbability);
}

private void updateSamplingProbability(double samplingProbability) {
long threshold = calculateThreshold(samplingProbability);
checkThreshold(threshold);
this.threshold = threshold;
Expand Down
4 changes: 2 additions & 2 deletions dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ dependencies {
api("com.google.auto.service:auto-service-annotations:1.1.1")
api("com.google.auto.value:auto-value:1.11.0")
api("com.google.auto.value:auto-value-annotations:1.11.0")
api("com.google.errorprone:error_prone_annotations:2.42.0")
api("com.google.errorprone:error_prone_core:2.42.0")
api("com.google.errorprone:error_prone_annotations:2.43.0")
api("com.google.errorprone:error_prone_core:2.43.0")
api("io.github.netmikey.logunit:logunit-jul:2.0.0")
api("io.opentelemetry.proto:opentelemetry-proto:1.8.0-alpha")
api("io.prometheus:simpleclient:0.16.0")
Expand Down
14 changes: 14 additions & 0 deletions disk-buffering/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ tasks.named<ShadowJar>("shadowJar") {
mustRunAfter("jar")
}

tasks {
test {
dependsOn("shadowJar")
}
}

// The javadoc from wire's generated classes has errors that make the task that generates the "javadoc" artifact to fail. This
// makes the javadoc task to ignore those generated classes.
tasks.withType(Javadoc::class.java) {
Expand All @@ -75,3 +81,11 @@ tasks.withType(Javadoc::class.java) {
tasks.named("sourcesJar", Jar::class.java) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

tasks.withType<JavaCompile>().configureEach {
with(options) {
// classes generated from proto trigger
// warning: [serial] non-transient instance field of a serializable class declared with a non-serializable type
compilerArgs.add("-Xlint:-serial")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public class SamplingProfiler implements Runnable {
* @param activationEventsFile activation events file, if {@literal null} a temp file will be used
* @param jfrFile java flight recorder file, if {@literal null} a temp file will be used instead
*/
@SuppressWarnings("this-escape")
public SamplingProfiler(
InferredSpansConfiguration config,
SpanAnchoredClock nanoClock,
Expand Down
12 changes: 10 additions & 2 deletions opamp-client/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import java.io.FileOutputStream
import java.io.InputStream
import java.net.URL
import java.net.URI

plugins {
id("otel.java-conventions")
Expand Down Expand Up @@ -38,6 +38,14 @@ wire {
}
}

tasks.withType<JavaCompile>().configureEach {
with(options) {
// classes generated from proto trigger
// warning: [serial] non-transient instance field of a serializable class declared with a non-serializable type
compilerArgs.add("-Xlint:-serial")
}
}

abstract class DownloadAndExtractOpampProtos @Inject constructor(
private val archiveOps: ArchiveOperations,
private val fileOps: FileSystemOperations,
Expand All @@ -54,7 +62,7 @@ abstract class DownloadAndExtractOpampProtos @Inject constructor(

@TaskAction
fun execute() {
val url = URL(zipUrl.get())
val url = URI.create(zipUrl.get()).toURL()
downloadedZipFile.get().asFile.parentFile.mkdirs()

url.openStream().use { input: InputStream ->
Expand Down