web icon indicating copy to clipboard operation
web copied to clipboard

Dashboard shows re-run option for events inserted via the agent /events API

Open adammcdonagh opened this issue 5 years ago • 1 comments

Simple "bug"... If an event is inserted via the Agent API /events endpoint, the dashboard still shows the "re-run" option at the top. This shouldn't be there (similar to the behaviour of the keepalive check).

Clicking the re-run button anyway gives a nasty error:

Error: GraphQL error: not found
    at new ApolloError (https://localhost:3001/static/js/vendor_a994.js:89:91772)
    at QueryManager.<anonymous> (https://localhost:3001/static/js/vendor_a994.js:89:110592)
    at step (https://localhost:3001/static/js/vendor_a994.js:104:2609)
    at Object.next (https://localhost:3001/static/js/vendor_a994.js:104:2714)
    at https://localhost:3001/static/js/vendor_a994.js:104:1625
    at Promise.n._execute (https://localhost:3001/static/js/vendor_a994.js:89:36878)
    at Promise._resolveFromExecutor (https://localhost:3001/static/js/vendor_a994.js:89:61413)
    at new Promise (https://localhost:3001/static/js/vendor_a994.js:89:54229)
    at __awaiter (https://localhost:3001/static/js/vendor_a994.js:104:1366)
    at Object.next (https://localhost:3001/static/js/vendor_a994.js:89:110418)
    at notifySubscription (https://localhost:3001/static/js/vendor_a994.js:104:42763)
    at onNotify (https://localhost:3001/static/js/vendor_a994.js:104:43379)
    at SubscriptionObserver.next (https://localhost:3001/static/js/vendor_a994.js:104:44193)
    at notifySubscription (https://localhost:3001/static/js/vendor_a994.js:104:42763)
    at onNotify (https://localhost:3001/static/js/vendor_a994.js:104:43379)
    at SubscriptionObserver.next (https://localhost:3001/static/js/vendor_a994.js:104:44193)

Expected Behavior

Button should not appear at all

Current Behavior

Button appears, and if clicked generates an error message which forces the page to reload.

Possible Solution

Remove the button

Steps to Reproduce (for bugs)

  1. Insert an event via the agent /events API -
curl -X POST -H 'Content-Type: application/json' -d '{"check": {"metadata":{"name":"mycheck123"},"source":"centos7-sensu-client-1.test","status":1,"handlers":["snmp"],"output":"THIS IS A TEST"}}' http://127.0.0.1:3031/events
  1. Navigate to the event in the dashboard
  2. Click the RE-RUN button

Your Environment

Latest version of Sensu Go

adammcdonagh avatar Jun 06 '19 17:06 adammcdonagh

Given how we model events, the source of a check result is opaque and it's unclear to me what the most satisfactory solution to this problem might be. One approach that comes to mind, would be to look up the spec associated with the check name and if there is no result disable the button with some sort of tooltip communicating why. There might be some weirdness if the reason for the lookup failing was due to permissions but might be an acceptable edge case.

In the meantime I will fix the nasty error spat out by the GraphQL service.

jamesdphillips avatar May 06 '20 05:05 jamesdphillips