Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(redis): define result in _run_redis_command [backport 2.10] #10200

Merged
merged 2 commits into from
Aug 14, 2024

Conversation

github-actions[bot]
Copy link
Contributor

Backport 504a347 from #10112 to 2.10.


File "/lib/python3.12/site-packages/ddtrace/contrib/redis/patch.py", line 152, in _instrumented_execute_command
    return _run_redis_command(ctx=ctx, func=func, args=args, kwargs=kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
File "lib/python3.12/site-packages/ddtrace/contrib/redis/patch.py", line 136, in _run_redis_command
    rowcount = determine_row_count(redis_command=redis_command, result=result)
                                                                       ^^^^^^
UnboundLocalError: cannot access local variable 'result' where it is not associated with a value

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

- This fix resolves an issue in redis utils where a variable may not be
declared within a try/catch
- Relates to changes from
#9786, applying same logic to
`_run_redis_command`
```

File "/lib/python3.12/site-packages/ddtrace/contrib/redis/patch.py", line 152, in _instrumented_execute_command
    return _run_redis_command(ctx=ctx, func=func, args=args, kwargs=kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "lib/python3.12/site-packages/ddtrace/contrib/redis/patch.py", line 136, in _run_redis_command
    rowcount = determine_row_count(redis_command=redis_command, result=result)
                                                                       ^^^^^^
UnboundLocalError: cannot access local variable 'result' where it is not associated with a value
```
## Checklist
- [x] PR author has checked that all the criteria below are met
- The PR description includes an overview of the change
- The PR description articulates the motivation for the change
- The change includes tests OR the PR description describes a testing
strategy
- The PR description notes risks associated with the change, if any
- Newly-added code is easy to change
- The change follows the [library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- The change includes or references documentation updates if necessary
- Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))

## Reviewer Checklist
- [x] Reviewer has checked that all the criteria below are met
- Title is accurate
- All changes are related to the pull request's stated goal
- Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- Testing strategy adequately addresses listed risks
- Newly-added code is easy to change
- Release note makes sense to a user of the library
- If necessary, author has acknowledged and discussed the performance
implications of this PR as reported in the benchmarks PR comment
- Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

Co-authored-by: erikayasuda <[email protected]>
(cherry picked from commit 504a347)
@github-actions github-actions bot requested review from a team as code owners August 13, 2024 16:03
@github-actions github-actions bot added the changelog/no-changelog A changelog entry is not required for this PR. label Aug 13, 2024
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Aug 13, 2024

Datadog Report

Branch report: backport-10112-to-2.10
Commit report: f7cb035
Test service: dd-trace-py

✅ 0 Failed, 881 Passed, 12 Skipped, 16m 47.94s Total duration (9.55s time saved)

@pr-commenter
Copy link

pr-commenter bot commented Aug 13, 2024

Benchmarks

Benchmark execution time: 2024-08-13 16:50:29

Comparing candidate commit ccbcf50 in PR branch backport-10112-to-2.10 with baseline commit 63a5a04 in branch 2.10.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 221 metrics, 9 unstable metrics.

@erikayasuda erikayasuda enabled auto-merge (squash) August 13, 2024 17:15
@erikayasuda erikayasuda merged commit 5b2d1f8 into 2.10 Aug 14, 2024
77 checks passed
@erikayasuda erikayasuda deleted the backport-10112-to-2.10 branch August 14, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/no-changelog A changelog entry is not required for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants