empiredan opened a new issue, #1236: URL: https://github.com/apache/incubator-pegasus/issues/1236
## 1. Motivation According to https://github.com/apache/incubator-pegasus/issues/1206, `with_metric_fields` and `without_metric_fields` will be provided as the parameters in the RESTful API to filter the fields of metric in the response to client. ## 2. Usage for `with_metric_fields` `with_metric_fields` will ask for the metric fields that are **not** included in the request. For example, if the request is given as below: ```url /metrics?with_metric_fields=value,p99 ``` The response will only contain the fields of "**value**" and "**p99**": ```json [ { // entity 1 "metrics": [ // gauge { "value": 100 }, // counter { "value": 10000 }, // percentile { "p99": 10 } ] }, ... ] ``` ## 3. Usage for `with_metric_fields` Similarly, `without_metric_fields` will ask for the metric fields that are **not** included in the request. For example, if the request is given as below: ```url /metrics?without_metric_fields=value,p99 ``` The response will contain all the fields except "**value**" and "**p99**": ```json [ { // entity 1 "metrics": [ // gauge { "name": "<gauge_name>" }, // counter { "name": "<counter_name>" }, // percentile { "name": "<percentile_name>", "p50": 1, "p90": 5, "p95": 8, "p999": 15 } ] }, ... ] ``` ## 4. Wrong usage Once both `with_metric_fields` and `without_metric_fields` are provided in the request, it will considered as invalid. We can discuss the reason in 2 conditions. Firstly, suppose both `with_metric_fields` and `without_metric_fields` are provided, and they include the same fields. In this condition, each conflicts with another. For example, `with_metric_fields=a,b` and `without_metric_fields=b,c` will lead to contradiction: it cannot be decided if `b` should be in the response to client. On the contrary, suppose `with_metric_fields` and `without_metric_fields` do not include any same field. In this condition, they can be simplified as a unique `with_metric_fields`. For example, `with_metric_fields=a,b` and `without_metric_fields=c,d` can be simplified as `with_metric_fields=a,b`: `without_metric_fields=c,d` is useless here since we have declared that only `a` and `b` fields are needed according to `with_metric_fields=a,b`. Therefore, we can draw a conclusion that `with_metric_fields` and `without_metric_fields` should not be provided at the same time. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
