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 support for Sentry monitoring #387

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/scheduled_snyk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
working-directory: java-sdk

env:
REPORT_FILE: test.json
REPORT_FILE: /tmp/test.json

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/snyk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
branches:
- master
- release-*

jobs:
security:
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ COPY java-sdk/radar-schemas-core/build.gradle.kts /code/java-sdk/radar-schemas-c
COPY java-sdk/radar-schemas-registration/build.gradle.kts /code/java-sdk/radar-schemas-registration/
COPY java-sdk/radar-schemas-tools/build.gradle.kts /code/java-sdk/radar-schemas-tools/
COPY java-sdk/radar-catalog-server/build.gradle.kts /code/java-sdk/radar-catalog-server/
COPY java-sdk/gradle/libs.versions.toml /code/java-sdk/gradle/libs.versions.toml
RUN gradle downloadDependencies copyDependencies startScripts

COPY commons /code/commons
Expand Down
86 changes: 5 additions & 81 deletions java-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,86 +1,10 @@
import org.radarbase.gradle.plugin.radarKotlin
import org.radarbase.gradle.plugin.radarPublishing

plugins {
id("org.radarbase.radar-root-project") version Versions.radarCommons
id("org.radarbase.radar-dependency-management") version Versions.radarCommons
id("org.radarbase.radar-kotlin") version Versions.radarCommons apply false
id("org.radarbase.radar-publishing") version Versions.radarCommons apply false
id("com.github.davidmc24.gradle.plugin.avro-base") version Versions.avroGenerator apply false
kotlin("plugin.allopen") version Versions.kotlin apply false
id("org.radarbase.radar-root-project")
id("org.radarbase.radar-dependency-management")
id("org.radarbase.radar-kotlin")
}

radarRootProject {
projectVersion.set(Versions.project)
gradleVersion.set(Versions.gradle)
}

// Configuration
val githubRepoName = "RADAR-base/RADAR-Schemas"
val githubUrl = "https://github.com/${githubRepoName}.git"
val githubIssueUrl = "https://github.com/$githubRepoName/issues"

subprojects {
apply(plugin = "org.radarbase.radar-kotlin")

repositories{
mavenCentral()
gradlePluginPortal()
maven(url = "https://jitpack.io")
}

radarKotlin {
javaVersion.set(Versions.java)
kotlinVersion.set(Versions.kotlin)
slf4jVersion.set(Versions.slf4j)
log4j2Version.set(Versions.log4j2)
junitVersion.set(Versions.junit)
}

afterEvaluate {
configurations.all {
exclude(group = "org.slf4j", module = "slf4j-log4j12")
}
}
}

// Configure applications
configure(listOf(
project(":radar-schemas-tools"),
project(":radar-catalog-server"),
)) {
apply(plugin = "application")
}

// Configure libraries
configure(listOf(
project(":radar-schemas-commons"),
project(":radar-schemas-core"),
project(":radar-schemas-registration")
)) {
apply(plugin = "java-library")
apply(plugin = "org.radarbase.radar-kotlin")
apply(plugin = "org.radarbase.radar-publishing")

radarKotlin {
javaVersion.set(Versions.java)
}

radarPublishing {
githubUrl.set("https://github.com/$githubRepoName")
developers {
developer {
id.set("bdegraaf1234")
name.set("Bastiaan de Graaf")
email.set("[email protected]")
organization.set("The Hyve")
}
developer {
id.set("nivemaham")
name.set("Nivethika Mahasivam")
email.set("[email protected]")
organization.set("The Hyve")
}
}
}
projectVersion.set(properties["projectVersion"] as String)
gradleVersion.set(libs.versions.gradle)
}
10 changes: 9 additions & 1 deletion java-sdk/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.22"
`kotlin-dsl` // Need for 'convention plugins'
}

repositories {
gradlePluginPortal()
mavenCentral()
}

dependencies {
// Gradle plugins used in the convention plugin, are declared as dependencies here.
implementation(libs.gradle.radar.kotlin)
implementation(libs.gradle.radar.publishing)
}

tasks.withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
Expand All @@ -19,3 +26,4 @@ tasks.withType<KotlinCompile> {
jvmTarget.set(JvmTarget.JVM_17)
}
}

8 changes: 8 additions & 0 deletions java-sdk/buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
dependencyResolutionManagement {
// Allows to use the version catalog in the buildSrc module
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
23 changes: 0 additions & 23 deletions java-sdk/buildSrc/src/main/kotlin/Versions.kt

This file was deleted.

10 changes: 10 additions & 0 deletions java-sdk/buildSrc/src/main/kotlin/kotlin-convention.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import org.radarbase.gradle.plugin.radarKotlin

plugins {
id("org.radarbase.radar-kotlin")
}

radarKotlin {
// TODO remove after using new release of radar-kotlin plugin
javaVersion.set(17)
}
18 changes: 18 additions & 0 deletions java-sdk/buildSrc/src/main/kotlin/publishing-convention.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
plugins {
id("kotlin-convention")
id("org.radarbase.radar-publishing")
}

radarPublishing {
val githubRepoName = "RADAR-base/RADAR-Schemas"
githubUrl.set("https://github.com/$githubRepoName.git")

developers {
developer {
id.set("pvannierop")
name.set("Pim van Nierop")
email.set("[email protected]")
organization.set("The Hyve")
}
}
}
2 changes: 2 additions & 0 deletions java-sdk/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
projectVersion=0.8.11

org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
48 changes: 48 additions & 0 deletions java-sdk/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[versions]
# Platform
gradle = "8.9"
kotlin = "1.9.23"

argparse4j = "0.9.0"
avro = "1.11.4"
avroGenerator = "1.9.1"
confluent = "7.6.0" # Keep in sync with 'kafka' version.
jackson = "2.16.1"
jakartaValidation = "3.0.2"
junit = "5.9.3"
kafka = "7.6.0-ce" # Keep in sync with 'confluent' version.
ktor = "2.3.4"
log4j2="2.20.0"
okHttp = "4.12.0"
radarCommons = "1.1.3"
radarJersey = "0.11.1"

[libraries]
# For buildSrc project
gradle-radar-kotlin = { group = "org.radarbase.radar-kotlin", name = "org.radarbase.radar-kotlin.gradle.plugin", version.ref = "radarCommons" }
gradle-radar-publishing = { group = "org.radarbase.radar-publishing", name = "org.radarbase.radar-publishing.gradle.plugin", version.ref = "radarCommons" }

argparse4j = { group = "net.sourceforge.argparse4j", name = "argparse4j", version.ref = "argparse4j" }
avro = { group = "org.apache.avro", name = "avro", version.ref = "avro" }
connect-json = { group = "org.apache.kafka", name = "connect-json", version.ref = "kafka" }
jackson-bom = { group = "com.fasterxml.jackson", name = "jackson-bom", version.ref = "jackson" }
jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-core", version.ref = "jackson" }
jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" }
jakarta-validation-api = { group = "jakarta.validation", name = "jakarta.validation-api", version.ref = "jakartaValidation" }
kafka-connect-api = { group = "org.apache.kafka", name = "connect-api", version.ref = "kafka" }
kafka-connect-avro-converter = { group = "io.confluent", name = "kafka-connect-avro-converter", version.ref = "confluent" }
kafka-connect-avro-data = { group = "io.confluent", name = "kafka-connect-avro-data", version.ref = "confluent" }
kafka-schema-registry-client = { group = "io.confluent", name = "kafka-schema-registry-client", version.ref = "confluent" }
ktor-client-auth = { group = "io.ktor", name = "ktor-client-auth", version.ref = "ktor" }
log4j2-core = { group = "org.apache.logging.log4j", name = "log4j-core", version.ref = "log4j2" }
mockwebserver = { group = "com.squareup.okhttp3", name = "mockwebserver", version.ref = "okHttp" }
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okHttp" }
radar-commons = { group = "org.radarbase", name = "radar-commons", version.ref = "radarCommons" }
radar-commons-kotlin = { group = "org.radarbase", name = "radar-commons-kotlin", version.ref = "radarCommons" }
radar-commons-server = { group = "org.radarbase", name = "radar-commons-server", version.ref = "radarCommons" }
radar-jersey = { group = "org.radarbase", name = "radar-jersey", version.ref = "radarJersey" }

[plugins]
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
davidmc24-avro-base = { id = "com.github.davidmc24.gradle.plugin.avro-base", version.ref = "avroGenerator" }
kotlin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" }
2 changes: 1 addition & 1 deletion java-sdk/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
9 changes: 9 additions & 0 deletions java-sdk/radar-catalog-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# RADAR Catalog Server

## Sentry monitoring

To enable Sentry monitoring:

1. Set a `SENTRY_DSN` environment variable that points to the desired Sentry DSN.
2. (Optional) Set the `SENTRY_LOG_LEVEL` environment variable to control the minimum log level of events sent to Sentry.
The default log level for Sentry is `WARN`. Possible values are `TRACE`, `DEBUG`, `INFO`, `WARN`, and `ERROR`.
17 changes: 14 additions & 3 deletions java-sdk/radar-catalog-server/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import org.radarbase.gradle.plugin.radarKotlin

plugins {
application
id("kotlin-convention")
}

description = "RADAR Schemas specification and validation tools."

dependencies {
implementation("org.radarbase:radar-jersey:${Versions.radarJersey}")
implementation(libs.radar.jersey)
implementation(project(":radar-schemas-core"))
implementation("org.radarbase:radar-commons-kotlin:${Versions.radarCommons}")
implementation(libs.radar.commons.kotlin)

implementation("net.sourceforge.argparse4j:argparse4j:${Versions.argparse}")
implementation(libs.argparse4j)

testImplementation("io.ktor:ktor-client-content-negotiation")
testImplementation("io.ktor:ktor-serialization-kotlinx-json")
Expand All @@ -14,3 +21,7 @@ dependencies {
application {
mainClass.set("org.radarbase.schema.service.SourceCatalogueServer")
}

radarKotlin {
sentryEnabled.set(true)
Copy link

@ewelinagr ewelinagr Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    javaVersion.set(Versions.java)
    log4j2Version.set(Versions.log4j2)

not needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ewelinagr No, defaults are defined in the radar-commons kotlin project gradle plugin. Better to use these defaults.

}
39 changes: 39 additions & 0 deletions java-sdk/radar-catalog-server/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
~ /*
~ * Copyright 2024 The Hyve
~ *
~ * Licensed under the Apache License, Version 2.0 (the "License");
~ * you may not use this file except in compliance with the License.
~ * You may obtain a copy of the License at
~ *
~ * http://www.apache.org/licenses/LICENSE-2.0
~ *
~ * Unless required by applicable law or agreed to in writing, software
~ * distributed under the License is distributed on an "AS IS" BASIS,
~ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ * See the License for the specific language governing permissions and
~ * limitations under the License.
~ */
-->

<configuration status="INFO">
<appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout
pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"
/>
</Console>
<!-- For Sentry to work the DSN must be set via SENTRY_DSN environment variable
When SENTRY_DSN is empty string, the Sentry SDK is disabled -->
<Sentry name="Sentry" debug="false"/>
</appenders>

<loggers>
<root level="INFO">
<appender-ref ref="Console" />
<!-- Note that the Sentry logging threshold is at WARN level by default -->
<appender-ref ref="Sentry" level="${env:SENTRY_LOG_LEVEL:-WARN}" />
</root>
</loggers>
</configuration>
10 changes: 6 additions & 4 deletions java-sdk/radar-schemas-commons/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import com.github.davidmc24.gradle.plugin.avro.GenerateAvroJavaTask

plugins {
id("com.github.davidmc24.gradle.plugin.avro-base")
id("java-library")
id("publishing-convention")
alias(libs.plugins.davidmc24.avro.base)
}

description = "RADAR Schemas Commons SDK"
Expand All @@ -25,14 +27,14 @@ sourceSets {
}

dependencies {
api("org.apache.avro:avro:${Versions.avro}") {
api("com.fasterxml.jackson.core:jackson-core:${Versions.jackson}")
api("com.fasterxml.jackson.core:jackson-databind:${Versions.jackson}")
api(libs.avro) {
exclude(group = "org.xerial.snappy", module = "snappy-java")
exclude(group = "com.thoughtworks.paranamer", module = "paranamer")
exclude(group = "org.apache.commons", module = "commons-compress")
exclude(group = "org.tukaani", module = "xz")
}
api(libs.jackson.core)
api(libs.jackson.databind)
}

// ---------------------------------------------------------------------------//
Expand Down
Loading
Loading