Commit ec0bf36c authored by MaksimSmile13's avatar MaksimSmile13 Committed by EKbfh
Browse files

Sentry: Change client

Изменние клиента для sentry: raven - sentry-sdk
Добавление настройки  shutdown_timeout
parent ed360f78
...@@ -506,6 +506,10 @@ class Config(BaseConfig): ...@@ -506,6 +506,10 @@ class Config(BaseConfig):
class sentry(ConfigSection): class sentry(ConfigSection):
url = StringParameter(default="") url = StringParameter(default="")
shutdown_timeout = IntParameter(min=1, max=10, default=2)
default_integrations = BooleanParameter(default=False)
debug = BooleanParameter(default=False)
max_breadcrumbs = IntParameter(min=1, max=100, default=10)
class syslogcollector(ConfigSection): class syslogcollector(ConfigSection):
listen = StringParameter(default="0.0.0.0:514") listen = StringParameter(default="0.0.0.0:514")
......
...@@ -39,14 +39,25 @@ CP_SET_UID = None ...@@ -39,14 +39,25 @@ CP_SET_UID = None
SERVICE_NAME = os.path.relpath(sys.argv[0] or sys.executable) SERVICE_NAME = os.path.relpath(sys.argv[0] or sys.executable)
# Sentry error reporting
if config.features.sentry: if config.features.sentry:
from raven import Client as RavenClient import sentry_sdk
raven_client = RavenClient( def before_send(event, hint):
if "exc_info" not in hint:
return event
exception = hint["exc_info"][1]
event["fingerprint"] = ["{{ type }}", str(exception), error_fingerprint()]
return event
sentry_sdk.init(
config.sentry.url, config.sentry.url,
processors=("raven.processors.SanitizePasswordsProcessor",), shutdown_timeout=config.sentry.shutdown_timeout,
release=version.version, release=version.version,
max_breadcrumbs=config.sentry.max_breadcrumbs,
default_integrations=config.sentry.default_integrations,
debug=config.sentry.debug,
before_send=before_send,
) )
...@@ -268,7 +279,7 @@ def error_report(reverse=config.traceback.reverse, logger=logger): ...@@ -268,7 +279,7 @@ def error_report(reverse=config.traceback.reverse, logger=logger):
metrics["errors"] += 1 metrics["errors"] += 1
if config.sentry.url: if config.sentry.url:
try: try:
raven_client.captureException(fingerprint=[fp]) sentry_sdk.capture_exception()
except Exception as e: except Exception as e:
logger.error("Failed to sent problem report to Sentry: %s", e) logger.error("Failed to sent problem report to Sentry: %s", e)
if ENABLE_CP: if ENABLE_CP:
......
...@@ -83,7 +83,7 @@ supervisor==4.1.0; extra == "supervisor" ...@@ -83,7 +83,7 @@ supervisor==4.1.0; extra == "supervisor"
supervisor-serialrestart==0.1.1; extra == "supervisor" supervisor-serialrestart==0.1.1; extra == "supervisor"
# Additional prod tools # Additional prod tools
alerta==4.7.16; extra == "prod-tools" alerta==4.7.16; extra == "prod-tools"
raven==6.1.0; extra == "prod-tools" sentry-sdk==0.16.5; extra == "prod-tools"
supervisor-wildcards==0.1.3; extra == "prod-tools" supervisor-wildcards==0.1.3; extra == "prod-tools"
# Test # Test
Coverage[toml]==5.0.3; extra == "testing" Coverage[toml]==5.0.3; extra == "testing"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment