Varun Saxena commented on YARN-4447:

To initiate the discussion, what we need to decide here is whether we make 
filters as part of object and hence implication of it on REST related code.
Decision about making it part of an object model is to primarily decide on how 
much control we want to give the client.

Moreover, the thought behind making it as part of object model is that the 
client will create an object of type TimelineFilterList and this will converted 
into a JSON string and sent in the query param. Something like below where 
metricFilters is a query param. This can become quite complex as a filterlist 
can have another filterlist in it but at the server side it will be easy to 
parse as JSON converter will do it for us. This though can make the URL quite 
big. Also this would require more tighter checks at the reader side/client side 
as we can't predict what user might try to send.
{{&metricFilters=\{"operator": "AND", "filters": \[\{"type": 
"COMPARE","key":"metric1", "value": "12345", "compareop": 
"GREATER_THAN\},\{"type": "COMPARE","key":"metric23", "value": "12", 
"compareop": "EQUALS\}\]\}}}
However, it might be possible to encode it differently. Need to check.

Or we can alternatively define some other way to represent this. Say something 
like below for instance. Here, we will have to do the parsing ourselves. We can 
go with acronyms like gt for greater than, eq for equals, ge for greater than 
equals and so on. As you can see below, it is exactly same query as above but 
as its not JSON representation, it will be a lot shorter.
{{&metricFilters=(metric1 gt 12345) AND (metric23 eq 12)}}

> Provide a mechanism to represent complex filters and parse them at the REST 
> layer 
> ----------------------------------------------------------------------------------
>                 Key: YARN-4447
>                 URL: https://issues.apache.org/jira/browse/YARN-4447
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: timelineserver
>    Affects Versions: YARN-2928
>            Reporter: Varun Saxena
>            Assignee: Varun Saxena
>              Labels: yarn-2928-1st-milestone

This message was sent by Atlassian JIRA

Reply via email to