Skip to content

Commit f76b02d

Browse files
authored
ref: Rename only_if_parent to only_as_child_span (#4617)
1 parent d032604 commit f76b02d

40 files changed

+76
-70
lines changed

sentry_sdk/ai/monitoring.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def sync_wrapped(*args: Any, **kwargs: Any) -> Any:
3131
op = span_kwargs.pop("op", "ai.run" if curr_pipeline else "ai.pipeline")
3232

3333
with start_span(
34-
name=description, op=op, only_if_parent=True, **span_kwargs
34+
name=description, op=op, only_as_child_span=True, **span_kwargs
3535
) as span:
3636
for k, v in kwargs.pop("sentry_tags", {}).items():
3737
span.set_tag(k, v)
@@ -61,7 +61,7 @@ async def async_wrapped(*args: Any, **kwargs: Any) -> Any:
6161
op = span_kwargs.pop("op", "ai.run" if curr_pipeline else "ai.pipeline")
6262

6363
with start_span(
64-
name=description, op=op, only_if_parent=True, **span_kwargs
64+
name=description, op=op, only_as_child_span=True, **span_kwargs
6565
) as span:
6666
for k, v in kwargs.pop("sentry_tags", {}).items():
6767
span.set_tag(k, v)

sentry_sdk/integrations/aiohttp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ async def on_request_start(
238238
name="%s %s"
239239
% (method, parsed_url.url if parsed_url else SENSITIVE_DATA_SUBSTITUTE),
240240
origin=AioHttpIntegration.origin,
241-
only_if_parent=True,
241+
only_as_child_span=True,
242242
)
243243

244244
data = {

sentry_sdk/integrations/anthropic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def _sentry_patched_create_common(f: Any, *args: Any, **kwargs: Any) -> Any:
161161
op=OP.ANTHROPIC_MESSAGES_CREATE,
162162
description="Anthropic messages create",
163163
origin=AnthropicIntegration.origin,
164-
only_if_parent=True,
164+
only_as_child_span=True,
165165
)
166166
span.__enter__()
167167

sentry_sdk/integrations/arq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ async def _sentry_enqueue_job(
8181
op=OP.QUEUE_SUBMIT_ARQ,
8282
name=function,
8383
origin=ArqIntegration.origin,
84-
only_if_parent=True,
84+
only_as_child_span=True,
8585
):
8686
return await old_enqueue_job(self, function, *args, **kwargs)
8787

sentry_sdk/integrations/asyncio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async def _task_with_sentry_span_creation() -> Any:
4949
op=OP.FUNCTION,
5050
name=get_name(coro),
5151
origin=AsyncioIntegration.origin,
52-
only_if_parent=True,
52+
only_as_child_span=True,
5353
):
5454
try:
5555
result = await coro

sentry_sdk/integrations/asyncpg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ async def _inner(*args: Any, **kwargs: Any) -> T:
166166
op=OP.DB,
167167
name="connect",
168168
origin=AsyncPGIntegration.origin,
169-
only_if_parent=True,
169+
only_as_child_span=True,
170170
) as span:
171171
data = _get_db_data(
172172
addr=kwargs.get("addr"),

sentry_sdk/integrations/boto3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _sentry_request_created(
6666
op=OP.HTTP_CLIENT,
6767
name=description,
6868
origin=Boto3Integration.origin,
69-
only_if_parent=True,
69+
only_as_child_span=True,
7070
)
7171

7272
data = {
@@ -120,7 +120,7 @@ def _sentry_after_call(
120120
op=OP.HTTP_CLIENT_STREAM,
121121
name=span.name,
122122
origin=Boto3Integration.origin,
123-
only_if_parent=True,
123+
only_as_child_span=True,
124124
)
125125

126126
orig_read = body.read

sentry_sdk/integrations/celery/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def apply_async(*args: Any, **kwargs: Any) -> Any:
269269
op=OP.QUEUE_SUBMIT_CELERY,
270270
name=task_name,
271271
origin=CeleryIntegration.origin,
272-
only_if_parent=True,
272+
only_as_child_span=True,
273273
)
274274
if not task_started_from_beat
275275
else NoOpMgr()
@@ -354,7 +354,7 @@ def _inner(*args: Any, **kwargs: Any) -> Any:
354354
op=OP.QUEUE_PROCESS,
355355
name=task.name,
356356
origin=CeleryIntegration.origin,
357-
only_if_parent=True,
357+
only_as_child_span=True,
358358
) as span:
359359
_set_messaging_destination_name(task, span)
360360

@@ -479,7 +479,7 @@ def sentry_publish(self: Producer, *args: Any, **kwargs: Any) -> Any:
479479
op=OP.QUEUE_PUBLISH,
480480
name=task_name,
481481
origin=CeleryIntegration.origin,
482-
only_if_parent=True,
482+
only_as_child_span=True,
483483
) as span:
484484
if task_id is not None:
485485
span.set_attribute(SPANDATA.MESSAGING_MESSAGE_ID, task_id)

sentry_sdk/integrations/clickhouse_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _inner(*args: P.args, **kwargs: P.kwargs) -> T:
7171
op=OP.DB,
7272
name=query,
7373
origin=ClickhouseDriverIntegration.origin,
74-
only_if_parent=True,
74+
only_as_child_span=True,
7575
)
7676

7777
connection._sentry_span = span # type: ignore[attr-defined]

sentry_sdk/integrations/cohere.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def new_chat(*args: Any, **kwargs: Any) -> Any:
144144
op=consts.OP.COHERE_CHAT_COMPLETIONS_CREATE,
145145
name="cohere.client.Chat",
146146
origin=CohereIntegration.origin,
147-
only_if_parent=True,
147+
only_as_child_span=True,
148148
)
149149
span.__enter__()
150150
try:
@@ -228,7 +228,7 @@ def new_embed(*args: Any, **kwargs: Any) -> Any:
228228
op=consts.OP.COHERE_EMBEDDINGS_CREATE,
229229
name="Cohere Embedding Creation",
230230
origin=CohereIntegration.origin,
231-
only_if_parent=True,
231+
only_as_child_span=True,
232232
) as span:
233233
if "texts" in kwargs and (
234234
should_send_default_pii() and integration.include_prompts

0 commit comments

Comments
 (0)