Skip to content

Commit 909fabd

Browse files
authored
Merge branch 'antonpirker/better-aws-tests' into antonpirker/update-aws-tox-setup
2 parents a8ae6b7 + 38fa8c0 commit 909fabd

File tree

29 files changed

+105
-102
lines changed

29 files changed

+105
-102
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ jobs:
5959
with:
6060
python-version: ${{ matrix.python-version }}
6161
allow-prereleases: true
62-
- uses: getsentry/[email protected]
62+
- name: "Setup ClickHouse Server"
63+
uses: getsentry/[email protected]
6364
- name: Setup Test Env
6465
run: |
6566
pip install "coverage[toml]" tox
@@ -154,7 +155,8 @@ jobs:
154155
with:
155156
python-version: ${{ matrix.python-version }}
156157
allow-prereleases: true
157-
- uses: getsentry/[email protected]
158+
- name: "Setup ClickHouse Server"
159+
uses: getsentry/[email protected]
158160
- name: Setup Test Env
159161
run: |
160162
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 (
@@ -129,7 +129,7 @@ async def sentry_app_handle(self, request, *args, **kwargs):
129129
# If this transaction name makes it to the UI, AIOHTTP's
130130
# URL resolver did not find a route or died trying.
131131
name="generic AIOHTTP request",
132-
source=TRANSACTION_SOURCE_ROUTE,
132+
source=TransactionSource.ROUTE,
133133
origin=AioHttpIntegration.origin,
134134
)
135135
with sentry_sdk.start_transaction(

sentry_sdk/integrations/arq.py

Lines changed: 2 additions & 2 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, TRANSACTION_SOURCE_TASK
8+
from sentry_sdk.tracing import Transaction, TransactionSource
99
from sentry_sdk.utils import (
1010
capture_internal_exceptions,
1111
ensure_integration_enabled,
@@ -102,7 +102,7 @@ async def _sentry_run_job(self, job_id, score):
102102
name="unknown arq task",
103103
status="ok",
104104
op=OP.QUEUE_TASK_ARQ,
105-
source=TRANSACTION_SOURCE_TASK,
105+
source=TransactionSource.TASK,
106106
origin=ArqIntegration.origin,
107107
)
108108

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,
@@ -273,9 +270,9 @@ def event_processor(self, event, hint, asgi_scope):
273270
already_set = event["transaction"] != _DEFAULT_TRANSACTION_NAME and event[
274271
"transaction_info"
275272
].get("source") in [
276-
TRANSACTION_SOURCE_COMPONENT,
277-
TRANSACTION_SOURCE_ROUTE,
278-
TRANSACTION_SOURCE_CUSTOM,
273+
TransactionSource.COMPONENT,
274+
TransactionSource.ROUTE,
275+
TransactionSource.CUSTOM,
279276
]
280277
if not already_set:
281278
name, source = self._get_transaction_name_and_source(
@@ -313,7 +310,7 @@ def _get_transaction_name_and_source(self, transaction_style, asgi_scope):
313310
name = transaction_from_function(endpoint) or ""
314311
else:
315312
name = _get_url(asgi_scope, "http" if ty == "http" else "ws", host=None)
316-
source = TRANSACTION_SOURCE_URL
313+
source = TransactionSource.URL
317314

318315
elif transaction_style == "url":
319316
# FastAPI includes the route object in the scope to let Sentry extract the
@@ -325,11 +322,11 @@ def _get_transaction_name_and_source(self, transaction_style, asgi_scope):
325322
name = path
326323
else:
327324
name = _get_url(asgi_scope, "http" if ty == "http" else "ws", host=None)
328-
source = TRANSACTION_SOURCE_URL
325+
source = TransactionSource.URL
329326

330327
if name is None:
331328
name = _DEFAULT_TRANSACTION_NAME
332-
source = TRANSACTION_SOURCE_ROUTE
329+
source = TransactionSource.ROUTE
333330
return name, source
334331

335332
return name, source

sentry_sdk/integrations/aws_lambda.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from sentry_sdk.api import continue_trace
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,
@@ -153,7 +153,7 @@ def sentry_handler(aws_event, aws_context, *args, **kwargs):
153153
headers,
154154
op=OP.FUNCTION_AWS,
155155
name=aws_context.function_name,
156-
source=TRANSACTION_SOURCE_COMPONENT,
156+
source=TransactionSource.COMPONENT,
157157
origin=AwsLambdaIntegration.origin,
158158
)
159159
with sentry_sdk.start_transaction(

sentry_sdk/integrations/celery/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
)
1515
from sentry_sdk.integrations.celery.utils import _now_seconds_since_epoch
1616
from sentry_sdk.integrations.logging import ignore_logger
17-
from sentry_sdk.tracing import BAGGAGE_HEADER_NAME, TRANSACTION_SOURCE_TASK
17+
from sentry_sdk.tracing import BAGGAGE_HEADER_NAME, TransactionSource
1818
from sentry_sdk.tracing_utils import Baggage
1919
from sentry_sdk.utils import (
2020
capture_internal_exceptions,
@@ -319,7 +319,7 @@ def _inner(*args, **kwargs):
319319
headers,
320320
op=OP.QUEUE_TASK_CELERY,
321321
name="unknown celery task",
322-
source=TRANSACTION_SOURCE_TASK,
322+
source=TransactionSource.TASK,
323323
origin=CeleryIntegration.origin,
324324
)
325325
transaction.name = task.name

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)