Skip to content

Conversation

@nikhilsaikethe
Copy link
Contributor

This PR fixes the issue that error while canceling query

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Dec 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

Failed to generate code suggestions for PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 9, 2025

Greptile Overview

Greptile Summary

This PR fixes an error that occurred when canceling queries on non-enterprise deployments. The backend query_manager API endpoints (/api/{org}/query_manager/cancel) return a "Forbidden" response when the enterprise feature is not enabled. Previously, the frontend would unconditionally call cancelQuery() when the logs component was unmounted, causing unnecessary error notifications on non-enterprise deployments.

  • Added config.isEnterprise === "true" check before calling cancelQuery() in the onBeforeUnmount lifecycle hook
  • This aligns the frontend behavior with the backend capability, where query cancellation is an enterprise-only feature

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it's a straightforward conditional check that properly gates an enterprise-only feature.
  • The change is minimal, focused, and correct. It adds a simple guard condition that prevents calling an API that would fail on non-enterprise deployments. The pattern of checking config.isEnterprise === "true" is used consistently elsewhere in the codebase.
  • No files require special attention.

Important Files Changed

File Analysis

Filename Score Overview
web/src/plugins/logs/Index.vue 5/5 Added enterprise check before calling cancelQuery() in onBeforeUnmount lifecycle hook to prevent "Forbidden" errors on non-enterprise deployments where the query_manager API is not supported.

Sequence Diagram

sequenceDiagram
    participant User
    participant LogsComponent as Logs Index.vue
    participant CancelQuery as cancelQuery()
    participant Backend as /api/{org}/query_manager/cancel

    User->>LogsComponent: Navigate away from logs page
    LogsComponent->>LogsComponent: onBeforeUnmount triggered
    
    alt Enterprise Edition
        LogsComponent->>CancelQuery: cancelQuery()
        CancelQuery->>Backend: PUT request with trace IDs
        Backend-->>CancelQuery: Success response
        CancelQuery-->>LogsComponent: Query cancelled
    else Non-Enterprise Edition (after this fix)
        LogsComponent->>LogsComponent: Skip cancelQuery() call
        Note over LogsComponent: No API call made
    end
    
    LogsComponent->>LogsComponent: Continue unmount cleanup
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@nikhilsaikethe nikhilsaikethe force-pushed the fix/cancel-query-on-enterprise branch from d38638c to ac818b4 Compare December 9, 2025 12:31
@nikhilsaikethe nikhilsaikethe force-pushed the fix/cancel-query-on-enterprise branch from 801d4a7 to 34652a1 Compare December 9, 2025 12:51
@nikhilsaikethe nikhilsaikethe merged commit 5b988ab into main Dec 9, 2025
39 checks passed
@nikhilsaikethe nikhilsaikethe deleted the fix/cancel-query-on-enterprise branch December 9, 2025 13:25
nikhilsaikethe added a commit that referenced this pull request Dec 10, 2025
This PR fixes the issue that error while canceling query
nikhilsaikethe added a commit that referenced this pull request Dec 10, 2025
This PR fixes the issue that error while canceling query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants