Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

fix: use valid isinstance tuple syntax for list/tuple checks in Prometheus result flattening#22

Merged
elasticdotventures merged 2 commits into
feat/mcp-dataframe-sources-and-capabilitiesfrom
copilot/sub-pr-20
Feb 22, 2026
Merged

fix: use valid isinstance tuple syntax for list/tuple checks in Prometheus result flattening#22
elasticdotventures merged 2 commits into
feat/mcp-dataframe-sources-and-capabilitiesfrom
copilot/sub-pr-20

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 22, 2026

isinstance(x, list | tuple) raises TypeError at runtime — the | union operator is valid for type annotations but not for isinstance() type arguments. This broke all Prometheus result flattening across matrix, vector, and scalar/string result types.

Changes

  • query_prometheus.py: Replace all three isinstance(..., list | tuple) calls in _flatten_prometheus_result with isinstance(..., (list, tuple))
# Before — raises TypeError at runtime
if not isinstance(point, list | tuple) or len(point) != 2:

# After — correct tuple syntax
if not isinstance(point, (list, tuple)) or len(point) != 2:

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update dataframe capabilities and svg renderer based on feedback fix: use valid isinstance tuple syntax for list/tuple checks in Prometheus result flattening Feb 22, 2026
@elasticdotventures elasticdotventures marked this pull request as ready for review February 22, 2026 04:32
Copilot AI review requested due to automatic review settings February 22, 2026 04:32
@elasticdotventures elasticdotventures merged commit 63e6bee into feat/mcp-dataframe-sources-and-capabilities Feb 22, 2026
35 of 41 checks passed
@elasticdotventures elasticdotventures deleted the copilot/sub-pr-20 branch February 22, 2026 04:32
Copy link
Copy Markdown

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 fixes a critical runtime bug in the Prometheus result flattening logic where incorrect isinstance() syntax was causing TypeError exceptions. The issue affected all three Prometheus result types (matrix, vector, and scalar/string).

Changes:

  • Fixed isinstance() calls to use proper tuple syntax (list, tuple) instead of invalid union syntax list | tuple

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants