From 405337da272c462adaecced8ce1a865ebec709b6 Mon Sep 17 00:00:00 2001 From: Stepan Vladovskii Date: Sat, 27 Jan 2024 21:45:24 -0300 Subject: [PATCH 1/5] feat: add Sentry Reddis perfomance monitoring --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index df42d056..190fb497 100644 --- a/main.py +++ b/main.py @@ -26,7 +26,11 @@ schema = make_executable_schema(load_schema_from_path('schemas/core.graphql'), r async def start_up(): print(f'[main] starting in {MODE} mode') - await redis.connect() + with sentry_sdk.start_transaction( + op="task", + name="Redis Connection" + ): + await redis.connect() # start viewed service await ViewedStorage.init() From 2c9155cd5498dbb357fe02e94f90e089a2ed9543 Mon Sep 17 00:00:00 2001 From: Stepan Vladovskii Date: Sat, 27 Jan 2024 21:50:13 -0300 Subject: [PATCH 2/5] feat: gitea runner branch feature/core to v2.discours.io/core --- .gitea/workflows/main.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index 6109fd26..a310ab01 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -1,8 +1,5 @@ name: 'Deploy to core' -on: - push: - branches: - - main +on: [push] jobs: deploy: From d7a3c840ea6e478a4c6191d06b1b5af6c1ad7e33 Mon Sep 17 00:00:00 2001 From: Stepan Vladovskii Date: Sat, 27 Jan 2024 21:55:12 -0300 Subject: [PATCH 3/5] feat: gitea runner push branch feature/core to v2.discours.io/core feauter/core --- .gitea/workflows/main.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index a310ab01..25ee8bd7 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -21,8 +21,7 @@ jobs: - name: Push to dokku uses: dokku/github-action@master with: - branch: 'main' + branch: 'feature/core' git_remote_url: 'ssh://dokku@v2.discours.io:22/core' ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} - git_push_flags: '--force' - + git_push_flags: '--force' \ No newline at end of file From 0eef9b3061bf59cdaf7c04b704d6b9f35795e774 Mon Sep 17 00:00:00 2001 From: Stepan Vladovskii Date: Sat, 27 Jan 2024 22:02:22 -0300 Subject: [PATCH 4/5] debug: main.py with import sentry-sdk --- main.py | 1 + pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 190fb497..5496c0c0 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,7 @@ import os from importlib import import_module from os.path import exists +import sentry_sdk from ariadne import load_schema_from_path, make_executable_schema from ariadne.asgi import GraphQL diff --git a/pyproject.toml b/pyproject.toml index 46e2d6f9..90c5f1c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ python = "^3.12" SQLAlchemy = "^2.0.22" psycopg2-binary = "^2.9.9" redis = {extras = ["hiredis"], version = "^5.0.1"} -sentry-sdk = "^1.39.1" +sentry-sdk = "^1.4.1" starlette = "^0.36.1" gql = "^3.4.1" ariadne = "^0.21" From bed2f89964b8147ea0461747e1d7a56a4511c0e9 Mon Sep 17 00:00:00 2001 From: Stepan Vladovskii Date: Sat, 27 Jan 2024 22:11:39 -0300 Subject: [PATCH 5/5] debug: main.py with import sentry-sdk --- main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 5496c0c0..9495cd6a 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,7 @@ import os +import sentry_sdk from importlib import import_module from os.path import exists -import sentry_sdk from ariadne import load_schema_from_path, make_executable_schema from ariadne.asgi import GraphQL @@ -45,8 +45,7 @@ async def start_up(): if MODE == 'production': # sentry monitoring try: - import sentry_sdk - + sentry_sdk.init( SENTRY_DSN, enable_tracing=True,