[SCB-150] Add Status(success/failed) dimension to operation call count and tps#508
[SCB-150] Add Status(success/failed) dimension to operation call count and tps#508WillemJiang merged 10 commits intoapache:masterfrom
Conversation
|
maybe it's better add statusCode dimension, not succ/fail |
Signed-off-by: zhengyangyong <yangyong.zheng@huawei.com>
Signed-off-by: zhengyangyong <yangyong.zheng@huawei.com>
Signed-off-by: zhengyangyong <yangyong.zheng@huawei.com>
Signed-off-by: zhengyangyong <yangyong.zheng@huawei.com>
Signed-off-by: zhengyangyong <yangyong.zheng@huawei.com>
Signed-off-by: zhengyangyong <yangyong.zheng@huawei.com>
Signed-off-by: zhengyangyong <yangyong.zheng@huawei.com>
Signed-off-by: zhengyangyong <yangyong.zheng@huawei.com>
62f9984 to
3c612f4
Compare
|
Package Name Updated |
|
maybe it's better add statusCode dimension, not succ/fail |
|
There could be lots's of dimensions if we create the counter per status code. My suggestion is we only provide 2xx, 3xx, 4xx, 5xx status code for it. BTW, we can take the Spring Boot actuator as an example, we don't need lots detail metrics, we just need to tell the administrator something is wrong, and you can find more information by looking up the access log. |
|
2xx/3xx/4xx/5xx almost equals statusCode i thinks, for metrics kernel data, we care for statusCode |
|
I think I can add a switch named servicecomb.metrics.dimension.http_code,default value is false,if user enable it,detail metrics will be record like : |
|
I also think most of the time user would like use metrics outputs draw curves directly and don't want do any more aggregation by themself ,only detail items provided may not good idea. |
|
not "only detail items " |
| MetricsDimension.DIMENSION_STATUS_SUCCESS, | ||
| MetricsDimension.DIMENSION_STATUS_FAILED}; | ||
| } | ||
| throw new ServiceCombException("illegal dimension key : " + dimension); |
There was a problem hiding this comment.
if there's only one dimension, there's no need to pass in the parameter. if there are multiple, returning an empty array is preferable
There was a problem hiding this comment.
We will support more dimensions later, and dimension key must correct
| } | ||
| return tagMap; | ||
| } | ||
| return null; |
There was a problem hiding this comment.
returning Collections.emptyMap() is preferable
| familySamples.add(new MetricFamilySamples("Instance Level", Type.UNTYPED, "Instance Level Metrics", samples)); | ||
|
|
||
| if (registryMetric.getConsumerMetrics().size() != 0) { | ||
| samples = new ArrayList<>(); |
There was a problem hiding this comment.
use a local list in this scope is better
| .add(getFamilySamples(producerMetric.getKey() + " Producer Side", producerMetric.getValue().toMap())); | ||
|
|
||
| if (registryMetric.getProducerMetrics().size() != 0) { | ||
| samples = new ArrayList<>(); |
| if (this.getKey().equals(value.getKey())) { | ||
| return new DoubleMetricValue(this.getKey(), this.getValue() + value.getValue(), this.getDimensions()); | ||
| } | ||
| throw new ServiceCombException("unable merge different key values,source key :" + value.getKey() + |
There was a problem hiding this comment.
any place to catch this exception? we don't want to interrupt user business logic
|
agreed with @zhengyangyong on option to enable/disable metrics collection based on status code and @WillemJiang on metrics on status range instead of exact status code. we have to be aware of framework memory footprint. |
Signed-off-by: zhengyangyong <yangyong.zheng@huawei.com>
Signed-off-by: zhengyangyong <yangyong.zheng@huawei.com>
|
now support setting output level of status dimension : servicecomb:
metrics:
dimension:
#status dimension
status:
# success_failed : only output success & failed (default)
# code_group : output 1xx,2xx,3xx,4xx,5xx and xxx
# code : output detail code like 200,404,500... etc
output_level: success_failed |
|
will this make our logic too complex? |
Follow this checklist to help us incorporate your contribution quickly and easily:
[SCB-XXX] Fixes bug in ApproximateQuantiles, where you replaceSCB-XXXwith the appropriate JIRA issue.mvn clean installto make sure basic checks pass. A more thorough check will be performed on your pull request automatically.Add Status(success/failed) dimension to operation call count and tps,now they will split into three metrics like:
servicecomb.instance.producer.producerCall.tps.{Status=all}
servicecomb.instance.producer.producerCall.tps.{Status=success}
servicecomb.instance.producer.producerCall.tps.{Status=failed}
servicecomb.instance.producer.producerCall.total.{Status=all}
servicecomb.instance.producer.producerCall.total.{Status=success}
servicecomb.instance.producer.producerCall.total.{Status=failed}
consumerCall also applied
In prometheus will use Label show this dimension:
servicecomb_calculator_calculatorRestEndpoint_calculate_producer_producerCall_tps{Status="success",instance="localhost:9696",job="servicecomb"}
servicecomb_calculator_calculatorRestEndpoint_calculate_producer_producerCall_tps{Status="failed",instance="localhost:9696",job="servicecomb"}
servicecomb_calculator_calculatorRestEndpoint_calculate_producer_producerCall_tps{Status="all",instance="localhost:9696",job="servicecomb"}
Update
now support setting output level of status dimension :