Skip to content

Conversation

@max-ostapenko
Copy link

This pull request makes a minor change to the error handling in the get_custom_metrics function. Specifically, it no longer logs a warning when a custom metric value cannot be parsed as JSON and instead simply keeps the value as a plain string.

Copilot AI review requested due to automatic review settings January 5, 2026 21:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modifies the error handling in the get_custom_metrics function to preserve plain-string custom metric values instead of discarding them when JSON parsing fails. Previously, when a ValueError occurred during JSON parsing, the metric was skipped entirely with a warning logged. Now, the code keeps the original string value as-is.

  • Changed ValueError exception handling from logging a warning and skipping the metric to keeping the value as a plain string
  • Added an inline comment explaining the new behavior
Comments suppressed due to low confidence (1)

HTTPArchive/httparchive.py:140

  • Inconsistent error handling: The ValueError exception now keeps the value as a plain string (using pass), but the RecursionError exception still skips the metric entirely (using continue). Consider whether RecursionError should also keep the original string value for consistency, or if there's a specific reason to treat these errors differently.
                # Value is a plain string, not JSON-encoded. Keep it as-is.
                pass
            except RecursionError:
                logging.warning(
                    "RecursionError: Unable to parse custom metric %s as JSON for %s",
                    metric,
                    wptid,
                )
                continue

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants