Skip to content

Commit

Permalink
Drop instrumentation-api-caching module and move weak cache implement…
Browse files Browse the repository at this point in the history
…ation to instrumentation-api (open-telemetry#4667)

* Drop instrumentation-api-caching module and move weak cache implementation to instrumentation-api

* Some test fixes

* Some cleanup

* Temporary workaround for using weak values in FutureListenerWrappers

* Spotless

* Update ClassNames and SpanNames

* Compilation and comment

* Add bounded cache and clean interface

* Polish

* Add comment

* Vendor ConcurrentLinkedHashMap in

* Let errorprone ignore vendored CLHM for now

* Keep license in java files too

* Convert Netty wrapper cache to VirtualField

* Work around lambda instrumentation failure

Ideally we would ignore instrumenting helper classes...

* Revert "Work around lambda instrumentation failure"

This reverts commit 6d63815.

* Revert "Convert Netty wrapper cache to VirtualField"

This reverts commit dac1522.

* Handle cleared weak values

* Fix comment

* Delete instrumentation-api-caching

* Copy in weak-lock-free

* Remove caffeine remnants

* Fix checkstyle

* Rename BoundedCache to MapBackedCached

* Remove duplicate LICENSE

* Remove outdated comment

* Sync with SDK copy of weaklockfree

* Enable checkstyle:off comment

* Re-generate license report

* Move NOTICE file to package-info.java

Co-authored-by: Trask Stalnaker <[email protected]>
  • Loading branch information
2 people authored and RashmiRam committed May 23, 2022
1 parent f5d82b6 commit 3cb76bf
Show file tree
Hide file tree
Showing 72 changed files with 3,722 additions and 1,008 deletions.
2 changes: 1 addition & 1 deletion benchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies {
jmh(project(":javaagent-tooling"))
jmh(project(":javaagent-extension-api"))

jmh("com.github.ben-manes.caffeine:caffeine:$caffeine2Version")
jmh("com.github.ben-manes.caffeine:caffeine:2.9.2")

jmh("javax.servlet:javax.servlet-api:4.0.1")
jmh("com.google.http-client:google-http-client:1.19.0")
Expand Down
2 changes: 2 additions & 0 deletions buildscripts/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@
</module>
<!-- this enables @SuppressWarnings("checkstyle:...") annotations -->
<module name="SuppressWarningsHolder"/>
<!-- this enables CHECKSTYLE:OFF and CHECKSTYLE:ON comments -->
<module name="SuppressionCommentFilter"/>
</module>
<!-- this enables @SuppressWarnings("checkstyle:...") annotations -->
<module name="SuppressWarningsFilter"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ tasks.withType<ShadowJar>().configureEach {
mergeServiceFiles()

exclude("**/module-info.class")
exclude("META-INF/jandex.idx") // from caffeine

// Prevents conflict with other SLF4J instances. Important for premain.
relocate("org.slf4j", "io.opentelemetry.javaagent.slf4j")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tasks {
disableWarningsInGeneratedCode.set(true)
allDisabledChecksAsWarnings.set(true)

excludedPaths.set(".*/build/generated/.*")
excludedPaths.set(".*/build/generated/.*|.*/concurrentlinkedhashmap/.*")

if (System.getenv("CI") == null) {
disable("SystemOut")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,4 @@ dependencies {
compileOnly("io.opentelemetry:opentelemetry-api")
compileOnly(project(":instrumentation-api"))
compileOnly(project(":javaagent-instrumentation-api"))

// this only exists to make Intellij happy since it doesn't (currently at least) understand our
// inclusion of this artifact inside of :instrumentation-api
compileOnly(project(":instrumentation-api-caching"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,4 @@ plugins {

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

base.archivesName.set(projectDir.parentFile.name)

dependencies {
// this only exists to make Intellij happy since it doesn't (currently at least) understand our
// inclusion of this artifact inside of :instrumentation-api
compileOnly(project(":instrumentation-api-caching"))
}
base.archivesName.set(projectDir.parentFile.name)
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,4 @@ plugins {

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

base.archivesName.set(projectDir.parentFile.name)

dependencies {
// this only exists to make Intellij happy since it doesn't (currently at least) understand our
// inclusion of this artifact inside of :instrumentation-api
compileOnly(project(":instrumentation-api-caching"))
}
base.archivesName.set(projectDir.parentFile.name)
4 changes: 0 additions & 4 deletions dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ rootProject.extra["otelVersion"] = otelVersion
// Need both BOM and -all
val groovyVersion = "2.5.14"

rootProject.extra["caffeine2Version"] = "2.9.2"
rootProject.extra["caffeine3Version"] = "3.0.4"

// We don't force libraries we instrument to new versions since we compile and test against specific
// old baseline versions
// but we do try to force those libraries' transitive dependencies to new versions where possible
Expand Down Expand Up @@ -87,7 +84,6 @@ val DEPENDENCY_SETS = listOf(

val DEPENDENCIES = listOf(
"ch.qos.logback:logback-classic:1.2.3",
"com.blogspot.mydailyjava:weak-lock-free:0.18",
"com.github.stefanbirkner:system-lambda:1.2.0",
"com.github.stefanbirkner:system-rules:1.19.0",
"com.google.auto.service:auto-service:1.0",
Expand Down
5 changes: 0 additions & 5 deletions instrumentation-api-annotation-support/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ group = "io.opentelemetry.instrumentation"
dependencies {
implementation(project(":instrumentation-api"))

// this only exists to make Intellij happy since it doesn't (currently at least) understand our
// inclusion of this artifact inside of :instrumentation-api
compileOnly(project(":instrumentation-api-caching"))
testCompileOnly(project(":instrumentation-api-caching"))

api("io.opentelemetry:opentelemetry-api")
api("io.opentelemetry:opentelemetry-semconv")

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

package io.opentelemetry.instrumentation.api.annotation.support;

import io.opentelemetry.instrumentation.api.caching.Cache;
import io.opentelemetry.instrumentation.api.cache.Cache;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package io.opentelemetry.instrumentation.api.annotation.support;

import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.instrumentation.api.caching.Cache;
import io.opentelemetry.instrumentation.api.cache.Cache;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.instrumentation.api.tracer.AttributeSetter;
import java.lang.reflect.Method;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package io.opentelemetry.instrumentation.api.annotation.support

import io.opentelemetry.api.common.AttributesBuilder
import io.opentelemetry.instrumentation.api.caching.Cache
import io.opentelemetry.instrumentation.api.cache.Cache
import spock.lang.Specification

import java.lang.reflect.Method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

import io.opentelemetry.instrumentation.api.caching.Cache;
import io.opentelemetry.instrumentation.api.cache.Cache;
import java.lang.reflect.Method;
import java.util.function.Function;
import org.junit.jupiter.api.Test;
Expand Down
44 changes: 0 additions & 44 deletions instrumentation-api-caching/build.gradle.kts

This file was deleted.

58 changes: 0 additions & 58 deletions instrumentation-api-caching/caffeine2/build.gradle.kts

This file was deleted.

This file was deleted.

This file was deleted.

41 changes: 0 additions & 41 deletions instrumentation-api-caching/caffeine3/build.gradle.kts

This file was deleted.

Loading

0 comments on commit 3cb76bf

Please sign in to comment.