Skip to content

Commit 290c35b

Browse files
authored
Merge 038e792 into 1afb20e
2 parents 1afb20e + 038e792 commit 290c35b

File tree

10 files changed

+1084
-0
lines changed

10 files changed

+1084
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Features
6+
7+
- Add JCache (JSR-107) cache tracing via new `sentry-jcache` module ([#5179](https://github.com/getsentry/sentry-java/pull/5179))
8+
39
## 8.34.1
410

511
### Fixes

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Sentry SDK for Java and Android
5757
| sentry-graphql | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql?style=for-the-badge&logo=sentry&color=green) |
5858
| sentry-graphql-core | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql-core?style=for-the-badge&logo=sentry&color=green) |
5959
| sentry-graphql-22 | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql-22?style=for-the-badge&logo=sentry&color=green) |
60+
| sentry-jcache | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-jcache?style=for-the-badge&logo=sentry&color=green) |
6061
| sentry-quartz | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-quartz?style=for-the-badge&logo=sentry&color=green) |
6162
| sentry-openfeign | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-openfeign?style=for-the-badge&logo=sentry&color=green) |
6263
| sentry-openfeature | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-openfeature?style=for-the-badge&logo=sentry&color=green) |

buildSrc/src/main/java/Config.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ object Config {
7777
val SENTRY_GRAPHQL_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.graphql"
7878
val SENTRY_GRAPHQL_CORE_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.graphql-core"
7979
val SENTRY_GRAPHQL22_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.graphql22"
80+
val SENTRY_JCACHE_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.jcache"
8081
val SENTRY_QUARTZ_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.quartz"
8182
val SENTRY_JDBC_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.jdbc"
8283
val SENTRY_OPENFEATURE_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.openfeature"

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ otel-semconv = { module = "io.opentelemetry.semconv:opentelemetry-semconv", vers
145145
otel-semconv-incubating = { module = "io.opentelemetry.semconv:opentelemetry-semconv-incubating", version.ref = "otelSemanticConventionsAlpha" }
146146
p6spy = { module = "p6spy:p6spy", version = "3.9.1" }
147147
epitaph = { module = "com.abovevacant:epitaph", version = "0.1.0" }
148+
jcache = { module = "javax.cache:cache-api", version = "1.1.1" }
148149
quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" }
149150
reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" }
150151
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }

sentry-jcache/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# sentry-jcache
2+
3+
This module provides an integration for JCache (JSR-107).
4+
5+
JCache is a standard API — you need a provider implementation at runtime. Common implementations include:
6+
7+
- [Caffeine](https://github.com/ben-manes/caffeine) (via `com.github.ben-manes.caffeine:jcache`)
8+
- [Ehcache 3](https://www.ehcache.org/) (via `org.ehcache:ehcache`)
9+
- [Hazelcast](https://hazelcast.com/)
10+
- [Apache Ignite](https://ignite.apache.org/)
11+
- [Infinispan](https://infinispan.org/)
12+
13+
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/).
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
public final class io/sentry/jcache/BuildConfig {
2+
public static final field SENTRY_JCACHE_SDK_NAME Ljava/lang/String;
3+
public static final field VERSION_NAME Ljava/lang/String;
4+
}
5+
6+
public final class io/sentry/jcache/SentryJCacheWrapper : javax/cache/Cache {
7+
public fun <init> (Ljavax/cache/Cache;Lio/sentry/IScopes;)V
8+
public fun clear ()V
9+
public fun close ()V
10+
public fun containsKey (Ljava/lang/Object;)Z
11+
public fun deregisterCacheEntryListener (Ljavax/cache/configuration/CacheEntryListenerConfiguration;)V
12+
public fun get (Ljava/lang/Object;)Ljava/lang/Object;
13+
public fun getAll (Ljava/util/Set;)Ljava/util/Map;
14+
public fun getAndPut (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
15+
public fun getAndRemove (Ljava/lang/Object;)Ljava/lang/Object;
16+
public fun getAndReplace (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
17+
public fun getCacheManager ()Ljavax/cache/CacheManager;
18+
public fun getConfiguration (Ljava/lang/Class;)Ljavax/cache/configuration/Configuration;
19+
public fun getName ()Ljava/lang/String;
20+
public fun invoke (Ljava/lang/Object;Ljavax/cache/processor/EntryProcessor;[Ljava/lang/Object;)Ljava/lang/Object;
21+
public fun invokeAll (Ljava/util/Set;Ljavax/cache/processor/EntryProcessor;[Ljava/lang/Object;)Ljava/util/Map;
22+
public fun isClosed ()Z
23+
public fun iterator ()Ljava/util/Iterator;
24+
public fun loadAll (Ljava/util/Set;ZLjavax/cache/integration/CompletionListener;)V
25+
public fun put (Ljava/lang/Object;Ljava/lang/Object;)V
26+
public fun putAll (Ljava/util/Map;)V
27+
public fun putIfAbsent (Ljava/lang/Object;Ljava/lang/Object;)Z
28+
public fun registerCacheEntryListener (Ljavax/cache/configuration/CacheEntryListenerConfiguration;)V
29+
public fun remove (Ljava/lang/Object;)Z
30+
public fun remove (Ljava/lang/Object;Ljava/lang/Object;)Z
31+
public fun removeAll ()V
32+
public fun removeAll (Ljava/util/Set;)V
33+
public fun replace (Ljava/lang/Object;Ljava/lang/Object;)Z
34+
public fun replace (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z
35+
public fun unwrap (Ljava/lang/Class;)Ljava/lang/Object;
36+
}
37+

sentry-jcache/build.gradle.kts

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import net.ltgt.gradle.errorprone.errorprone
2+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3+
4+
plugins {
5+
`java-library`
6+
id("io.sentry.javadoc")
7+
alias(libs.plugins.kotlin.jvm)
8+
jacoco
9+
alias(libs.plugins.errorprone)
10+
alias(libs.plugins.gradle.versions)
11+
alias(libs.plugins.buildconfig)
12+
}
13+
14+
tasks.withType<KotlinCompile>().configureEach {
15+
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
16+
compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
17+
compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
18+
}
19+
20+
dependencies {
21+
api(projects.sentry)
22+
compileOnly(libs.jcache)
23+
24+
compileOnly(libs.jetbrains.annotations)
25+
compileOnly(libs.nopen.annotations)
26+
errorprone(libs.errorprone.core)
27+
errorprone(libs.nopen.checker)
28+
errorprone(libs.nullaway)
29+
30+
// tests
31+
testImplementation(projects.sentry)
32+
testImplementation(projects.sentryTestSupport)
33+
testImplementation(libs.jcache)
34+
testImplementation(kotlin(Config.kotlinStdLib))
35+
testImplementation(libs.kotlin.test.junit)
36+
testImplementation(libs.mockito.kotlin)
37+
testImplementation(libs.mockito.inline)
38+
}
39+
40+
configure<SourceSetContainer> { test { java.srcDir("src/test/java") } }
41+
42+
jacoco { toolVersion = libs.versions.jacoco.get() }
43+
44+
tasks.jacocoTestReport {
45+
reports {
46+
xml.required.set(true)
47+
html.required.set(false)
48+
}
49+
}
50+
51+
tasks {
52+
jacocoTestCoverageVerification {
53+
violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } }
54+
}
55+
check {
56+
dependsOn(jacocoTestCoverageVerification)
57+
dependsOn(jacocoTestReport)
58+
}
59+
}
60+
61+
tasks.withType<JavaCompile>().configureEach {
62+
options.errorprone {
63+
check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR)
64+
option("NullAway:AnnotatedPackages", "io.sentry")
65+
}
66+
}
67+
68+
buildConfig {
69+
useJavaOutput()
70+
packageName("io.sentry.jcache")
71+
buildConfigField(
72+
"String",
73+
"SENTRY_JCACHE_SDK_NAME",
74+
"\"${Config.Sentry.SENTRY_JCACHE_SDK_NAME}\"",
75+
)
76+
buildConfigField("String", "VERSION_NAME", "\"${project.version}\"")
77+
}
78+
79+
tasks.jar {
80+
manifest {
81+
attributes(
82+
"Sentry-Version-Name" to project.version,
83+
"Sentry-SDK-Name" to Config.Sentry.SENTRY_JCACHE_SDK_NAME,
84+
"Sentry-SDK-Package-Name" to "maven:io.sentry:sentry-jcache",
85+
"Implementation-Vendor" to "Sentry",
86+
"Implementation-Title" to project.name,
87+
"Implementation-Version" to project.version,
88+
)
89+
}
90+
}

0 commit comments

Comments
 (0)