-
-
Notifications
You must be signed in to change notification settings - Fork 467
feat(jcache): [Cache Tracing 5] Add SentryJCacheWrapper for JCache (JSR-107) #5179
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
Open
adinauer
wants to merge
10
commits into
feat/cache-tracing-sample
Choose a base branch
from
feat/cache-tracing-jcache
base: feat/cache-tracing-sample
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,081
−0
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6822d8a
feat(jcache): Add SentryJCacheWrapper for JCache (JSR-107) cache tracing
adinauer 4b6759d
changelog
adinauer 93be5c8
fix(jcache): Make replace and getAndReplace passthrough (no span)
adinauer 038e792
fix(jcache): Check for NoOp span after startChild
adinauer 0d4de4b
fix(jcache): Use cache.flush for removeAll() without keys
adinauer ebb8ee1
Merge branch 'feat/cache-tracing-sample' into feat/cache-tracing-jcache
adinauer 7453d68
changelog
adinauer ba9add7
Merge branch 'feat/cache-tracing-sample' into feat/cache-tracing-jcache
adinauer 032ab26
changelog
adinauer bbbb702
Merge branch 'feat/cache-tracing-sample' into feat/cache-tracing-jcache
adinauer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # sentry-jcache | ||
|
|
||
| This module provides an integration for JCache (JSR-107). | ||
|
|
||
| JCache is a standard API — you need a provider implementation at runtime. Common implementations include: | ||
|
|
||
| - [Caffeine](https://github.com/ben-manes/caffeine) (via `com.github.ben-manes.caffeine:jcache`) | ||
| - [Ehcache 3](https://www.ehcache.org/) (via `org.ehcache:ehcache`) | ||
| - [Hazelcast](https://hazelcast.com/) | ||
| - [Apache Ignite](https://ignite.apache.org/) | ||
| - [Infinispan](https://infinispan.org/) | ||
|
|
||
| Please consult the documentation on how to install and use this integration in the Sentry Docs for [Java](https://docs.sentry.io/platforms/java/tracing/instrumentation/jcache/). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| public final class io/sentry/jcache/BuildConfig { | ||
| public static final field SENTRY_JCACHE_SDK_NAME Ljava/lang/String; | ||
| public static final field VERSION_NAME Ljava/lang/String; | ||
| } | ||
|
|
||
| public final class io/sentry/jcache/SentryJCacheWrapper : javax/cache/Cache { | ||
| public fun <init> (Ljavax/cache/Cache;Lio/sentry/IScopes;)V | ||
| public fun clear ()V | ||
| public fun close ()V | ||
| public fun containsKey (Ljava/lang/Object;)Z | ||
| public fun deregisterCacheEntryListener (Ljavax/cache/configuration/CacheEntryListenerConfiguration;)V | ||
| public fun get (Ljava/lang/Object;)Ljava/lang/Object; | ||
| public fun getAll (Ljava/util/Set;)Ljava/util/Map; | ||
| public fun getAndPut (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; | ||
| public fun getAndRemove (Ljava/lang/Object;)Ljava/lang/Object; | ||
| public fun getAndReplace (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; | ||
| public fun getCacheManager ()Ljavax/cache/CacheManager; | ||
| public fun getConfiguration (Ljava/lang/Class;)Ljavax/cache/configuration/Configuration; | ||
| public fun getName ()Ljava/lang/String; | ||
| public fun invoke (Ljava/lang/Object;Ljavax/cache/processor/EntryProcessor;[Ljava/lang/Object;)Ljava/lang/Object; | ||
| public fun invokeAll (Ljava/util/Set;Ljavax/cache/processor/EntryProcessor;[Ljava/lang/Object;)Ljava/util/Map; | ||
| public fun isClosed ()Z | ||
| public fun iterator ()Ljava/util/Iterator; | ||
| public fun loadAll (Ljava/util/Set;ZLjavax/cache/integration/CompletionListener;)V | ||
| public fun put (Ljava/lang/Object;Ljava/lang/Object;)V | ||
| public fun putAll (Ljava/util/Map;)V | ||
| public fun putIfAbsent (Ljava/lang/Object;Ljava/lang/Object;)Z | ||
| public fun registerCacheEntryListener (Ljavax/cache/configuration/CacheEntryListenerConfiguration;)V | ||
| public fun remove (Ljava/lang/Object;)Z | ||
| public fun remove (Ljava/lang/Object;Ljava/lang/Object;)Z | ||
| public fun removeAll ()V | ||
| public fun removeAll (Ljava/util/Set;)V | ||
| public fun replace (Ljava/lang/Object;Ljava/lang/Object;)Z | ||
| public fun replace (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z | ||
| public fun unwrap (Ljava/lang/Class;)Ljava/lang/Object; | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| import net.ltgt.gradle.errorprone.errorprone | ||
| import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
|
||
| plugins { | ||
| `java-library` | ||
| id("io.sentry.javadoc") | ||
| alias(libs.plugins.kotlin.jvm) | ||
| jacoco | ||
| alias(libs.plugins.errorprone) | ||
| alias(libs.plugins.gradle.versions) | ||
| alias(libs.plugins.buildconfig) | ||
| } | ||
|
|
||
| tasks.withType<KotlinCompile>().configureEach { | ||
| compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 | ||
| compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 | ||
| compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 | ||
| } | ||
|
|
||
| dependencies { | ||
| api(projects.sentry) | ||
| compileOnly(libs.jcache) | ||
|
|
||
| compileOnly(libs.jetbrains.annotations) | ||
| compileOnly(libs.nopen.annotations) | ||
| errorprone(libs.errorprone.core) | ||
| errorprone(libs.nopen.checker) | ||
| errorprone(libs.nullaway) | ||
|
|
||
| // tests | ||
| testImplementation(projects.sentry) | ||
| testImplementation(projects.sentryTestSupport) | ||
| testImplementation(libs.jcache) | ||
| testImplementation(kotlin(Config.kotlinStdLib)) | ||
| testImplementation(libs.kotlin.test.junit) | ||
| testImplementation(libs.mockito.kotlin) | ||
| testImplementation(libs.mockito.inline) | ||
| } | ||
|
|
||
| configure<SourceSetContainer> { test { java.srcDir("src/test/java") } } | ||
|
|
||
| jacoco { toolVersion = libs.versions.jacoco.get() } | ||
|
|
||
| tasks.jacocoTestReport { | ||
| reports { | ||
| xml.required.set(true) | ||
| html.required.set(false) | ||
| } | ||
| } | ||
|
|
||
| tasks { | ||
| jacocoTestCoverageVerification { | ||
| violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } | ||
| } | ||
| check { | ||
| dependsOn(jacocoTestCoverageVerification) | ||
| dependsOn(jacocoTestReport) | ||
| } | ||
| } | ||
|
|
||
| tasks.withType<JavaCompile>().configureEach { | ||
| options.errorprone { | ||
| check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) | ||
| option("NullAway:AnnotatedPackages", "io.sentry") | ||
| } | ||
| } | ||
|
|
||
| buildConfig { | ||
| useJavaOutput() | ||
| packageName("io.sentry.jcache") | ||
| buildConfigField( | ||
| "String", | ||
| "SENTRY_JCACHE_SDK_NAME", | ||
| "\"${Config.Sentry.SENTRY_JCACHE_SDK_NAME}\"", | ||
| ) | ||
| buildConfigField("String", "VERSION_NAME", "\"${project.version}\"") | ||
| } | ||
|
|
||
| tasks.jar { | ||
| manifest { | ||
| attributes( | ||
| "Sentry-Version-Name" to project.version, | ||
| "Sentry-SDK-Name" to Config.Sentry.SENTRY_JCACHE_SDK_NAME, | ||
| "Sentry-SDK-Package-Name" to "maven:io.sentry:sentry-jcache", | ||
| "Implementation-Vendor" to "Sentry", | ||
| "Implementation-Title" to project.name, | ||
| "Implementation-Version" to project.version, | ||
| ) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.