Skip to content

Commit

Permalink
Add Sentry to the ingestion server (#1106)
Browse files Browse the repository at this point in the history
  • Loading branch information
krysal authored Apr 3, 2023
1 parent 6a3c97f commit 9290141
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 18 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ services:
- ./ingestion_server:/ingestion_server
env_file:
- ingestion_server/env.docker
- ingestion_server/.env
stdin_open: true
tty: true

Expand Down
1 change: 1 addition & 0 deletions ingestion_server/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ psycopg2 = "~=2.9"
python-decouple = "~=3.8"
PyYAML = "~=6.0"
tldextract = "~=3.3"
sentry-sdk = {extras = ["falcon"], version = "*"}

[requires]
python_version = "3.10"
55 changes: 37 additions & 18 deletions ingestion_server/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions ingestion_server/ingestion_server/api.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
"""A small RPC API server for scheduling data refresh and indexing tasks."""

import logging
import os
import sys
import time
import uuid
from multiprocessing import Process, Value
from urllib.parse import urlparse

import falcon
import sentry_sdk
from falcon.media.validators import jsonschema
from sentry_sdk.integrations.falcon import FalconIntegration

from ingestion_server import slack
from ingestion_server.constants.media_types import MEDIA_TYPES, MediaType
Expand All @@ -23,6 +26,15 @@
CALLBACK_URL = "callback_url"
SINCE_DATE = "since_date"

sentry_sdk.init(
dsn=os.environ.get("SENTRY_DSN"),
integrations=[
FalconIntegration(),
],
traces_sample_rate=os.environ.get("SENTRY_SAMPLE_RATE", 1.0),
environment=os.environ.get("ENVIRONMENT"),
)


class HealthResource:
@staticmethod
Expand Down

0 comments on commit 9290141

Please sign in to comment.