diff --git a/.cspell.json b/.cspell.json index 0c03406dea2..564bc62e346 100644 --- a/.cspell.json +++ b/.cspell.json @@ -391,6 +391,7 @@ "toastr", "TOOLSDIRECTORY", "traefik", + "travelerdev", "trufflehog", "trufflesecurity", "tsbuildinfo", diff --git a/.deploy/webapp/Dockerfile b/.deploy/webapp/Dockerfile index 42b8be601a4..3d13716b3de 100644 --- a/.deploy/webapp/Dockerfile +++ b/.deploy/webapp/Dockerfile @@ -9,6 +9,7 @@ ARG CLIENT_BASE_URL ARG GAUZY_CLOUD_APP ARG SENTRY_DSN ARG SENTRY_TRACES_SAMPLE_RATE +ARG SENTRY_PROFILE_SAMPLE_RATE ARG CHATWOOT_SDK_TOKEN ARG CHAT_MESSAGE_GOOGLE_MAP ARG CLOUDINARY_CLOUD_NAME @@ -130,6 +131,7 @@ ENV DEMO=${DEMO:-false} ENV SENTRY_DSN=${SENTRY_DSN} ENV SENTRY_TRACES_SAMPLE_RATE=${SENTRY_TRACES_SAMPLE_RATE} +ENV SENTRY_PROFILE_SAMPLE_RATE=${SENTRY_PROFILE_SAMPLE_RATE} ENV CHATWOOT_SDK_TOKEN=${CHATWOOT_SDK_TOKEN} ENV CLOUDINARY_CLOUD_NAME=${CLOUDINARY_CLOUD_NAME} ENV CLOUDINARY_API_KEY=${CLOUDINARY_API_KEY} diff --git a/.env.compose b/.env.compose index 1e0f466de97..eb82b539671 100644 --- a/.env.compose +++ b/.env.compose @@ -95,7 +95,7 @@ TEAM_JOIN_REQUEST_EXPIRATION_TIME=86400 # Rate Limiting THROTTLE_ENABLED=true THROTTLE_TTL=60 -THROTTLE_LIMIT=10000 +THROTTLE_LIMIT=60000 # Twitter OAuth Configuration TWITTER_CLIENT_ID=XXXXXXX diff --git a/.env.demo.compose b/.env.demo.compose index eeec98806b3..677b1f3361e 100644 --- a/.env.demo.compose +++ b/.env.demo.compose @@ -97,7 +97,7 @@ TEAM_JOIN_REQUEST_EXPIRATION_TIME=86400 # Rate Limiting THROTTLE_ENABLED=true THROTTLE_TTL=60 -THROTTLE_LIMIT=10000 +THROTTLE_LIMIT=60000 # Twitter OAuth Configuration TWITTER_CLIENT_ID=XXXXXXX diff --git a/.env.docker b/.env.docker index eb465214fcc..3644509cfb7 100644 --- a/.env.docker +++ b/.env.docker @@ -94,7 +94,7 @@ TEAM_JOIN_REQUEST_EXPIRATION_TIME=86400 # Rate Limiting THROTTLE_ENABLED=true THROTTLE_TTL=60 -THROTTLE_LIMIT=10000 +THROTTLE_LIMIT=60000 # Twitter OAuth Configuration TWITTER_CLIENT_ID=XXXXXXX diff --git a/.env.local b/.env.local index 59b91acc7e0..be877b61588 100644 --- a/.env.local +++ b/.env.local @@ -94,7 +94,7 @@ TEAM_JOIN_REQUEST_EXPIRATION_TIME=86400 # Rate Limiting THROTTLE_ENABLED=true THROTTLE_TTL=60 -THROTTLE_LIMIT=10000 +THROTTLE_LIMIT=60000 # Twitter OAuth Configuration TWITTER_CLIENT_ID= @@ -206,7 +206,8 @@ SENTRY_DSN=https://7cd381188b6f446ca0e69185227b9031@o51327.ingest.sentry.io/4397 SENTRY_HTTP_TRACING_ENABLED=false SENTRY_POSTGRES_TRACKING_ENABLED=false SENTRY_PROFILING_ENABLED=false -SENTRY_TRACES_SAMPLE_RATE=0.1 +SENTRY_TRACES_SAMPLE_RATE=1 +SENTRY_PROFILE_SAMPLE_RATE=1 # Default Currency DEFAULT_CURRENCY=USD diff --git a/.env.sample b/.env.sample index 2c0f938bb4b..6254f0277ac 100644 --- a/.env.sample +++ b/.env.sample @@ -78,7 +78,7 @@ TEAM_JOIN_REQUEST_EXPIRATION_TIME=86400 # Rate Limiting THROTTLE_ENABLED=true THROTTLE_TTL=60 -THROTTLE_LIMIT=10000 +THROTTLE_LIMIT=60000 # Twitter OAuth Configuration TWITTER_CLIENT_ID=XXXXXXX @@ -207,6 +207,7 @@ SENTRY_HTTP_TRACING_ENABLED= SENTRY_POSTGRES_TRACKING_ENABLED= SENTRY_PROFILING_ENABLED= SENTRY_TRACES_SAMPLE_RATE= +SENTRY_PROFILE_SAMPLE_RATE= # Default Currency DEFAULT_CURRENCY=USD diff --git a/.github/workflows/deploy-civo-demo.yml b/.github/workflows/deploy-civo-demo.yml index 93682744ca4..1510db802f8 100644 --- a/.github/workflows/deploy-civo-demo.yml +++ b/.github/workflows/deploy-civo-demo.yml @@ -41,6 +41,7 @@ jobs: CLOUD_PROVIDER: 'CIVO' SENTRY_DSN: '${{ secrets.SENTRY_DSN }}' SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/deploy-civo-prod.yml b/.github/workflows/deploy-civo-prod.yml index dad900f2db7..4c023141bca 100644 --- a/.github/workflows/deploy-civo-prod.yml +++ b/.github/workflows/deploy-civo-prod.yml @@ -58,6 +58,7 @@ jobs: CLOUD_PROVIDER: 'CIVO' SENTRY_DSN: '${{ secrets.SENTRY_DSN }}' SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/deploy-civo-stage.yml b/.github/workflows/deploy-civo-stage.yml index b23d6cebe7d..1df8baf17e6 100644 --- a/.github/workflows/deploy-civo-stage.yml +++ b/.github/workflows/deploy-civo-stage.yml @@ -59,6 +59,7 @@ jobs: CLOUD_PROVIDER: 'CIVO' SENTRY_DSN: '${{ secrets.SENTRY_DSN }}' SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/deploy-cw-demo.yml b/.github/workflows/deploy-cw-demo.yml index f4aa228674b..3f1eb1c8168 100644 --- a/.github/workflows/deploy-cw-demo.yml +++ b/.github/workflows/deploy-cw-demo.yml @@ -41,6 +41,7 @@ jobs: DB_NAME: '${{ secrets.DB_NAME }}' SENTRY_DSN: '${{ secrets.SENTRY_DSN }}' SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/deploy-cw-prod.yml b/.github/workflows/deploy-cw-prod.yml index 6ac03e48e5a..5777796381f 100644 --- a/.github/workflows/deploy-cw-prod.yml +++ b/.github/workflows/deploy-cw-prod.yml @@ -58,6 +58,7 @@ jobs: CLOUD_PROVIDER: 'CW' SENTRY_DSN: '${{ secrets.SENTRY_DSN }}' SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/deploy-cw-stage.yml b/.github/workflows/deploy-cw-stage.yml index fe7707174ff..4f2afc47705 100644 --- a/.github/workflows/deploy-cw-stage.yml +++ b/.github/workflows/deploy-cw-stage.yml @@ -59,6 +59,7 @@ jobs: CLOUD_PROVIDER: 'CW' SENTRY_DSN: '${{ secrets.SENTRY_DSN }}' SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/deploy-do-demo.yml b/.github/workflows/deploy-do-demo.yml index 5fe6e37ba1e..0b8b90b3ecc 100644 --- a/.github/workflows/deploy-do-demo.yml +++ b/.github/workflows/deploy-do-demo.yml @@ -37,6 +37,7 @@ jobs: DB_NAME: '${{ secrets.DB_NAME }}' SENTRY_DSN: '${{ secrets.SENTRY_DSN }}' SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/deploy-do-prod.yml b/.github/workflows/deploy-do-prod.yml index c76d993546a..d2fe46c3b79 100644 --- a/.github/workflows/deploy-do-prod.yml +++ b/.github/workflows/deploy-do-prod.yml @@ -53,6 +53,7 @@ jobs: CLOUD_PROVIDER: 'DO' SENTRY_DSN: '${{ secrets.SENTRY_DSN }}' SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/deploy-do-stage.yml b/.github/workflows/deploy-do-stage.yml index 4d56048951e..854b752a618 100644 --- a/.github/workflows/deploy-do-stage.yml +++ b/.github/workflows/deploy-do-stage.yml @@ -54,6 +54,7 @@ jobs: CLOUD_PROVIDER: 'DO' SENTRY_DSN: '${{ secrets.SENTRY_DSN }}' SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/desktop-app-prod.yml b/.github/workflows/desktop-app-prod.yml index 520d3841cfa..7becb0982f4 100644 --- a/.github/workflows/desktop-app-prod.yml +++ b/.github/workflows/desktop-app-prod.yml @@ -65,6 +65,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' @@ -119,6 +120,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' @@ -173,6 +175,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/desktop-app-stage.yml b/.github/workflows/desktop-app-stage.yml index f7fc585f580..091134ccd04 100644 --- a/.github/workflows/desktop-app-stage.yml +++ b/.github/workflows/desktop-app-stage.yml @@ -65,6 +65,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' @@ -119,6 +120,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' @@ -173,6 +175,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/desktop-timer-app-prod.yml b/.github/workflows/desktop-timer-app-prod.yml index 33d6cf0658f..83ef668d53d 100644 --- a/.github/workflows/desktop-timer-app-prod.yml +++ b/.github/workflows/desktop-timer-app-prod.yml @@ -71,6 +71,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' @@ -131,6 +132,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' @@ -191,6 +193,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/desktop-timer-app-stage.yml b/.github/workflows/desktop-timer-app-stage.yml index c70845b7126..b7c2ad9a5c9 100644 --- a/.github/workflows/desktop-timer-app-stage.yml +++ b/.github/workflows/desktop-timer-app-stage.yml @@ -71,6 +71,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' @@ -131,6 +132,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' @@ -191,6 +193,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/server-prod.yml b/.github/workflows/server-prod.yml index e23b9799cd6..26a14120fe5 100644 --- a/.github/workflows/server-prod.yml +++ b/.github/workflows/server-prod.yml @@ -65,6 +65,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' @@ -119,6 +120,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' @@ -173,6 +175,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/.github/workflows/server-stage.yml b/.github/workflows/server-stage.yml index b6039cf4b2e..d65df43c088 100644 --- a/.github/workflows/server-stage.yml +++ b/.github/workflows/server-stage.yml @@ -65,6 +65,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' @@ -119,6 +120,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' @@ -173,6 +175,7 @@ jobs: EP_GH_IGNORE_TIME: true SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_TRACES_SAMPLE_RATE: '${{ secrets.SENTRY_TRACES_SAMPLE_RATE }}' + SENTRY_PROFILE_SAMPLE_RATE: '${{ secrets.SENTRY_PROFILE_SAMPLE_RATE }}' SENTRY_HTTP_TRACING_ENABLED: '${{ secrets.SENTRY_HTTP_TRACING_ENABLED }}' SENTRY_POSTGRES_TRACKING_ENABLED: '${{ secrets.SENTRY_POSTGRES_TRACKING_ENABLED }}' SENTRY_PROFILING_ENABLED: '${{ secrets.SENTRY_PROFILING_ENABLED }}' diff --git a/docker-compose.build.yml b/docker-compose.build.yml index 3d3900612eb..85dfb92d576 100644 --- a/docker-compose.build.yml +++ b/docker-compose.build.yml @@ -297,6 +297,7 @@ services: CLIENT_BASE_URL: ${CLIENT_BASE_URL:-http://localhost:4200} SENTRY_DSN: ${SENTRY_DSN:-} SENTRY_TRACES_SAMPLE_RATE: ${SENTRY_TRACES_SAMPLE_RATE:-0.1} + SENTRY_PROFILE_SAMPLE_RATE: ${SENTRY_PROFILE_SAMPLE_RATE:-1} CHATWOOT_SDK_TOKEN: ${CHATWOOT_SDK_TOKEN:-} CLOUDINARY_CLOUD_NAME: ${CLOUDINARY_CLOUD_NAME:-} CLOUDINARY_API_KEY: ${CLOUDINARY_API_KEY:-} @@ -323,6 +324,7 @@ services: CLIENT_BASE_URL: ${CLIENT_BASE_URL:-http://localhost:4200} SENTRY_DSN: ${SENTRY_DSN:-} SENTRY_TRACES_SAMPLE_RATE: ${SENTRY_TRACES_SAMPLE_RATE:-0.1} + SENTRY_PROFILE_SAMPLE_RATE: ${SENTRY_PROFILE_SAMPLE_RATE:-1} CHATWOOT_SDK_TOKEN: ${CHATWOOT_SDK_TOKEN:-} CLOUDINARY_CLOUD_NAME: ${CLOUDINARY_CLOUD_NAME:-} CLOUDINARY_API_KEY: ${CLOUDINARY_API_KEY:-} diff --git a/docker-compose.demo.yml b/docker-compose.demo.yml index 0dc5d9b5e3e..dcc369ded4d 100644 --- a/docker-compose.demo.yml +++ b/docker-compose.demo.yml @@ -93,6 +93,7 @@ services: CLIENT_BASE_URL: ${CLIENT_BASE_URL:-http://localhost:4200} SENTRY_DSN: ${SENTRY_DSN:-} SENTRY_TRACES_SAMPLE_RATE: ${SENTRY_TRACES_SAMPLE_RATE:-0.1} + SENTRY_PROFILE_SAMPLE_RATE: ${SENTRY_PROFILE_SAMPLE_RATE:-1} CHATWOOT_SDK_TOKEN: ${CHATWOOT_SDK_TOKEN:-} CLOUDINARY_CLOUD_NAME: ${CLOUDINARY_CLOUD_NAME:-} CLOUDINARY_API_KEY: ${CLOUDINARY_API_KEY:-} diff --git a/docker-compose.yml b/docker-compose.yml index 582cfb876bc..14dcfb1cb14 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -289,6 +289,7 @@ services: CLIENT_BASE_URL: ${CLIENT_BASE_URL:-http://localhost:4200} SENTRY_DSN: ${SENTRY_DSN:-} SENTRY_TRACES_SAMPLE_RATE: ${SENTRY_TRACES_SAMPLE_RATE:-0.1} + SENTRY_PROFILE_SAMPLE_RATE: ${SENTRY_PROFILE_SAMPLE_RATE:-1} CHATWOOT_SDK_TOKEN: ${CHATWOOT_SDK_TOKEN:-} CLOUDINARY_CLOUD_NAME: ${CLOUDINARY_CLOUD_NAME:-} CLOUDINARY_API_KEY: ${CLOUDINARY_API_KEY:-} diff --git a/packages/config/src/environments/environment.prod.ts b/packages/config/src/environments/environment.prod.ts index 8f630250399..bec6d68d0d8 100644 --- a/packages/config/src/environments/environment.prod.ts +++ b/packages/config/src/environments/environment.prod.ts @@ -52,7 +52,7 @@ export const environment: IEnvironment = { * Throttler (Rate Limiting) Options */ THROTTLE_TTL: parseInt(process.env.THROTTLE_TTL) || 60, // now it's 60 seconds, but in future versions of Throttle going to be 60ms! - THROTTLE_LIMIT: parseInt(process.env.THROTTLE_LIMIT) || 10000, + THROTTLE_LIMIT: parseInt(process.env.THROTTLE_LIMIT) || 60000, /** * Jitsu Server Configuration diff --git a/packages/config/src/environments/environment.ts b/packages/config/src/environments/environment.ts index 5f324c052b0..e283f2ce88a 100644 --- a/packages/config/src/environments/environment.ts +++ b/packages/config/src/environments/environment.ts @@ -56,7 +56,7 @@ export const environment: IEnvironment = { * Throttler (Rate Limiting) Options */ THROTTLE_TTL: parseInt(process.env.THROTTLE_TTL) || 60, // now it's 60 seconds, but in future versions of Throttle going to be 60ms! - THROTTLE_LIMIT: parseInt(process.env.THROTTLE_LIMIT) || 10000, + THROTTLE_LIMIT: parseInt(process.env.THROTTLE_LIMIT) || 60000, THROTTLE_ENABLED: process.env.THROTTLE_ENABLED == 'true', /** diff --git a/packages/core/src/app.module.ts b/packages/core/src/app.module.ts index 4cb695d3748..0095492d713 100644 --- a/packages/core/src/app.module.ts +++ b/packages/core/src/app.module.ts @@ -1,13 +1,15 @@ import { Module } from '@nestjs/common'; -import { APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core'; +import { APP_GUARD, APP_INTERCEPTOR, HttpAdapterHost } from '@nestjs/core'; import { MulterModule } from '@nestjs/platform-express'; import { ThrottlerModule, ThrottlerModuleOptions } from '@nestjs/throttler'; import { ThrottlerBehindProxyGuard } from 'throttler/throttler-behind-proxy.guard'; -import { GraphqlInterceptor, SentryInterceptor, SentryModule } from '@ntegral/nestjs-sentry'; +import { SentryModule } from '@ntegral/nestjs-sentry'; +import { GraphqlInterceptor } from '@ntegral/nestjs-sentry'; import { ServeStaticModule, ServeStaticModuleOptions } from '@nestjs/serve-static'; import { HeaderResolver, I18nModule } from 'nestjs-i18n'; import { Integrations } from '@sentry/node'; import { ProfilingIntegration } from '@sentry/profiling-node'; +import { SentryCustomInterceptor } from './core/sentry/sentry-custom.interceptor'; import { initialize as initializeUnleash, InMemStorageProvider, UnleashConfig } from 'unleash-client'; import { LanguagesEnum } from '@gauzy/contracts'; import { ConfigService, environment } from '@gauzy/config'; @@ -189,25 +191,48 @@ if (environment.sentry && environment.sentry.dsn) { if (process.env.SENTRY_HTTP_TRACING_ENABLED === 'true') { sentryIntegrations.push( // enable HTTP calls tracing - new Integrations.Http({ tracing: true }) + new Integrations.Http({ + tracing: true, + breadcrumbs: true + }) ); + console.log('Sentry HTTP Tracing Enabled'); } if (process.env.SENTRY_POSTGRES_TRACKING_ENABLED === 'true') { if (process.env.DB_TYPE === 'postgres') { sentryIntegrations.push(new Integrations.Postgres()); + console.log('Sentry Postgres Tracking Enabled'); } } if (process.env.SENTRY_PROFILING_ENABLED === 'true') { sentryIntegrations.push(new ProfilingIntegration()); + console.log('Sentry Profiling Enabled'); } + sentryIntegrations.push(new Integrations.Console()); + console.log('Sentry Console Enabled'); + sentryIntegrations.push(new Integrations.GraphQL()); - sentryIntegrations.push(new Integrations.Apollo()); + console.log('Sentry GraphQL Enabled'); + + sentryIntegrations.push(new Integrations.Apollo({ useNestjs: true })); + console.log('Sentry Apollo Enabled'); + + sentryIntegrations.push( + new Integrations.LocalVariables({ + captureAllExceptions: true + }) + ); + console.log('Sentry Local Variables Enabled'); - // TODO: we can also integrate Express routes, but not sure how to pass here app instance - // sentryIntegrations.push(new Integrations.Express()); + sentryIntegrations.push( + new Integrations.RequestData({ + ip: true + }) + ); + console.log('Sentry Request Data Enabled'); } @Module({ @@ -230,22 +255,35 @@ if (environment.sentry && environment.sentry.dsn) { }), ...(environment.sentry && environment.sentry.dsn ? [ - SentryModule.forRoot({ - dsn: environment.sentry.dsn, - debug: !environment.production, - environment: environment.production ? 'production' : 'development', - // TODO: we should use some internal function which returns version of Gauzy - release: 'gauzy@' + process.env.npm_package_version, - logLevels: ['error'], - integrations: sentryIntegrations, - tracesSampleRate: process.env.SENTRY_TRACES_SAMPLE_RATE - ? parseInt(process.env.SENTRY_TRACES_SAMPLE_RATE) - : 0.01, - close: { - enabled: true, - // Time in milliseconds to forcefully quit the application - timeout: 3000 - } + SentryModule.forRootAsync({ + inject: [ConfigService, HttpAdapterHost], + useFactory: async (config: ConfigService, host: HttpAdapterHost) => ({ + dsn: environment.sentry.dsn, + debug: process.env.SENTRY_DEBUG === 'true' || !environment.production, + environment: environment.production ? 'production' : 'development', + // TODO: we should use some internal function which returns version of Gauzy + release: 'gauzy@' + process.env.npm_package_version, + logLevels: ['error'], + integrations: [ + ...sentryIntegrations, + host?.httpAdapter + ? new Integrations.Express({ + app: host.httpAdapter.getInstance() + }) + : null + ].filter((i) => !!i), + tracesSampleRate: process.env.SENTRY_TRACES_SAMPLE_RATE + ? parseInt(process.env.SENTRY_TRACES_SAMPLE_RATE) + : 0.01, + profilesSampleRate: process.env.SENTRY_PROFILE_SAMPLE_RATE + ? parseInt(process.env.SENTRY_PROFILE_SAMPLE_RATE) + : 1, + close: { + enabled: true, + // Time in milliseconds to forcefully quit the application + timeout: 3000 + } + }) }) ] : []), @@ -439,17 +477,7 @@ if (environment.sentry && environment.sentry.dsn) { ? [ { provide: APP_INTERCEPTOR, - useFactory: () => - new SentryInterceptor({ - filters: [ - /* Note: It is possible to filter exceptions, e.g. only those that error codes are bigger than 499, but for now we want to see all of them - { - type: HttpException, - filter: (exception: HttpException) => 500 > exception.getStatus() // Only report 500 errors - } - */ - ] - }) + useFactory: () => new SentryCustomInterceptor() }, { provide: APP_INTERCEPTOR, diff --git a/packages/core/src/bootstrap/index.ts b/packages/core/src/bootstrap/index.ts index 851bd9b8ffa..db0e060b920 100644 --- a/packages/core/src/bootstrap/index.ts +++ b/packages/core/src/bootstrap/index.ts @@ -29,9 +29,9 @@ export async function bootstrap(pluginConfig?: Partial): Promise< if (process.env.OTEL_ENABLED === 'true') { // Start tracing using Signoz first await tracer.start(); - console.log('Tracing started'); + console.log('OTEL/Signoz Tracing started'); } else { - console.log('Tracing not enabled'); + console.log('OTEL/Signoz Tracing not enabled'); } const config = await registerPluginConfig(pluginConfig); diff --git a/packages/core/src/core/core.module.ts b/packages/core/src/core/core.module.ts index 23352a05efa..31de2ca1ea9 100644 --- a/packages/core/src/core/core.module.ts +++ b/packages/core/src/core/core.module.ts @@ -4,15 +4,12 @@ // Originally MIT Licensed // - see https://github.com/xmlking/ngx-starter-kit/blob/develop/LICENSE // - original code `Copyright (c) 2018 Sumanth Chinthagunta`; -import { - DynamicModule, - MiddlewareConsumer, - Module, - NestModule -} from '@nestjs/common'; +import { DynamicModule, MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; import * as path from 'path'; import { ConfigService, environment } from '@gauzy/config'; import { RequestContextMiddleware } from './context'; +import { SentryTraceMiddleware } from './sentry/sentry-trace.middleware'; +import { SentryRequestMiddleware } from './sentry/sentry-request.middleware'; import { FileStorageModule } from './file-storage'; import { GraphqlModule } from '../graphql/graphql.module'; import { GraphqlApiModule } from '../graphql/graphql-api.module'; @@ -35,14 +32,8 @@ import { DatabaseModule } from '../database/database.module'; }, typePaths: [ environment.isElectron - ? path.join( - path.resolve(__dirname, '../../../../../../data/'), - '*.gql' - ) - : path.join( - path.resolve(__dirname, '../**/', 'schema'), - '*.gql' - ) + ? path.join(path.resolve(__dirname, '../../../../../../data/'), '*.gql') + : path.join(path.resolve(__dirname, '../**/', 'schema'), '*.gql') ], resolverModule: GraphqlApiModule })) as DynamicModule, @@ -54,5 +45,7 @@ import { DatabaseModule } from '../database/database.module'; export class CoreModule implements NestModule { configure(consumer: MiddlewareConsumer) { consumer.apply(RequestContextMiddleware).forRoutes('*'); + consumer.apply(SentryRequestMiddleware).forRoutes('*'); + consumer.apply(SentryTraceMiddleware).forRoutes('*'); } } diff --git a/packages/core/src/core/sentry/sentry-custom.interceptor.ts b/packages/core/src/core/sentry/sentry-custom.interceptor.ts new file mode 100644 index 00000000000..0435c42ec86 --- /dev/null +++ b/packages/core/src/core/sentry/sentry-custom.interceptor.ts @@ -0,0 +1,48 @@ +import { + CallHandler, + ExecutionContext + // HttpException +} from '@nestjs/common'; +import { + SentryInterceptor + // ,InjectSentry + // ,SentryService +} from '@ntegral/nestjs-sentry'; +import { Handlers } from '@sentry/node'; +import { Observable, catchError, throwError } from 'rxjs'; +// import { EntityNotFoundError } from 'typeorm'; + +export class SentryCustomInterceptor extends SentryInterceptor { + private readonly handler = Handlers.errorHandler(); + + constructor() { + super({ + filters: [ + /* For now let's report all, but later we can filter + { + type: HttpException, + filter: (e: HttpException) => e.getStatus() < 500 + }, + { + type: EntityNotFoundError + } + */ + ] + }); + } + + intercept(context: ExecutionContext, next: CallHandler): Observable { + return next.handle().pipe( + catchError((error) => { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + if (this.shouldReport(error)) { + const http = context.switchToHttp(); + this.handler(error, http.getRequest(), http.getResponse(), () => {}); + } + + return throwError(() => error); + }) + ); + } +} diff --git a/packages/core/src/core/sentry/sentry-request.middleware.ts b/packages/core/src/core/sentry/sentry-request.middleware.ts new file mode 100644 index 00000000000..a088f71a291 --- /dev/null +++ b/packages/core/src/core/sentry/sentry-request.middleware.ts @@ -0,0 +1,21 @@ +import { Injectable, NestMiddleware } from '@nestjs/common'; +import { InjectSentry, SentryService } from '@ntegral/nestjs-sentry'; +import { Handlers } from '@sentry/node'; +import { NextFunction, Request, Response } from 'express'; + +@Injectable() +export class SentryRequestMiddleware implements NestMiddleware { + private readonly handler = Handlers.requestHandler({ + include: { + ip: true, + user: true, + request: true, + transaction: 'methodPath' + } + }); + + constructor(@InjectSentry() private readonly sentry: SentryService) {} + use(req: Request, res: Response, next: NextFunction): void { + this.handler(req, res, next); + } +} diff --git a/packages/core/src/core/sentry/sentry-trace.middleware.ts b/packages/core/src/core/sentry/sentry-trace.middleware.ts new file mode 100644 index 00000000000..fd3eb94d213 --- /dev/null +++ b/packages/core/src/core/sentry/sentry-trace.middleware.ts @@ -0,0 +1,14 @@ +import { Injectable, NestMiddleware } from '@nestjs/common'; +import { InjectSentry, SentryService } from '@ntegral/nestjs-sentry'; +import { Handlers } from '@sentry/node'; +import { NextFunction, Request, Response } from 'express'; + +@Injectable() +export class SentryTraceMiddleware implements NestMiddleware { + private readonly handler = Handlers.tracingHandler(); + + constructor(@InjectSentry() private readonly sentry: SentryService) {} + use(req: Request, res: Response, next: NextFunction): void { + this.handler(req, res, next); + } +} diff --git a/packages/core/src/throttler/throttler-behind-proxy.guard.ts b/packages/core/src/throttler/throttler-behind-proxy.guard.ts index 72c5d851451..8211606b592 100644 --- a/packages/core/src/throttler/throttler-behind-proxy.guard.ts +++ b/packages/core/src/throttler/throttler-behind-proxy.guard.ts @@ -17,13 +17,13 @@ export class ThrottlerBehindProxyGuard extends ThrottlerGuard { } } else { tracker = req.ips.length > 0 ? req.ips[0] : req.ip; - if (!environment.production) { + if (!environment.production && tracker !== '::1') { console.log(`Request IP: ${tracker}`); } } } else { tracker = req.ips.length > 0 ? req.ips[0] : req.ip; - if (!environment.production) { + if (!environment.production && tracker !== '::1') { console.log(`Request IP: ${tracker}`); } }