Skip to content

Commit

Permalink
Add support for Sentry monitoring
Browse files Browse the repository at this point in the history
Includes addition to documentation.
  • Loading branch information
pvannierop committed Oct 4, 2024
1 parent c97ea7d commit ac7beb3
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@

Application that provides a REST API to provide Variables (measured modalities) and related Observations (measurements)
for Subjects (participants). The data layer connects to the TimescaleDB database that is provisioned with (a subset of)
the data from the RADAR-base kafka service.[]\
the data from the RADAR-base kafka service.[]

<!-- TOC -->

* [RADAR-base Data Dashboard backend](#radar-base-data-dashboard-backend)
* [Features supported](#features-supported)
* [APIs to be used by REST Source-Connectors](#apis-to-be-used-by-rest-source-connectors)
* [Installation](#installation)
* [Authorization](#authorization)
* [Registering OAuth Clients with ManagementPortal](#registering-oauth-clients-with-managementportal)
* [Sentry monitoring](#sentry-monitoring)

<!-- TOC -->

## Features supported

Expand Down Expand Up @@ -47,3 +59,11 @@ grant-type:authorization_code,refresh_token
resources:res_DataDashboardAPI
scope:MEASUREMENT.READ
```

## 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`.
3 changes: 3 additions & 0 deletions data-dashboard-backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ plugins {
kotlin("plugin.noarg")
kotlin("plugin.jpa")
kotlin("plugin.allopen")
// TODO Remove this when new release of radar-commons is available and used in this project.
// This version has Sentry support built in for radar-kotlin plugin.
id("io.sentry.jvm.gradle") version "4.11.0"
}

application {
Expand Down
39 changes: 39 additions & 0 deletions data-dashboard-backend/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>

0 comments on commit ac7beb3

Please sign in to comment.