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 #283

Open
wants to merge 1 commit 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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

An application to get authorization from users to access their data through 3rd party APIs. Mainly supports OAuth2 Authorization code follow to request authorization and processes the returned authorization code to add new entries of users. It creates new users and adds properties compatible and required by the [RADAR REST and Fitbit connectors](https://github.com/RADAR-base/RADAR-REST-Connector).

<!-- TOC -->
* [RADAR-REST-Source-Auth](#radar-rest-source-auth)
* [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)
* [Migrating from 1.\*.\* version to 2.\*](#migrating-from-1-version-to-2)
<!-- TOC -->

## Features supported

1. It has one active entity where we store user properties.
Expand Down Expand Up @@ -60,6 +71,10 @@ callback-url: <advertised-url-of-rest-sources-authorizer-app>/login
# the callback-url should be resolvable and match with the environment variable of radar-rest-sources-authorizer -> AUTH_CALLBACK_URL in the docker-compose.yml file.
```

## Sentry monitoring

See [here](authorizer-app-backend/README.md#sentry-monitoring) for instructions on how to enable Sentry monitoring.

## Migrating from 1.\*.\* version to 2.\*

1. Move configurations from application.yml and environment variables to `authorizer.yml` following the description in `authorizer.yml.template`.
Expand Down
10 changes: 10 additions & 0 deletions authorizer-app-backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# RADAR-REST-Source-Auth backend

This is the backend for the RADAR REST Source Authorizer application.

## 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 authorizer-app-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 authorizer-app-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>
Loading