Skip to content

Commit e73ab4b

Browse files
antonpirkeraliu39mgaligniana
authored
Merge master into potel-base (#4093)
Co-authored-by: Andrew Liu <[email protected]> Co-authored-by: Marcelo Galigniana <[email protected]>
1 parent 1fc4f85 commit e73ab4b

File tree

28 files changed

+124
-97
lines changed

28 files changed

+124
-97
lines changed

.github/workflows/test-integrations-dbs.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ jobs:
5555
with:
5656
python-version: ${{ matrix.python-version }}
5757
allow-prereleases: true
58-
- uses: getsentry/[email protected]
58+
- name: "Setup ClickHouse Server"
59+
uses: getsentry/[email protected]
5960
- name: Setup Test Env
6061
run: |
6162
pip install "coverage[toml]" tox
@@ -140,7 +141,8 @@ jobs:
140141
with:
141142
python-version: ${{ matrix.python-version }}
142143
allow-prereleases: true
143-
- uses: getsentry/[email protected]
144+
- name: "Setup ClickHouse Server"
145+
uses: getsentry/[email protected]
144146
- name: Setup Test Env
145147
run: |
146148
pip install "coverage[toml]" tox

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,7 +2328,7 @@ By: @mgaligniana (#1773)
23282328

23292329
import sentry_sdk
23302330
from sentry_sdk.integrations.arq import ArqIntegration
2331-
from sentry_sdk.tracing import TRANSACTION_SOURCE_COMPONENT
2331+
from sentry_sdk.tracing import TransactionSource
23322332

23332333
sentry_sdk.init(
23342334
dsn="...",
@@ -2348,7 +2348,7 @@ By: @mgaligniana (#1773)
23482348
await ctx['session'].aclose()
23492349

23502350
async def main():
2351-
with sentry_sdk.start_transaction(name="testing_arq_tasks", source=TRANSACTION_SOURCE_COMPONENT):
2351+
with sentry_sdk.start_transaction(name="testing_arq_tasks", source=TransactionSource.COMPONENT):
23522352
redis = await create_pool(RedisSettings())
23532353
for url in ('https://facebook.com', 'https://microsoft.com', 'https://github.com', "asdf"
23542354
):
@@ -2422,7 +2422,7 @@ By: @mgaligniana (#1773)
24222422

24232423
import sentry_sdk
24242424
from sentry_sdk.integrations.huey import HueyIntegration
2425-
from sentry_sdk.tracing import TRANSACTION_SOURCE_COMPONENT, Transaction
2425+
from sentry_sdk.tracing import TransactionSource, Transaction
24262426

24272427

24282428
def main():
@@ -2434,7 +2434,7 @@ By: @mgaligniana (#1773)
24342434
traces_sample_rate=1.0,
24352435
)
24362436

2437-
with sentry_sdk.start_transaction(name="testing_huey_tasks", source=TRANSACTION_SOURCE_COMPONENT):
2437+
with sentry_sdk.start_transaction(name="testing_huey_tasks", source=TransactionSource.COMPONENT):
24382438
r = add_numbers(1, 2)
24392439

24402440
if __name__ == "__main__":

scripts/split_tox_gh_actions/templates/test_group.jinja

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
4848
allow-prereleases: true
4949
{% if needs_clickhouse %}
50-
- uses: getsentry/[email protected]
50+
- name: "Setup ClickHouse Server"
51+
uses: getsentry/[email protected]
5152
{% endif %}
5253

5354
{% if needs_redis %}

sentry_sdk/integrations/aiohttp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from sentry_sdk.tracing import (
2121
BAGGAGE_HEADER_NAME,
2222
SOURCE_FOR_STYLE,
23-
TRANSACTION_SOURCE_ROUTE,
23+
TransactionSource,
2424
)
2525
from sentry_sdk.tracing_utils import should_propagate_trace
2626
from sentry_sdk.utils import (
@@ -136,7 +136,7 @@ async def sentry_app_handle(self, request, *args, **kwargs):
136136
# If this transaction name makes it to the UI, AIOHTTP's
137137
# URL resolver did not find a route or died trying.
138138
name="generic AIOHTTP request",
139-
source=TRANSACTION_SOURCE_ROUTE,
139+
source=TransactionSource.ROUTE,
140140
origin=AioHttpIntegration.origin,
141141
attributes=_prepopulate_attributes(request),
142142
) as span:

sentry_sdk/integrations/arq.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from sentry_sdk.integrations import _check_minimum_version, DidNotEnable, Integration
66
from sentry_sdk.integrations.logging import ignore_logger
77
from sentry_sdk.scope import should_send_default_pii
8-
from sentry_sdk.tracing import TRANSACTION_SOURCE_TASK
8+
from sentry_sdk.tracing import TransactionSource
99
from sentry_sdk.utils import (
1010
capture_internal_exceptions,
1111
ensure_integration_enabled,
@@ -103,14 +103,14 @@ async def _sentry_run_job(self, job_id, score):
103103
scope._name = "arq"
104104
scope.set_transaction_name(
105105
DEFAULT_TRANSACTION_NAME,
106-
source=TRANSACTION_SOURCE_TASK,
106+
source=TransactionSource.TASK,
107107
)
108108
scope.clear_breadcrumbs()
109109

110110
with sentry_sdk.start_span(
111111
op=OP.QUEUE_TASK_ARQ,
112112
name=DEFAULT_TRANSACTION_NAME,
113-
source=TRANSACTION_SOURCE_TASK,
113+
source=TransactionSource.TASK,
114114
origin=ArqIntegration.origin,
115115
) as span:
116116
return_value = await old_run_job(self, job_id, score)

sentry_sdk/integrations/asgi.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
from sentry_sdk.sessions import track_session
2626
from sentry_sdk.tracing import (
2727
SOURCE_FOR_STYLE,
28-
TRANSACTION_SOURCE_ROUTE,
29-
TRANSACTION_SOURCE_URL,
30-
TRANSACTION_SOURCE_COMPONENT,
31-
TRANSACTION_SOURCE_CUSTOM,
28+
TransactionSource,
3229
)
3330
from sentry_sdk.utils import (
3431
ContextVar,
@@ -265,9 +262,9 @@ def event_processor(self, event, hint, asgi_scope):
265262
and "source" in event["transaction_info"]
266263
and event["transaction_info"]["source"]
267264
in [
268-
TRANSACTION_SOURCE_COMPONENT,
269-
TRANSACTION_SOURCE_ROUTE,
270-
TRANSACTION_SOURCE_CUSTOM,
265+
TransactionSource.COMPONENT,
266+
TransactionSource.ROUTE,
267+
TransactionSource.CUSTOM,
271268
]
272269
)
273270
if not already_set:
@@ -306,7 +303,7 @@ def _get_transaction_name_and_source(self, transaction_style, asgi_scope):
306303
name = transaction_from_function(endpoint) or ""
307304
else:
308305
name = _get_url(asgi_scope, "http" if ty == "http" else "ws", host=None)
309-
source = TRANSACTION_SOURCE_URL
306+
source = TransactionSource.URL
310307

311308
elif transaction_style == "url":
312309
# FastAPI includes the route object in the scope to let Sentry extract the
@@ -318,11 +315,11 @@ def _get_transaction_name_and_source(self, transaction_style, asgi_scope):
318315
name = path
319316
else:
320317
name = _get_url(asgi_scope, "http" if ty == "http" else "ws", host=None)
321-
source = TRANSACTION_SOURCE_URL
318+
source = TransactionSource.URL
322319

323320
if name is None:
324321
name = _DEFAULT_TRANSACTION_NAME
325-
source = TRANSACTION_SOURCE_ROUTE
322+
source = TransactionSource.ROUTE
326323
return name, source
327324

328325
return name, source

sentry_sdk/integrations/aws_lambda.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import sentry_sdk
1111
from sentry_sdk.consts import OP
1212
from sentry_sdk.scope import should_send_default_pii
13-
from sentry_sdk.tracing import TRANSACTION_SOURCE_COMPONENT
13+
from sentry_sdk.tracing import TransactionSource
1414
from sentry_sdk.utils import (
1515
AnnotatedValue,
1616
capture_internal_exceptions,
@@ -125,7 +125,7 @@ def sentry_handler(aws_event, aws_context, *args, **kwargs):
125125

126126
with sentry_sdk.isolation_scope() as scope:
127127
scope.set_transaction_name(
128-
aws_context.function_name, source=TRANSACTION_SOURCE_COMPONENT
128+
aws_context.function_name, source=TransactionSource.COMPONENT
129129
)
130130
timeout_thread = None
131131
with capture_internal_exceptions():
@@ -170,7 +170,7 @@ def sentry_handler(aws_event, aws_context, *args, **kwargs):
170170
with sentry_sdk.start_span(
171171
op=OP.FUNCTION_AWS,
172172
name=aws_context.function_name,
173-
source=TRANSACTION_SOURCE_COMPONENT,
173+
source=TransactionSource.COMPONENT,
174174
origin=AwsLambdaIntegration.origin,
175175
attributes=_prepopulate_attributes(request_data, aws_context),
176176
):

sentry_sdk/integrations/celery/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
)
1414
from sentry_sdk.integrations.celery.utils import _now_seconds_since_epoch
1515
from sentry_sdk.integrations.logging import ignore_logger
16-
from sentry_sdk.tracing import BAGGAGE_HEADER_NAME, TRANSACTION_SOURCE_TASK
16+
from sentry_sdk.tracing import BAGGAGE_HEADER_NAME, TransactionSource
1717
from sentry_sdk.tracing_utils import Baggage
1818
from sentry_sdk.utils import (
1919
capture_internal_exceptions,
@@ -306,7 +306,7 @@ def _inner(*args, **kwargs):
306306
with isolation_scope() as scope:
307307
scope._name = "celery"
308308
scope.clear_breadcrumbs()
309-
scope.set_transaction_name(task.name, source=TRANSACTION_SOURCE_TASK)
309+
scope.set_transaction_name(task.name, source=TransactionSource.TASK)
310310
scope.add_event_processor(_make_event_processor(task, *args, **kwargs))
311311

312312
# Celery task objects are not a thing to be trusted. Even
@@ -317,7 +317,7 @@ def _inner(*args, **kwargs):
317317
with sentry_sdk.start_span(
318318
op=OP.QUEUE_TASK_CELERY,
319319
name=task.name,
320-
source=TRANSACTION_SOURCE_TASK,
320+
source=TransactionSource.TASK,
321321
origin=CeleryIntegration.origin,
322322
# for some reason, args[1] is a list if non-empty but a
323323
# tuple if empty

sentry_sdk/integrations/chalice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import sentry_sdk
55
from sentry_sdk.integrations import Integration, DidNotEnable
66
from sentry_sdk.integrations.aws_lambda import _make_request_event_processor
7-
from sentry_sdk.tracing import TRANSACTION_SOURCE_COMPONENT
7+
from sentry_sdk.tracing import TransactionSource
88
from sentry_sdk.utils import (
99
capture_internal_exceptions,
1010
event_from_exception,
@@ -67,7 +67,7 @@ def wrapped_view_function(**function_args):
6767
configured_time = app.lambda_context.get_remaining_time_in_millis()
6868
scope.set_transaction_name(
6969
app.lambda_context.function_name,
70-
source=TRANSACTION_SOURCE_COMPONENT,
70+
source=TransactionSource.COMPONENT,
7171
)
7272

7373
scope.add_event_processor(

sentry_sdk/integrations/django/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from sentry_sdk.consts import OP, SPANDATA
99
from sentry_sdk.scope import add_global_event_processor, should_send_default_pii
1010
from sentry_sdk.serializer import add_global_repr_processor
11-
from sentry_sdk.tracing import SOURCE_FOR_STYLE, TRANSACTION_SOURCE_URL
11+
from sentry_sdk.tracing import SOURCE_FOR_STYLE, TransactionSource
1212
from sentry_sdk.tracing_utils import add_query_source, record_sql_queries
1313
from sentry_sdk.utils import (
1414
AnnotatedValue,
@@ -398,7 +398,7 @@ def _set_transaction_name_and_source(scope, transaction_style, request):
398398

399399
if transaction_name is None:
400400
transaction_name = request.path_info
401-
source = TRANSACTION_SOURCE_URL
401+
source = TransactionSource.URL
402402
else:
403403
source = SOURCE_FOR_STYLE[transaction_style]
404404

0 commit comments

Comments
 (0)