Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add jvm daemon threads instrumentation #6561

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d61af21
add jvm daemon threads instrumentation
Sep 8, 2022
8ac94a4
reformat
Sep 8, 2022
1577f76
update unit test
Sep 8, 2022
c657677
update unit test
Sep 8, 2022
738e02c
reformat
Sep 9, 2022
2b528fc
Use daemon attribute to distinguish between daemon and non-daemon thr…
Sep 13, 2022
f5fafcd
update unit test
Sep 13, 2022
8972d74
import package
Sep 13, 2022
8008178
update example for process.runtime.jvm.threads.count
Sep 13, 2022
8ffcaa2
update websphere link
Sep 15, 2022
e10bb59
Add mongo sanitization configuration (#6541)
trask Sep 8, 2022
27ffc6a
Use micrometer library instrumentation in agent (#6560)
jack-berg Sep 8, 2022
afe323f
Add gradle plugin for SDK extensions (#6558)
Sep 8, 2022
f21aa70
Add release cadence (#6565)
trask Sep 9, 2022
ad44de9
Remove a method from instrumenter api (#6570)
trask Sep 9, 2022
a95f178
Stabilize instrumentation-api and introduce jApiCmp checks (#6566)
Sep 9, 2022
654cd5e
Update to otel 1.18.0 (#6575)
trask Sep 11, 2022
e259a1d
Introduce non-alpha bom (#6576)
trask Sep 11, 2022
664ec82
Move extractFromRequest() to internal (#6585)
trask Sep 12, 2022
ef2792f
Rename ErrorCauseExtractor.jdk() to getDefault() (#6580)
trask Sep 12, 2022
29bd87e
Rename two package-private instrumenter-api classes (#6579)
trask Sep 12, 2022
24cc82d
Fix jApiCmp CI check (#6577)
trask Sep 12, 2022
314d01c
Net attributes getters changes (in preparation for HTTP spec impl) (#…
Sep 12, 2022
d486641
Fix CI (#6594)
trask Sep 12, 2022
b3c938b
Remove agent's Ordered interface and use the SDK one (#6589)
Sep 12, 2022
dc9ac47
Encapsulate logging (#6543)
Sep 12, 2022
4b68c1b
Fix instrumentation-api-semconv packages (#6590)
Sep 12, 2022
c65dc5c
Bump com.gradle.common-custom-user-data-gradle-plugin from 1.8 to 1.8…
dependabot[bot] Sep 13, 2022
fb07c44
Add kafka client metrics to the javaagent instrumentation (#6533)
Sep 13, 2022
e04464c
Use ConditionalResourceProvider in the Spring Boot service name provi…
Sep 13, 2022
876a562
Add experimental span attribute job.system (#6586)
trask Sep 13, 2022
09511c9
Optimize ReactorNettyNetClientAttributesGetter (#6600)
trask Sep 13, 2022
8356fca
Add code attributes for Logback (#6591)
jeanbisutti Sep 13, 2022
f84b933
Remove external usages of ClassNames (and move it to internal) (#6584)
trask Sep 13, 2022
f200f9b
Fix latest dep builds (#6603)
Sep 14, 2022
6e49edb
Fix finatra latest deps test (#6616)
laurit Sep 14, 2022
e9827ef
Add dependency from alpha bom to stable bom (#6611)
trask Sep 14, 2022
68ef38b
Some assertions refactoring (#6618)
Sep 14, 2022
e1d2f42
Fix spring boot @WithSpan handling (#6619)
laurit Sep 14, 2022
618846c
Convert logback test to Java (#6613)
trask Sep 14, 2022
b7da40f
Reactor instrumentation: do not make root context current (#6593)
lmolkova Sep 14, 2022
0b90409
Update change log for 1.18.0 release (#6564)
trask Sep 14, 2022
b58d43c
Update version to 1.19.0-SNAPSHOT (#6623)
opentelemetrybot Sep 14, 2022
fb92615
Fix examples in main branch (#6626)
trask Sep 14, 2022
bc1e179
Add resource providers (#6574)
jack-berg Sep 14, 2022
194af46
Fix operator pull request (#6629)
trask Sep 15, 2022
169ffa1
Fix at mention in operator pr (#6630)
trask Sep 15, 2022
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
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions .github/workflows/reusable-assemble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ jobs:
exit 1
fi

- name: Check for jApiCmp diffs
run: |
if git diff --quiet
then
echo "No diff detected."
else
echo "Diff detected - did you run './gradlew jApiCmp'?"
echo $(git diff --name-only)
echo $(git diff)
exit 1
fi

- name: Upload deadlock detector artifacts if any
if: always()
uses: actions/upload-artifact@v3
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/reusable-create-operator-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ jobs:
VERSION: ${{ inputs.version }}
run: |
message="Update the javaagent version to $VERSION"
body="Update the javaagent version to \`$VERSION\`."
# note that @open-telemetry/java-instrumentation-approvers cannot be used below
# because opentelemetrybot is not a member of the OpenTelemetry org,
# and so it cannot @ mention OpenTelemetry org groups
body="Update the javaagent version to \`$VERSION\`.

cc @laurit @mateuszrzeszutek @trask
"

# gh pr create doesn't have a way to explicitly specify different head and base
# repositories currently, but it will implicitly pick up the head from a different
Expand All @@ -63,6 +69,5 @@ jobs:
git push --set-upstream origin HEAD:update-opentelemetry-javaagent-to-${VERSION}
gh pr create --title "$message" \
--body "$body" \
--reviewer open-telemetry/java-instrumentation-approvers \
--repo open-telemetry/opentelemetry-operator \
--base main
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,61 @@

## Unreleased

## Version 1.18.0 (2022-09-14)

The `opentelemetry-instrumentation-api` artifact is declared stable in this release.

### Migration notes

- There were a few late-breaking changes in `opentelemetry-instrumentation-api`, prior to it being
declared stable:
* `InstrumenterBuilder.addAttributesExtractors(AttributesExtractor...)` was removed, use instead
`addAttributesExtractors(AttributesExtractor)` or
`addAttributesExtractors(Iterable<AttributesExtractor>)`
* `SpanLinksExtractor.extractFromRequest()` was removed, use instead manual extraction
* `ErrorCauseExtractor.jdk()` was renamed to `ErrorCauseExtractor.getDefault()`
* `ClassNames` utility was removed with no direct replacement
- The deprecated `io.opentelemetry.instrumentation.api.config.Config` and related classes
have been removed
([#6501](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6501))
- Net attributes getters were updated to reflect latest specification changes
([#6503](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6503))
- The deprecated `Ordered` interface was removed from the `opentelemetry-javaagent-extension-api`,
use instead the `Ordered` interface from `opentelemetry-sdk-extension-autoconfigure-spi`
([#6589](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6589))

### 📈 Enhancements

- Add Spring Boot service name guesser / ResourceProvider
([#6516](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6516))
- Move micrometer shim library instrumentation back
([#6538](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6538))
- Add grpc status code to metrics attrs
([#6556](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6556))
- Add mongo sanitization configuration
([#6541](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6541))
- Add kafka client metrics to the javaagent instrumentation
([#6533](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6533))
- Add experimental span attribute job.system
([#6586](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6586))
- Add code attributes for Logback
([#6591](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6591))
- Reactor instrumentation: do not make root context current
([#6593](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6593))

### 🛠️ Bug fixes

- Fix default-enabled config
([#6491](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6491))
- Fix new jdbc javaagent config
([#6492](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6492))
- Fix jaxrs async instrumentation race
([#6523](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6523))
- Fix spring webmvc instrumentation name
([#6557](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6557))
- Fix spring boot `@WithSpan` handling
([#6619](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6619))

## Version 1.17.0 (2022-08-18)

### Migration notes
Expand Down
20 changes: 20 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Every successful CI build of the main branch automatically executes `./gradlew p
as the last step, which publishes a snapshot build to
[Sonatype OSS snapshots repository](https://oss.sonatype.org/content/repositories/snapshots/io/opentelemetry/).

## Release cadence

This repository roughly targets monthly minor releases from the `main` branch on the Wednesday after
the second Monday of the month (roughly a few of days after the monthly minor release of
[opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java)).

## Preparing a new major or minor release

* Close the release milestone if there is one.
Expand Down Expand Up @@ -52,6 +58,20 @@ and deadlocks.
(note that if this is not a patch release then the change log on main may already be up-to-date,
in which case no pull request will be created).

## Update release versions in documentations

After releasing is done, you need to first update the docs. This needs to happen after artifacts have propagated
to Maven Central so should probably be done an hour or two after the release workflow finishes.

```sh
./gradlew japicmp -PapiBaseVersion=a.b.c -PapiNewVersion=x.y.z
./gradlew --refresh-dependencies japicmp
```

Where `x.y.z` is the version just released and `a.b.c` is the previous version.

Create a PR to mark the new release in docs on the main branch.

## Credentials

Same as the core repo, see [opentelemetry-java/RELEASING.md#credentials](https://github.com/open-telemetry/opentelemetry-java/blob/main/RELEASING.md#credentials).
18 changes: 3 additions & 15 deletions bom-alpha/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
plugins {
id("java-platform")

id("otel.publish-conventions")
id("otel.bom-conventions")
}

description = "OpenTelemetry Instrumentation Bill of Materials (Alpha)"
Expand All @@ -17,17 +15,7 @@ val otelVersion: String by project
dependencies {
api(platform("io.opentelemetry:opentelemetry-bom:${otelVersion}"))
api(platform("io.opentelemetry:opentelemetry-bom-alpha:${otelVersion}-alpha"))
api(platform(project(":bom")))
}

dependencies {
constraints {
rootProject.subprojects {
val proj = this
if (!proj.name.startsWith("bom") && proj.name != "javaagent") {
proj.plugins.withId("maven-publish") {
api(proj)
}
}
}
}
}
otelBom.projectFilter.set { it.findProperty("otel.stable") != "true" }
19 changes: 19 additions & 0 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
id("otel.bom-conventions")
}

description = "OpenTelemetry Instrumentation Bill of Materials"
group = "io.opentelemetry.instrumentation"
base.archivesName.set("opentelemetry-instrumentation-bom")

javaPlatform {
allowDependencies()
}

val otelVersion: String by project

dependencies {
api(platform("io.opentelemetry:opentelemetry-bom:${otelVersion}"))
}

otelBom.projectFilter.set { it.findProperty("otel.stable") == "true" }
1 change: 1 addition & 0 deletions bom/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
otel.stable=true
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ tasks.withType<ShadowJar>().configureEach {

exclude("**/module-info.class")

// Prevents conflict with other SLF4J instances. Important for premain.
relocate("org.slf4j", "io.opentelemetry.javaagent.slf4j")
// rewrite dependencies calling Logger.getLogger
relocate("java.util.logging.Logger", "io.opentelemetry.javaagent.bootstrap.PatchLogger")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.gradle

import org.gradle.api.Project
import org.gradle.api.provider.Property
import java.util.function.Predicate

abstract class OtelBomExtension {
abstract val projectFilter: Property<Predicate<Project>>
}
35 changes: 35 additions & 0 deletions conventions/src/main/kotlin/otel.bom-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import io.opentelemetry.instrumentation.gradle.OtelBomExtension

plugins {
id("otel.publish-conventions")
id("java-platform")
}

if (!project.name.startsWith("bom")) {
throw IllegalStateException("Name of BOM projects must start with 'bom'.")
}

rootProject.subprojects.forEach { subproject ->
if (!subproject.name.startsWith("bom")) {
evaluationDependsOn(subproject.path)
}
}
val otelBom = extensions.create<OtelBomExtension>("otelBom")

afterEvaluate {
otelBom.projectFilter.finalizeValue()
val bomProjects = rootProject.subprojects
.sortedBy { it.findProperty("archivesName") as String? }
.filter { !it.name.startsWith("bom") }
.filter { !it.name.equals("javaagent") }
.filter(otelBom.projectFilter.get()::test)
.filter { it.plugins.hasPlugin("maven-publish") }

bomProjects.forEach { project ->
dependencies {
constraints {
api(project)
}
}
}
}
83 changes: 56 additions & 27 deletions conventions/src/main/kotlin/otel.japicmp-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import japicmp.model.JApiChangeStatus
import me.champeau.gradle.japicmp.JapicmpTask
import me.champeau.gradle.japicmp.report.stdrules.RecordSeenMembersSetup
import me.champeau.gradle.japicmp.report.stdrules.SourceCompatibleRule
import me.champeau.gradle.japicmp.report.stdrules.UnchangedMemberRule

plugins {
base
Expand Down Expand Up @@ -43,36 +47,61 @@ fun findArtifact(version: String): File {
}
}

tasks {
val jApiCmp by registering(JapicmpTask::class) {
dependsOn("jar")
// generate the api diff report for any module that is stable
if (project.findProperty("otel.stable") == "true") {
afterEvaluate {
tasks {
val jApiCmp by registering(JapicmpTask::class) {
dependsOn("jar")

// the japicmp "new" version is either the user-specified one, or the locally built jar.
val apiNewVersion: String? by project
val newArtifact = apiNewVersion?.let { findArtifact(it) }
?: file(getByName<Jar>("jar").archiveFile)
newClasspath.from(files(newArtifact))
// the japicmp "new" version is either the user-specified one, or the locally built jar.
val apiNewVersion: String? by project
val newArtifact = apiNewVersion?.let { findArtifact(it) }
?: file(getByName<Jar>("jar").archiveFile)
newClasspath.from(files(newArtifact))

// only output changes, not everything
onlyModified.set(true)
// only output changes, not everything
onlyModified.set(true)

// the japicmp "old" version is either the user-specified one, or the latest release.
val apiBaseVersion: String? by project
val baselineVersion = apiBaseVersion ?: latestReleasedVersion
oldClasspath.from(try {
files(findArtifact(baselineVersion))
} catch (e: Exception) {
// if we can't find the baseline artifact, this is probably one that's never been published before,
// so publish the whole API. We do that by flipping this flag, and comparing the current against nothing.
onlyModified.set(false)
files()
})
// the japicmp "old" version is either the user-specified one, or the latest release.
val apiBaseVersion: String? by project
val baselineVersion = apiBaseVersion ?: latestReleasedVersion
oldClasspath.from(
try {
files(findArtifact(baselineVersion))
} catch (e: Exception) {
// if we can't find the baseline artifact, this is probably one that's never been published before,
// so publish the whole API. We do that by flipping this flag, and comparing the current against nothing.
onlyModified.set(false)
files()
}
)

// this is needed so that we only consider the current artifact, and not dependencies
ignoreMissingClasses.set(true)
packageExcludes.addAll("*.internal", "*.internal.*")
val baseVersionString = if (apiBaseVersion == null) "latest" else baselineVersion
val newVersionString = if (apiNewVersion == null) "current" else apiNewVersion
txtOutputFile.set(file("$rootDir/docs/apidiffs/${newVersionString}_vs_$baseVersionString/${base.archivesName.get()}.txt"))
// Reproduce defaults from https://github.com/melix/japicmp-gradle-plugin/blob/09f52739ef1fccda6b4310cf3f4b19dc97377024/src/main/java/me/champeau/gradle/japicmp/report/ViolationsGenerator.java#L130
// only changing the BinaryIncompatibleRule to our custom one that allows new default methods
// on interfaces, and adding default implementations to interface methods previously
// abstract.
richReport {
addSetupRule(RecordSeenMembersSetup::class.java)
addRule(JApiChangeStatus.NEW, SourceCompatibleRule::class.java)
addRule(JApiChangeStatus.MODIFIED, SourceCompatibleRule::class.java)
addRule(JApiChangeStatus.UNCHANGED, UnchangedMemberRule::class.java)
addRule(SourceCompatibleRule::class.java)
}

// this is needed so that we only consider the current artifact, and not dependencies
ignoreMissingClasses.set(true)
packageExcludes.addAll("*.internal", "*.internal.*")
val baseVersionString = if (apiBaseVersion == null) "latest" else baselineVersion
txtOutputFile.set(
apiNewVersion?.let { file("$rootDir/docs/apidiffs/${apiNewVersion}_vs_$baselineVersion/${base.archivesName.get()}.txt") }
?: file("$rootDir/docs/apidiffs/current_vs_$baseVersionString/${base.archivesName.get()}.txt")
)
}
// have the jApiCmp task run every time the jar task is run, to make it more likely it will get used.
named("jar") {
finalizedBy(jApiCmp)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ testing {
implementation("org.junit.jupiter:junit-jupiter-params")
runtimeOnly("org.junit.jupiter:junit-jupiter-engine")
runtimeOnly("org.junit.vintage:junit-vintage-engine")
implementation("org.junit-pioneer:junit-pioneer")


implementation("org.assertj:assertj-core")
Expand Down
14 changes: 14 additions & 0 deletions conventions/src/main/kotlin/otel.sdk-extension.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SDK extensions are very similar to library instrumentations, they can be used without the javaagent
// but since they depend on the SDK they must be loaded by the agent CL in the javaagent

plugins {
id("io.opentelemetry.instrumentation.library-instrumentation")

id("otel.jacoco-conventions")
id("otel.java-conventions")
id("otel.publish-conventions")
}

extra["mavenGroupId"] = "io.opentelemetry.instrumentation"

base.archivesName.set(projectDir.parentFile.name)
3 changes: 2 additions & 1 deletion dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ val dependencyVersions = hashMapOf<String, String>()
rootProject.extra["versions"] = dependencyVersions

// this line is managed by .github/scripts/update-sdk-version.sh
val otelVersion = "1.17.0"
val otelVersion = "1.18.0"

rootProject.extra["otelVersion"] = otelVersion

Expand Down Expand Up @@ -106,6 +106,7 @@ val DEPENDENCIES = listOf(
"com.google.code.findbugs:jsr305:3.0.2",
"org.apache.groovy:groovy:${groovyVersion}",
"org.apache.groovy:groovy-json:${groovyVersion}",
"org.codehaus.mojo:animal-sniffer-annotations:1.22",
"org.junit-pioneer:junit-pioneer:1.7.1",
"org.objenesis:objenesis:3.2",
"org.spockframework:spock-core:2.2-groovy-4.0",
Expand Down
Loading