|
| 1 | +package com.alibaba.csp.sentinel.metric.extension; |
| 2 | + |
| 3 | +import com.alibaba.csp.sentinel.EntryType; |
| 4 | +import com.alibaba.csp.sentinel.slots.block.BlockException; |
| 5 | + |
| 6 | +/** |
| 7 | + * Advanced {@link MetricExtension} extending input parameters of each metric |
| 8 | + * collection method with the name of {@link EntryType}. |
| 9 | + * |
| 10 | + * @author bill_yip |
| 11 | + * @since 1.8.0 |
| 12 | + */ |
| 13 | +public interface AdvancedMetricExtension extends MetricExtension { |
| 14 | + /** |
| 15 | + * Add current pass count of the resource name. |
| 16 | + * |
| 17 | + * @param n count to add |
| 18 | + * @param resource resource name |
| 19 | + * @param entryType {@link EntryType} name, [IN] as provider, [OUT] as consumer. |
| 20 | + * @param args additional arguments of the resource, eg. if the resource is |
| 21 | + * a method name, the args will be the parameters of the |
| 22 | + * method. |
| 23 | + */ |
| 24 | + void addPass(String resource, String entryType, int n, Object... args); |
| 25 | + |
| 26 | + /** |
| 27 | + * Add current block count of the resource name. |
| 28 | + * |
| 29 | + * @param n count to add |
| 30 | + * @param resource resource name |
| 31 | + * @param entryType {@link EntryType} name, [IN] as provider, [OUT] as |
| 32 | + * consumer. |
| 33 | + * @param origin the original invoker. |
| 34 | + * @param blockException block exception related. |
| 35 | + * @param args additional arguments of the resource, eg. if the |
| 36 | + * resource is a method name, the args will be the |
| 37 | + * parameters of the method. |
| 38 | + */ |
| 39 | + void addBlock(String resource, String entryType, int n, String origin, BlockException blockException, |
| 40 | + Object... args); |
| 41 | + |
| 42 | + /** |
| 43 | + * Add current completed count of the resource name. |
| 44 | + * |
| 45 | + * @param n count to add |
| 46 | + * @param resource resource name |
| 47 | + * @param entryType {@link EntryType} name, [IN] as provider, [OUT] as consumer. |
| 48 | + * @param args additional arguments of the resource, eg. if the resource is |
| 49 | + * a method name, the args will be the parameters of the |
| 50 | + * method. |
| 51 | + */ |
| 52 | + void addSuccess(String resource, String entryType, int n, Object... args); |
| 53 | + |
| 54 | + /** |
| 55 | + * Add current exception count of the resource name. |
| 56 | + * |
| 57 | + * @param n count to add |
| 58 | + * @param resource resource name |
| 59 | + * @param entryType {@link EntryType} name, [IN] as provider, [OUT] as consumer. |
| 60 | + * @param throwable exception related. |
| 61 | + */ |
| 62 | + void addException(String resource, String entryType, int n, Throwable throwable); |
| 63 | + |
| 64 | + /** |
| 65 | + * Add response time of the resource name. |
| 66 | + * |
| 67 | + * @param rt response time in millisecond |
| 68 | + * @param resource resource name |
| 69 | + * @param entryType {@link EntryType} name, [IN] as provider, [OUT] as consumer. |
| 70 | + * @param args additional arguments of the resource, eg. if the resource is |
| 71 | + * a method name, the args will be the parameters of the |
| 72 | + * method. |
| 73 | + */ |
| 74 | + void addRt(String resource, String entryTypeTag, long rt, Object... args); |
| 75 | + |
| 76 | + /** |
| 77 | + * Increase current thread count of the resource name. |
| 78 | + * |
| 79 | + * @param resource resource name |
| 80 | + * @param entryType {@link EntryType} name, [IN] as provider, [OUT] as consumer. |
| 81 | + * @param args additional arguments of the resource, eg. if the resource is |
| 82 | + * a method name, the args will be the parameters of the |
| 83 | + * method. |
| 84 | + */ |
| 85 | + void increaseThreadNum(String resource, String entryType, Object... args); |
| 86 | + |
| 87 | + /** |
| 88 | + * Decrease current thread count of the resource name. |
| 89 | + * |
| 90 | + * @param resource resource name |
| 91 | + * @param entryType {@link EntryType} name, [IN] as provider, [OUT] as consumer. |
| 92 | + * @param args additional arguments of the resource, eg. if the resource is |
| 93 | + * a method name, the args will be the parameters of the |
| 94 | + * method. |
| 95 | + */ |
| 96 | + void decreaseThreadNum(String resource, String entryType, Object... args); |
| 97 | +} |
0 commit comments