Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 14 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ ij_groovy_while_brace_force = never
ij_groovy_while_on_new_line = false
ij_groovy_wrap_long_lines = false

[{*.kt, *.kts}]
[*.{kt,kts}]
ij_continuation_indent_size = 2
ij_kotlin_align_in_columns_case_branch = false
ij_kotlin_align_multiline_binary_operation = false
Expand Down Expand Up @@ -761,3 +761,16 @@ ij_properties_spaces_around_key_value_delimiter = false
[{*.yaml, *.yml}]
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_line_breaks = true

# ktlint overrides (mirrors otel.spotless-conventions.gradle.kts)
[*.{kt,kts}]
max_line_length = 160
continuation_indent_size = 2
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_package-name = disabled
ktlint_standard_max-line-length = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_wrapping = disabled
ktlint_standard_property-naming = disabled
ktlint_standard_function-literal = disabled
5 changes: 5 additions & 0 deletions .github/config/.rumdl.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[MD013]
enabled = true
line-length = 120
code-blocks = false
tables = false
6 changes: 6 additions & 0 deletions .github/config/.yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends: relaxed

rules:
document-start: disable
line-length: disable
indentation: warning
15 changes: 15 additions & 0 deletions .github/config/flint.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[settings]
exclude = [
"gradlew",
"buildscripts/spotless.license.java",
"CHANGELOG.md",
"licenses/licenses.md",
]

[checks.license-header]
text = """
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/"""
patterns = ["**/*.java", "**/*.kt"]
1 change: 1 addition & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
extends: [
"github>grafana/flint#v0.20.4",
'config:best-practices',
'helpers:pinGitHubActionDigestsToSemver',
':semanticCommits',
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/build-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ jobs:
muzzle:
uses: ./.github/workflows/reusable-muzzle.yml

link-check:
uses: ./.github/workflows/reusable-link-check.yml

markdown-lint-check:
uses: ./.github/workflows/reusable-markdown-lint-check.yml
lint:
uses: ./.github/workflows/reusable-lint-check.yml

publish-snapshots:
environment: protected
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,11 @@ jobs:
with:
cache-read-only: true

# this is not a required check to avoid blocking pull requests if external links break
markdown-check:
lint:
# release branches are excluded because the README.md javaagent download link has to be updated
# on release branches before the release download has been published
if: "!startsWith(github.ref_name, 'release/') && !startsWith(github.base_ref, 'release/')"
uses: ./.github/workflows/reusable-link-check.yml

markdown-lint-check:
uses: ./.github/workflows/reusable-markdown-lint-check.yml
uses: ./.github/workflows/reusable-lint-check.yml

required-status-check:
# test-latest-deps is not included in the required status checks
Expand All @@ -63,7 +59,7 @@ jobs:
needs:
- common
- muzzle
- markdown-lint-check
- lint
runs-on: ubuntu-latest
if: always()
steps:
Expand All @@ -73,7 +69,7 @@ jobs:
!startsWith(github.base_ref, 'release/') &&
(
needs.muzzle.result != 'success' ||
needs.markdown-lint-check.result != 'success'
needs.lint.result != 'success'
)
)
run: exit 1 # fail
14 changes: 4 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,8 @@ jobs:
if: "!startsWith(github.ref_name, 'release/')"
uses: ./.github/workflows/reusable-muzzle.yml

link-check:
# release branches are excluded to avoid unnecessary maintenance if external links break
# (and also because the README.md javaagent download link has to be updated on release branches
# before the release download has been published)
lint:
# release branches are excluded because the README.md javaagent download link has to be updated
# on release branches before the release download has been published
if: "!startsWith(github.ref_name, 'release/')"
uses: ./.github/workflows/reusable-link-check.yml

markdown-lint-check:
# release branches are excluded
if: "!startsWith(github.ref_name, 'release/')"
uses: ./.github/workflows/reusable-markdown-lint-check.yml
uses: ./.github/workflows/reusable-lint-check.yml
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0

- name: Setup mise
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
with:
version: v2026.4.18
sha256: 6ae2d5f0f23a2f2149bc5d9bf264fe0922a1da843f1903e453516c462b23cc1f

- name: Lint
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: mise run lint
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Reusable - Link check
name: Reusable - Lint check

on:
workflow_call:
Expand All @@ -7,7 +7,7 @@ permissions:
contents: read

jobs:
link-check:
lint-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand All @@ -16,16 +16,16 @@ jobs:

- uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1

- name: Link check for pull requests
- name: Lint for pull requests
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
run: mise run lint:links
run: mise run lint

- name: Link check for pushes and scheduled workflows
- name: Lint for pushes and scheduled workflows
if: github.event_name != 'pull_request'
env:
GITHUB_TOKEN: ${{ github.token }}
run: mise run lint:links --full
run: mise run lint
23 changes: 0 additions & 23 deletions .github/workflows/reusable-markdown-lint-check.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .markdownlint.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions .mise/tasks/lint/markdown.sh

This file was deleted.

24 changes: 14 additions & 10 deletions benchmark-overhead-jmh/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,27 @@ tasks {
// -Pjmh.startFlightRecording=settings=profile.jfc,delay=50s,duration=50s,filename=output.jfr
// since each iteration is 10 seconds, the flight recording produced will approximately cover the
// (post-warmup) benchmarking iterations
val jmhStartFlightRecording = gradle.startParameter.projectProperties.get("jmh.startFlightRecording")
val jmhStartFlightRecording =
gradle.startParameter.projectProperties.get(
"jmh.startFlightRecording",
)

named<JMHTask>("jmh") {
val shadowTask = project(":javaagent").tasks.named<Jar>("shadowJar").get()
inputs.files(layout.files(shadowTask))

// note: without an exporter, toSpanData() won't even be called
// (which is good for benchmarking the instrumentation itself)
val args = mutableListOf(
"-javaagent:${shadowTask.archiveFile.get()}",
"-Dotel.traces.exporter=none",
"-Dotel.metrics.exporter=none",
"-Dotel.logs.exporter=none",
// avoid instrumenting HttpURLConnection for now since it is used to make the requests
// and this benchmark is focused on servlet overhead for now
"-Dotel.instrumentation.http-url-connection.enabled=false",
)
val args =
mutableListOf(
"-javaagent:${shadowTask.archiveFile.get()}",
"-Dotel.traces.exporter=none",
"-Dotel.metrics.exporter=none",
"-Dotel.logs.exporter=none",
// avoid instrumenting HttpURLConnection for now since it is used to make the requests
// and this benchmark is focused on servlet overhead for now
"-Dotel.instrumentation.http-url-connection.enabled=false",
)
if (jmhStartFlightRecording != null) {
args.addAll(
listOf(
Expand Down
5 changes: 4 additions & 1 deletion benchmark-overhead/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ plugins {
spotless {
java {
googleJavaFormat()
licenseHeaderFile(rootProject.file("../buildscripts/spotless.license.java"), "(package|import|public)")
licenseHeaderFile(
rootProject.file("../buildscripts/spotless.license.java"),
"(package|import|public)",
)
target("src/**/*.java")
}
}
Expand Down
2 changes: 1 addition & 1 deletion benchmark-overhead/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = "opentelemetry-agent-overhead-test"
rootProject.name = "opentelemetry-agent-overhead-test"
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

package io.opentelemetry;

import static java.util.concurrent.TimeUnit.SECONDS;
import static java.util.concurrent.TimeUnit.MILLISECONDS;

import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.Assertions.fail;
import static org.junit.jupiter.api.DynamicTest.dynamicTest;

Expand All @@ -29,7 +28,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
Expand Down Expand Up @@ -145,15 +143,15 @@ private void doWarmupPhase(TestConfig testConfig, GenericContainer<?> petclinic)
};
petclinic.execInContainer(startCommand);

long deadline =
System.currentTimeMillis() + SECONDS.toMillis(testConfig.getWarmupSeconds());
long deadline = System.currentTimeMillis() + SECONDS.toMillis(testConfig.getWarmupSeconds());
while (System.currentTimeMillis() < deadline) {
GenericContainer<?> k6 =
new GenericContainer<>(DockerImageName.parse("grafana/k6"))
.withNetwork(NETWORK)
.withCopyFileToContainer(MountableFile.forHostPath("./k6"), "/app")
.withCommand("run", "-u", "5", "-i", "200", "/app/basic.js")
.withStartupCheckStrategy(new OneShotStartupCheckStrategy().withTimeout(Duration.ofMinutes(5)));
.withStartupCheckStrategy(
new OneShotStartupCheckStrategy().withTimeout(Duration.ofMinutes(5)));
k6.start();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ Optional<Path> resolve() throws IOException {
Path localJavaagentPath = findLocalJavaagentJar();

if (localJavaagentPath == null || !Files.exists(localJavaagentPath)) {
throw new IOException("Local javaagent JAR not found. Please run './gradlew :javaagent:assemble' from the project root first.");
throw new IOException(
"Local javaagent JAR not found. Please run './gradlew :javaagent:assemble' from the"
+ " project root first.");
}

logger.info("Using local javaagent JAR: {}", localJavaagentPath);
Expand Down Expand Up @@ -66,13 +68,16 @@ private Path findJavaagentJarInDirectory(Path directory) {

try {
return Files.list(directory)
.filter(path -> {
String filename = path.getFileName().toString();
// Look for the main jar: opentelemetry-javaagent-VERSION.jar (no additional suffixes)
return filename.startsWith("opentelemetry-javaagent-") &&
filename.endsWith(".jar") &&
!filename.matches(".*-[a-z]+\\.jar"); // excludes anything with -word.jar pattern
})
.filter(
path -> {
String filename = path.getFileName().toString();
// Look for the main jar: opentelemetry-javaagent-VERSION.jar (no additional
// suffixes)
return filename.startsWith("opentelemetry-javaagent-")
&& filename.endsWith(".jar")
&& !filename.matches(
".*-[a-z]+\\.jar"); // excludes anything with -word.jar pattern
})
.findFirst()
.orElse(null);
} catch (IOException e) {
Expand All @@ -81,4 +86,3 @@ private Path findJavaagentJarInDirectory(Path directory) {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

package io.opentelemetry.results;

import static java.util.stream.Collectors.toList;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
import static java.util.stream.Collectors.toList;

import java.io.IOException;
import java.nio.file.Files;
Expand Down
Loading
Loading