Skip to content

Commit c8a2aca

Browse files
committed
Add support for Sentry monitoring
Includes addition to documentation.
1 parent 38ecf12 commit c8a2aca

File tree

4 files changed

+72
-17
lines changed

4 files changed

+72
-17
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Restructure Kafka connector output files
22

3+
<!-- TOC -->
4+
* [Restructure Kafka connector output files](#restructure-kafka-connector-output-files)
5+
* [Upgrade instructions](#upgrade-instructions)
6+
* [Docker usage](#docker-usage)
7+
* [Command line usage](#command-line-usage)
8+
* [File Format](#file-format)
9+
* [Compression](#compression)
10+
* [Redis](#redis)
11+
* [Source and target](#source-and-target)
12+
* [Path format](#path-format)
13+
* [Cleaner](#cleaner)
14+
* [Service](#service)
15+
* [Sentry monitoring](#sentry-monitoring)
16+
* [Local build](#local-build)
17+
* [Extending the connector](#extending-the-connector)
18+
<!-- TOC -->
19+
320
Data streamed by a Kafka Connector will be converted to a RADAR-base oriented output directory, by organizing it by project, user and collection date.
421
It supports data written by [RADAR S3 sink connector](https://github.com/RADAR-base/RADAR-S3-Connector) is streamed to files based on topic name only. This package transforms that output to a local directory structure as follows: `projectId/userId/topic/date_hour.csv`. The date and hour are extracted from the `time` field of each record, and is formatted in UTC time.
522

@@ -225,6 +242,23 @@ The cleaner can also be enabled with the `--cleaner` command-line flag. To run t
225242

226243
To run the output generator as a service that will regularly poll the source directory, add the `--service` flag and optionally the `--interval` flag to adjust the polling interval or use the corresponding configuration file parameters.
227244

245+
## Sentry monitoring
246+
247+
To enable Sentry monitoring:
248+
249+
1. Set a `SENTRY_DSN` environment variable that points to the desired Sentry DSN.
250+
2. (Optional) Set the `SENTRY_LOG_LEVEL` environment variable to control the minimum log level of events sent to Sentry.
251+
The default log level for Sentry is `ERROR`. Possible values are `TRACE`, `DEBUG`, `INFO`, `WARN`, and `ERROR`.
252+
253+
For further configuration of Sentry via environmental variables see [here](https://docs.sentry.io/platforms/java/configuration/#configuration-via-the-runtime-environment). For instance:
254+
255+
```
256+
SENTRY_LOG_LEVEL: 'ERROR'
257+
SENTRY_DSN: 'https://000000000000.ingest.de.sentry.io/000000000000'
258+
SENTRY_ATTACHSTACKTRACE: true
259+
SENTRY_STACKTRACE_APP_PACKAGES: io.confluent.connect,org.radarbase.connect.rest
260+
```
261+
228262
## Local build
229263
230264
This package requires at least Java JDK 8. Build the distribution with

build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ radarRootProject {
1919
}
2020

2121
radarKotlin {
22-
kotlinVersion.set(Versions.kotlin)
2322
javaVersion.set(Versions.java)
2423
log4j2Version.set(Versions.log4j2)
25-
slf4jVersion.set(Versions.slf4j)
26-
junitVersion.set(Versions.junit)
24+
sentryEnabled.set(true)
2725
}
2826

2927
radarPublishing {

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ object Versions {
66
const val kotlin = "1.9.22"
77
const val dockerCompose = "0.17.5"
88

9-
const val radarCommons = "1.1.2"
9+
const val radarCommons = "1.1.3"
1010
const val radarSchemas = "0.8.7"
1111
const val jackson = "2.15.3"
12-
const val slf4j = "2.0.9"
1312
const val log4j2 = "2.21.0"
14-
const val junit = "5.10.0"
1513
const val avro = "1.11.3"
1614

1715
const val mockitoKotlin = "5.1.0"

src/main/resources/log4j2.xml

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
1-
<Configuration status="WARN">
2-
<Appenders>
3-
<Console name="STDOUT" target="SYSTEM_OUT">
4-
<PatternLayout pattern="[%d] %-5level - %msg (%F:%L)%n"/>
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!--
3+
~ /*
4+
~ * Copyright 2024 The Hyve
5+
~ *
6+
~ * Licensed under the Apache License, Version 2.0 (the "License");
7+
~ * you may not use this file except in compliance with the License.
8+
~ * You may obtain a copy of the License at
9+
~ *
10+
~ * http://www.apache.org/licenses/LICENSE-2.0
11+
~ *
12+
~ * Unless required by applicable law or agreed to in writing, software
13+
~ * distributed under the License is distributed on an "AS IS" BASIS,
14+
~ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ * See the License for the specific language governing permissions and
16+
~ * limitations under the License.
17+
~ */
18+
-->
19+
<configuration status="INFO">
20+
<appenders>
21+
<Console name="Console" target="SYSTEM_OUT">
22+
<PatternLayout
23+
pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"
24+
/>
525
</Console>
6-
</Appenders>
26+
<!-- For Sentry to work the DSN must be set via SENTRY_DSN environment variable
27+
When SENTRY_DSN is empty string, the Sentry SDK is disabled -->
28+
<Sentry name="Sentry" debug="false"/>
29+
</appenders>
730

8-
<Loggers>
9-
<Root level="${env:LOG4J_LOG_LEVEL:-INFO}">
10-
<AppenderRef ref="STDOUT"/>
11-
</Root>
12-
</Loggers>
13-
</Configuration>
31+
<loggers>
32+
<root level="INFO">
33+
<appender-ref ref="Console" />
34+
<!-- Note that the Sentry logging threshold is at ERROR level by default -->
35+
<appender-ref ref="Sentry" level="${env:SENTRY_LOG_LEVEL:-ERROR}" />
36+
</root>
37+
</loggers>
38+
</configuration>

0 commit comments

Comments
 (0)