mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-14 17:03:29 +03:00
feat(sentry): remove health endpoint (#2257)
This pull request removes the healthz endpoint from the Sentry integration. The `before_send` function has been updated to drop transaction events that contain 'healthz' in the transaction name. This change ensures that healthz transactions are not sent to Sentry.
This commit is contained in:
parent
29da8c70b0
commit
166b823d25
@ -38,6 +38,17 @@ if os.getenv("DEV_MODE") == "true":
|
||||
debugpy.listen(("0.0.0.0", 5678))
|
||||
|
||||
|
||||
def before_send(event, hint):
|
||||
# If this is a transaction event
|
||||
if event["type"] == "transaction":
|
||||
# And the transaction name contains 'healthz'
|
||||
if "healthz" in event["transaction"]:
|
||||
# Drop the event by returning None
|
||||
return None
|
||||
# For other events, return them as is
|
||||
return event
|
||||
|
||||
|
||||
sentry_dsn = os.getenv("SENTRY_DSN")
|
||||
if sentry_dsn:
|
||||
sentry_sdk.init(
|
||||
@ -46,9 +57,10 @@ if sentry_dsn:
|
||||
enable_tracing=True,
|
||||
traces_sample_rate=0.1,
|
||||
integrations=[
|
||||
StarletteIntegration(transaction_style="endpoint"),
|
||||
FastApiIntegration(transaction_style="endpoint"),
|
||||
StarletteIntegration(transaction_style="url"),
|
||||
FastApiIntegration(transaction_style="url"),
|
||||
],
|
||||
before_send=before_send,
|
||||
)
|
||||
|
||||
app = FastAPI()
|
||||
|
Loading…
Reference in New Issue
Block a user