Skip to content

Commit c2dfdc3

Browse files
committed
Rename _get_pipeline_data to _set_pipeline_data
1 parent 57d1930 commit c2dfdc3

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

sentry_sdk/integrations/redis/_async_common.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from sentry_sdk.integrations.redis.modules.queries import _compile_db_span_properties
99
from sentry_sdk.integrations.redis.utils import (
1010
_set_client_data,
11-
_set_pipeline_data,
11+
_get_pipeline_data,
1212
)
1313
from sentry_sdk.tracing import Span
1414
from sentry_sdk.utils import capture_internal_exceptions
@@ -42,12 +42,11 @@ async def _sentry_execute(self, *args, **kwargs):
4242
) as span:
4343
with capture_internal_exceptions():
4444
span_data = get_db_data_fn(self)
45-
_set_pipeline_data(
46-
span,
47-
is_cluster,
48-
get_command_args_fn,
49-
False if is_cluster else self.is_transaction,
50-
self._command_stack if is_cluster else self.command_stack,
45+
pipeline_data = _get_pipeline_data(
46+
is_cluster=is_cluster,
47+
get_command_args_fn=get_command_args_fn,
48+
is_transaction=False if is_cluster else self.is_transaction,
49+
command_stack=self._command_stack if is_cluster else self.command_stack,
5150
)
5251

5352
return await old_execute(self, *args, **kwargs)

sentry_sdk/integrations/redis/_sync_common.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from sentry_sdk.integrations.redis.modules.queries import _compile_db_span_properties
99
from sentry_sdk.integrations.redis.utils import (
1010
_set_client_data,
11-
_set_pipeline_data,
11+
_get_pipeline_data,
1212
)
1313
from sentry_sdk.tracing import Span
1414
from sentry_sdk.utils import capture_internal_exceptions
@@ -44,12 +44,11 @@ def sentry_patched_execute(self, *args, **kwargs):
4444
) as span:
4545
with capture_internal_exceptions():
4646
span_data = get_db_data_fn(self)
47-
_set_pipeline_data(
48-
span,
49-
is_cluster,
50-
get_command_args_fn,
51-
False if is_cluster else self.transaction,
52-
self.command_stack,
47+
pipeline_data = _get_pipeline_data(
48+
is_cluster=is_cluster,
49+
get_command_args_fn=get_command_args_fn,
50+
is_transaction=False if is_cluster else self.transaction,
51+
command_stack=self.command_stack,
5352
)
5453

5554
return old_execute(self, *args, **kwargs)

sentry_sdk/integrations/redis/utils.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,14 @@ def _parse_rediscluster_command(command):
105105
return command.args
106106

107107

108-
def _set_pipeline_data(
109-
span, is_cluster, get_command_args_fn, is_transaction, command_stack
108+
def _get_pipeline_data(
109+
is_cluster, get_command_args_fn, is_transaction, command_stack
110110
):
111-
# type: (Span, bool, Any, bool, Sequence[Any]) -> None
112-
span.set_tag("redis.is_cluster", is_cluster)
113-
span.set_tag("redis.transaction", is_transaction)
111+
# type: (bool, Any, bool, Sequence[Any]) -> dict[str, Any]
112+
data = {
113+
"redis.is_cluster": is_cluster,
114+
"redis.transaction": is_transaction,
115+
}
114116

115117
commands = []
116118
for i, arg in enumerate(command_stack):
@@ -120,8 +122,10 @@ def _set_pipeline_data(
120122
command = get_command_args_fn(arg)
121123
commands.append(_get_safe_command(command[0], command[1:]))
122124

123-
span.set_data("redis.commands.count", len(command_stack))
124-
span.set_data("redis.commands.first_ten", commands)
125+
data["redis.commands.count"] = len(command_stack)
126+
data["redis.commands.first_ten"] = commands
127+
128+
return data
125129

126130

127131
def _set_client_data(span, is_cluster, name, *args):

0 commit comments

Comments
 (0)