Skip to content

Commit dbc6d93

Browse files
authored
Merge pull request #174 from mormahr/dont-sample-health-route
Disable samping for /health endpoint
2 parents 6adf39a + afb7646 commit dbc6d93

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Summary: WeasyPrint v53, ARM multi-arch and much smaller image.
2929
[#170](https://github.com/mormahr/pdf-service/pull/170)
3030
- Using [tini](https://github.com/krallin/tini) as the entrypoint
3131
[#134](https://github.com/mormahr/pdf-service/pull/134)
32+
- Disabled Sentry performance sampling of `/health` endpoint
33+
[#174](https://github.com/mormahr/pdf-service/pull/174)
3234

3335
## [1.1.0] - 2021-09-01
3436
**WeasyPrint: v52.5**

pdf_service/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from sentry_sdk import init
2+
from sentry_sdk import init, configure_scope
33
from flask import Flask, make_response
44
from sentry_sdk.integrations.flask import FlaskIntegration
55
from sentry_sdk.integrations.logging import LoggingIntegration
@@ -33,6 +33,10 @@ def generate_pdf():
3333

3434
@pdf_service.route('/health', methods=['GET'])
3535
def health():
36+
with configure_scope() as scope:
37+
if scope.transaction:
38+
scope.transaction.sampled = False
39+
3640
response = make_response("Healthy")
3741
return response
3842

0 commit comments

Comments
 (0)