fix: Avoid logging full URLs in HTTP metrics (i.e. _LOG_REQUEST_METRIC_URLS has no effect now)#3646
Merged
Merged
Conversation
…IC_URLS` has no effect now) Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR stops including request URLs in HTTP request duration metrics regardless of the Sequence diagram for HTTP request metric logging without URL tagssequenceDiagram
participant RestStream
participant Requests as requests
participant Metrics as metrics
RestStream->>Requests: request(method, url, headers, data, timeout, allow_redirects)
Requests-->>RestStream: Response
RestStream->>RestStream: _write_request_duration_log(endpoint, response)
RestStream->>Metrics: Point("timer", metric=Metric.HTTP_REQUEST_DURATION, tags={endpoint, status, status_name})
RestStream->>RestStream: _log_metric(point)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Now that
_LOG_REQUEST_METRIC_URLSno longer affects behavior, consider removing or clearly deprecating it to avoid confusion for future maintainers. - Given that
extra_tagsis now intentionally unused (with# noqa: ARG002), consider either removing it from_write_request_duration_logif it’s not part of the public API, or adding a brief code comment explaining why it’s retained to make the intent clearer.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Now that `_LOG_REQUEST_METRIC_URLS` no longer affects behavior, consider removing or clearly deprecating it to avoid confusion for future maintainers.
- Given that `extra_tags` is now intentionally unused (with `# noqa: ARG002`), consider either removing it from `_write_request_duration_log` if it’s not part of the public API, or adding a brief code comment explaining why it’s retained to make the intent clearer.
## Individual Comments
### Comment 1
<location path="singer_sdk/streams/rest.py" line_range="679-682" />
<code_context>
response: requests.Response,
context: Context | None = None, # noqa: ARG002
- extra_tags: dict | None = None,
+ extra_tags: dict | None = None, # noqa: ARG002
) -> None:
"""Log the HTTP duration metric.
</code_context>
<issue_to_address>
**suggestion:** `extra_tags` is now a dead parameter; consider a clearer approach than suppressing the unused-arg lint.
Since `extra_tags` isn’t used in `_write_request_duration_log`, keeping it in the signature with `# noqa: ARG002` may mislead callers into thinking it still has an effect. If you can change the API, consider removing the parameter. If you must keep it for compatibility, either pass it into a dedicated (even if currently no-op) hook or clearly mark it as deprecated in the public API instead of only suppressing the lint warning.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3646 +/- ##
==========================================
- Coverage 93.81% 93.81% -0.01%
==========================================
Files 73 73
Lines 5950 5949 -1
Branches 728 728
==========================================
- Hits 5582 5581 -1
Misses 273 273
Partials 95 95
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Stop including request URLs in HTTP duration metrics and update tests accordingly.
Bug Fixes:
Tests: