{"action":"created","issue":{"url":"https://api.github.com/repos/sensu/sensu/issues/848","labels_url":"https://api.github.com/repos/sensu/sensu/issues/848/labels{/name}","comments_url":"https://api.github.com/repos/sensu/sensu/issues/848/comments","events_url":"https://api.github.com/repos/sensu/sensu/issues/848/events","html_url":"https://github.com/sensu/sensu/pull/848","id":55029923,"number":848,"title":"Filter attributes need to both be strings to compare correctly.","user":{"login":"jmherbst","id":431342,"avatar_url":"https://avatars.githubusercontent.com/u/431342?v=3","gravatar_id":"","url":"https://api.github.com/users/jmherbst","html_url":"https://github.com/jmherbst","followers_url":"https://api.github.com/users/jmherbst/followers","following_url":"https://api.github.com/users/jmherbst/following{/other_user}","gists_url":"https://api.github.com/users/jmherbst/gists{/gist_id}","starred_url":"https://api.github.com/users/jmherbst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmherbst/subscriptions","organizations_url":"https://api.github.com/users/jmherbst/orgs","repos_url":"https://api.github.com/users/jmherbst/repos","events_url":"https://api.github.com/users/jmherbst/events{/privacy}","received_events_url":"https://api.github.com/users/jmherbst/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-01-21T15:04:43Z","updated_at":"2015-02-06T22:28:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sensu/sensu/pulls/848","html_url":"https://github.com/sensu/sensu/pull/848","diff_url":"https://github.com/sensu/sensu/pull/848.diff","patch_url":"https://github.com/sensu/sensu/pull/848.patch"},"body":"While trying to implement a filter for events with `:action=>:resolve` I realized that the value of `:action` in the Sensu Event is a symbol and my filter attributes are in JSON.  The values of [`hash_one[key]` and `hash_two[key]`](https://github.com/sensu/sensu/blob/master/lib/sensu/server.rb#L93) need to be converted to a string before they can accurately be compared.\r\n\r\n##### Example Filter JSON: \r\n ```JSON\r\n{\r\n  \"filters\": {\r\n    \"do_not_resolve\": {\r\n      \"attributes\": {\r\n        \"check\": {\r\n          \"do_not_resolve\": true\r\n        },\r\n        \"action\": \"resolve\"\r\n      },\r\n      \"negate\": true\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n##### Example Sensu Event:\r\n```Ruby\r\n{\r\n  :id=>\"b024326c-ef4a-4d56-95f9-72332e5a2702\", \r\n  :client=>{\r\n    :name=>\"rt4.prod.example.com\",\r\n    :address=>\"198.11.254.108\", \r\n    :subscriptions=>[\"base\", \"rt4.prod.example.com\", \"testing\"], \r\n    :keepalive=>{\r\n      :thresholds=>{\r\n        :warning=>120, \r\n        :critical=>180\r\n      }, \r\n      :handlers=>[\"default\", \"pagerduty\"], \r\n      :refresh=>1800\r\n    }, \r\n    :version=>\"0.13.1\", \r\n    :timestamp=>1421791596\r\n  }, \r\n  :check=>{\r\n    :command=>\"monitor_that_pid.sh\", \r\n    :subscribers=>[\"testing\"], \r\n    :handlers=>[\"default\", \"pagerduty\"], \r\n    :refresh=>1800, \r\n    :interval=>60, \r\n    :description=>\"Monitors Some PID\", \r\n    :do_not_resolve=>true,\r\n    :name=>\"monitor_some_pid\", \r\n    :issued=>1421791537, \r\n    :executed=>1421791537, \r\n    :duration=>0.013, \r\n    :output=>\"OK\", \r\n    :status=>0, \r\n    :history=>[\"2\", \"2\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"2\", \"2\", \"2\", \"2\", \"2\", \"2\", \"0\"]\r\n  }, \r\n  :occurrences=>6, \r\n  :action=>:resolve\r\n}\r\n```\r\n\r\nI'm pretty sure, at the moment, filtering on any Event `:action` is broken since the actions are symbolized and you can only have a string in the Filter attribute JSON.\r\n\r\nI've tested a decent bit, but would appreciate a review or any comments/suggestions!"},"comment":{"url":"https://api.github.com/repos/sensu/sensu/issues/comments/73324709","html_url":"https://github.com/sensu/sensu/pull/848#issuecomment-73324709","issue_url":"https://api.github.com/repos/sensu/sensu/issues/848","id":73324709,"user":{"login":"portertech","id":149630,"avatar_url":"https://avatars.githubusercontent.com/u/149630?v=3","gravatar_id":"","url":"https://api.github.com/users/portertech","html_url":"https://github.com/portertech","followers_url":"https://api.github.com/users/portertech/followers","following_url":"https://api.github.com/users/portertech/following{/other_user}","gists_url":"https://api.github.com/users/portertech/gists{/gist_id}","starred_url":"https://api.github.com/users/portertech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portertech/subscriptions","organizations_url":"https://api.github.com/users/portertech/orgs","repos_url":"https://api.github.com/users/portertech/repos","events_url":"https://api.github.com/users/portertech/events{/privacy}","received_events_url":"https://api.github.com/users/portertech/received_events","type":"User","site_admin":false},"created_at":"2015-02-06T22:28:19Z","updated_at":"2015-02-06T22:28:19Z","body":"Object comparison should return true."}}