Skip to content

Commit

Permalink
Merge remote-tracking branch 'elastic/main' into inferred-spans-upstream
Browse files Browse the repository at this point in the history
# Conflicts:
#	inferred-spans/build.gradle.kts
  • Loading branch information
JonasKunz committed Aug 19, 2024
2 parents 577f4f2 + 08683ac commit c607606
Show file tree
Hide file tree
Showing 41 changed files with 592 additions and 493 deletions.
15 changes: 0 additions & 15 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,3 @@ updates:
github-actions:
patterns:
- "*"

# Gradle
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
ignore:
# upstream dependencies that need to be updated in sync and with manual control
- dependency-name: "io.opentelemetry.javaagent:*"
- dependency-name: "io.opentelemetry.instrumentation:*"
- dependency-name: "io.opentelemetry.contrib:*"
- dependency-name: "io.opentelemetry:*"
# Newer Mockito versions don't support java 8 anymore
- dependency-name: "org.mockito:mockito-core"
4 changes: 2 additions & 2 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
username: ${{ github.actor }}
token: ${{ secrets.APM_TECH_USER_TOKEN }}
- name: Add community and triage lables
if: contains(steps.is_elastic_member.outputs.result, 'false') && github.actor != 'dependabot[bot]'
if: contains(steps.is_elastic_member.outputs.result, 'false') && github.actor != 'dependabot[bot]' && github.actor != 'elastic-renovate-prod[bot]'
uses: actions/github-script@v7
with:
script: |
Expand All @@ -41,7 +41,7 @@ jobs:
labels: ["community", "triage"]
})
- name: Add comment for community PR
if: contains(steps.is_elastic_member.outputs.result, 'false') && github.actor != 'dependabot[bot]'
if: contains(steps.is_elastic_member.outputs.result, 'false') && github.actor != 'dependabot[bot]' && github.actor != 'elastic-renovate-prod[bot]'
uses: wow-actions/auto-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-step-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:
- name: Build and push image
id: push
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 # v6.6.1
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
context: .
file: "docker/Dockerfile"
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Elastic Distribution for OpenTelemetry Java
Elastic Distribution of OpenTelemetry Java
Copyright 2023-2024 Elasticsearch B.V.

This project is licensed under the Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0
Expand Down
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# Elastic Distribution for OpenTelemetry Java
# Elastic Distribution of OpenTelemetry Java

[![Snapshot status](https://badge.buildkite.com/e527255a5d6e7f5a940bc71911d8bc2be25d16702d7642c0d6.svg)](https://buildkite.com/elastic/elastic-otel-java-snapshot)
[![Release status](https://badge.buildkite.com/8bac74f475ea0d5d17ea3ea2ecf2c27a319414b97ce03dbd21.svg)](https://buildkite.com/elastic/elastic-otel-java-release)

This project is the Elastic distribution of the [OpenTelemetry Java agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation).
> [!WARNING]
> The Elastic Distribution of OpenTelemetry Java is not yet recommended for production use. Functionality may be changed or removed in future releases. Alpha releases are not subject to the support SLA of official GA features.
>
> We welcome your feedback! You can reach us by [opening a GitHub issue](https://github.com/elastic/elastic-otel-java/issues) or starting a discussion thread on the [Elastic Discuss forum](https://discuss.elastic.co/tags/c/observability/apm/58/java).
This is currently an early alpha release and should be used mostly for testing.
The Elastic Distribution of OpenTelemetry Java (EDOT Java) is a customized version of the [OpenTelemetry Java agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation). Use EDOT Java to start the OpenTelemetry SDK with your Java application, and automatically capture tracing data, performance metrics, and logs. Traces, metrics, and logs can be sent to any OpenTelemetry Protocol (OTLP) collector you choose.

With EDOT Java you have access to all the features of the OpenTelemetry Java agent plus:

* Access to SDK improvements and bug fixes contributed by the Elastic team _before_ the changes are available upstream in OpenTelemetry repositories.
* Access to optional features that can enhance OpenTelemetry data that is being sent to Elastic (for example, [inferred spans](#inferred-spans) and [span stacktrace](#span-stacktrace)).

**Ready to try out EDOT Java?** Follow the step-by-step instructions in [Get started](./docs/get-started.md).

## Download

Expand All @@ -21,6 +31,13 @@ Use the `-javaagent:` JVM argument with the path to agent jar.
java -javaagent:/path/to/agent.jar \
-jar myapp.jar
```

## Read the docs

* [Get started](./docs/get-started.md)
* [Configure the Elastic Distribution of OpenTelemetry Java](./docs/configure.md)
* [Migrate to the Elastic Distribution of OpenTelemetry Java](./docs/migrate.md) from the [Elastic APM Java agent](https://github.com/elastic/apm-agent-java)

## Build and Test

Execute `./gradlew assemble`, the agent binary will be in `./agent/build/libs/elastic-otel-javaagent-${VERSION}.jar`
Expand Down Expand Up @@ -111,5 +128,5 @@ if(ctx.numeric_labels != null && ctx.numeric_labels.elastic_span_self_time != nu

# License

The Elastic Distribution for OpenTelemetry Java is licensed under [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html).
The Elastic Distribution of OpenTelemetry Java is licensed under [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html).

4 changes: 2 additions & 2 deletions agent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
alias(catalog.plugins.licenseReport)
}

description = "Elastic Distribution for OpenTelemetry Java Agent"
description = "Elastic Distribution of OpenTelemetry Java Agent"

base.archivesName.set("elastic-otel-javaagent")

Expand Down Expand Up @@ -92,7 +92,7 @@ tasks {
var year = Calendar.getInstance().get(Calendar.YEAR)
var lines = ArrayList<String>(
listOf(
"Elastic Distribution for OpenTelemetry Java",
"Elastic Distribution of OpenTelemetry Java",
"Copyright 2023-${year} Elasticsearch B.V.",
"",
"This project is licensed under the Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0",
Expand Down
2 changes: 1 addition & 1 deletion agent/entrypoint/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("java")
id("elastic-otel.java-conventions")
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion agentextension/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("java")
id("elastic-otel.java-conventions")
id("elastic-otel.sign-and-publish-conventions")
id("com.github.johnrengelman.shadow")
}
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
java
id("elastic-otel.java-conventions")
}

dependencies {
Expand Down
127 changes: 0 additions & 127 deletions build.gradle

This file was deleted.

54 changes: 54 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import java.io.FileInputStream
import java.nio.file.Paths
import java.nio.file.Files
import java.nio.file.StandardCopyOption

plugins {
alias(catalog.plugins.nexusPublish)
}

val versionProperties = java.util.Properties()
versionProperties.load(FileInputStream(file("version.properties")))

group = "co.elastic.otel"
version = versionProperties.get("version").toString()
description = "Elastic Distribution of OpenTelemetry Java"

defaultTasks("agent:assemble")

subprojects {
group = rootProject.group
version = rootProject.version
}

nexusPublishing {
repositories {
sonatype()
}
}

tasks {

register("currentVersion") {
doLast {
println(project.version)
}
}

register("setVersion") {
doLast {
val versionFile = file("version.properties")
versionFile.writeText("version=${project.property("newVersion")}\n")
}
}

register("setNextVersion") {
doLast {
val semVer = "\\d+\\.\\d+\\.\\d+".toRegex().find(version.toString())!!.value;
val nums = semVer.split('.');

val versionFile = file("version.properties")
versionFile.writeText("version=${nums[0]}.${nums[1]}.${nums[2].toInt() + 1}-SNAPSHOT\n")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.objectweb.asm.ClassWriter
import org.objectweb.asm.Opcodes

plugins {
id("java")
id("elastic-otel.java-conventions")
id("com.github.johnrengelman.shadow")
}

Expand Down
55 changes: 51 additions & 4 deletions buildSrc/src/main/kotlin/elastic-otel.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,59 @@
plugins {
id("java")
java
id("elastic-otel.spotless-conventions")
}

java {
withJavadocJar()
withSourcesJar()
}

repositories {
mavenLocal()
mavenCentral()
maven {
name = "mavenCentralSnapshots"
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}
}

//https://github.com/gradle/gradle/issues/15383
val catalog = extensions.getByType<VersionCatalogsExtension>().named("catalog")
dependencies {

implementation(platform(catalog.findLibrary("opentelemetryInstrumentationAlphaBom").get()))

annotationProcessor(catalog.findLibrary("autoservice.processor").get())
compileOnly(catalog.findLibrary("autoservice.annotations").get())
compileOnly(catalog.findLibrary("findbugs.jsr305").get())

testAnnotationProcessor(catalog.findLibrary("autoservice.processor").get())
testCompileOnly(catalog.findLibrary("autoservice.annotations").get())
testCompileOnly(catalog.findLibrary("findbugs.jsr305").get())
testImplementation(catalog.findLibrary("assertj.core").get())
testImplementation(catalog.findLibrary("awaitility").get())
testImplementation(catalog.findLibrary("mockito").get())
testImplementation(enforcedPlatform(catalog.findLibrary("junitBom").get()))
testImplementation("org.junit.jupiter:junit-jupiter")
}

tasks {
test {
useJUnitPlatform()
}

compileJava {
options.release.set(8)
}
compileTestJava {
options.release.set(8)
}
}


interface JavaVersionTestingExtension {
/**
* By default the convention will publish the artifacts and pom as libraries.
* To override the behaviour provide the tasks producing the artifacts as this property.
* This should only be required when publishing fat-jars with custom packaging.
* This option can be set to false to disable testing with openj9 on this project
*/
val enableTestsOnOpenJ9: Property<Boolean>
}
Expand Down
Loading

0 comments on commit c607606

Please sign in to comment.