Skip to content

Commit

Permalink
Added sentry (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
onuratakan authored Feb 2, 2024
1 parent c2e8cec commit dd5a243
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 9 deletions.
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ requests==2.28.2
cryptography==41.0.3
django==4.2.9
gunicorn==20.1.0
tzdata==2023.3
tzdata==2023.3
sentry-sdk[flask]==1.40.0
sentry-sdk[django]==1.40.0
16 changes: 15 additions & 1 deletion upsonic_on_prem/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,33 @@




from waitress import serve
from flask import Flask, request, Response, jsonify
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address


from werkzeug.middleware.proxy_fix import ProxyFix

import sentry_sdk

sentry_sdk.init(
dsn="https://557ac9191a887032087e4054dda517c4@o4506678585786368.ingest.sentry.io/4506678591225856",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
# Set profiles_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,
)

app = Flask(__name__)



from upsonic_on_prem.utils.configs import *
from upsonic_on_prem.utils import storage

database_name_caches = []
key_name_caches = []
Expand Down
18 changes: 17 additions & 1 deletion upsonic_on_prem/dash/dash/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@
from pathlib import Path
import os

from dotenv import load_dotenv

load_dotenv(dotenv_path=".env")
# settings.py
import sentry_sdk

sentry_sdk.init(
dsn="https://[email protected]/4506678631858176",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
# Set profiles_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,
)

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand Down Expand Up @@ -134,5 +150,5 @@

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

ALLOWED_HOSTS = ["localhost"]
ALLOWED_HOSTS = ["localhost", "127.0.0.1"]

Check warning on line 153 in upsonic_on_prem/dash/dash/settings.py

View workflow job for this annotation

GitHub Actions / Qodana Community for Python

Redeclared names without usages

Redeclared 'ALLOWED_HOSTS' defined above without usage
CSRF_TRUSTED_ORIGINS = os.environ.get("dash_origins", "").split(",")
9 changes: 7 additions & 2 deletions upsonic_on_prem/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
import traceback
from waitress import serve

if __name__ == "__main__":
import sys
import os

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))



from upsonic_on_prem.api import app

Expand All @@ -31,8 +38,6 @@ def starter():
except:

Check notice on line 38 in upsonic_on_prem/main.py

View workflow job for this annotation

GitHub Actions / Qodana Community for Python

Unclear exception clauses

Too broad exception clause
traceback.print_exc()

print(storage.get("test"))

threading.Thread(target=starter).start() # pragma: no cover


Expand Down
3 changes: 0 additions & 3 deletions upsonic_on_prem/utils/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
info("Connecting to Redis")



#Check if sudo is used

def can_access_to_config():
try:
os.listdir("/etc/redis/")
Expand Down
1 change: 0 additions & 1 deletion upsonic_on_prem/utils/db/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def set(self, key, value):




def pop(self):
return self.redis.flushdb()

Expand Down

0 comments on commit dd5a243

Please sign in to comment.