-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api): support metric API Prometheus format & add statistic metric api #2286
Conversation
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Show resolved
Hide resolved
private static final Meter EXPECTED_ERROR_METER = | ||
MetricsUtil.registerMeter(API.class, "expected-error"); | ||
MetricsUtil.registerMeter(API.class, "expected-error"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
private static final Meter UNKNOWN_ERROR_METER = | ||
MetricsUtil.registerMeter(API.class, "unknown-error"); | ||
MetricsUtil.registerMeter(API.class, "unknown-error"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@@ -97,7 +95,7 @@ public static <R> R commit(HugeGraph g, Callable<R> callable) { | |||
SUCCEED_METER.mark(); | |||
return result; | |||
} catch (IllegalArgumentException | NotFoundException | | |||
ForbiddenException e) { | |||
ForbiddenException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not addressed comment
@@ -165,8 +190,8 @@ public void testMetricsBackend() { | |||
String key = (String) e.getKey(); | |||
value = e.getValue(); | |||
Assert.assertTrue(String.format( | |||
"Expect map value for key %s but got %s", | |||
key, value), | |||
"Expect map value for key %s but got %s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer to keep the origin alignment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not addressed: prefer to keep the origin alignment
# Conflicts: # hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java
@SunnyBoy-WYH seems CI failed? could check the CI status in your personal repo (submit a PR to your repo, u could check/test CI there) |
Nice idea! ( when i push this pr, the local test passed, and a few days before i am looking for the ci problem,but ci info not enough.) i will try it again. |
Codecov Report
@@ Coverage Diff @@
## master #2286 +/- ##
============================================
- Coverage 68.26% 65.04% -3.23%
Complexity 989 989
============================================
Files 500 503 +3
Lines 41516 41801 +285
Branches 5786 5804 +18
============================================
- Hits 28342 27189 -1153
- Misses 10415 11920 +1505
+ Partials 2759 2692 -67
... and 69 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/PathFilter.java
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/PathFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/PathFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/PathFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsKeys.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are still some comments to be addressed, thanks
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsKeys.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java
Outdated
Show resolved
Hide resolved
@@ -165,8 +190,8 @@ public void testMetricsBackend() { | |||
String key = (String) e.getKey(); | |||
value = e.getValue(); | |||
Assert.assertTrue(String.format( | |||
"Expect map value for key %s but got %s", | |||
key, value), | |||
"Expect map value for key %s but got %s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not addressed: prefer to keep the origin alignment
@@ -97,7 +95,7 @@ public static <R> R commit(HugeGraph g, Callable<R> callable) { | |||
SUCCEED_METER.mark(); | |||
return result; | |||
} catch (IllegalArgumentException | NotFoundException | | |||
ForbiddenException e) { | |||
ForbiddenException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not addressed comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fix #1656 #1356 (will enhance it later)
术语:
统计指标:指【请求总数、成功数、失败数、平均响应时间、最大响应时间】五个指标
基础指标:指serverReporter中原有的gauges、counters、histograms等
思路:
1.增加原有Metric接口的prom格式返回:
2.增加statistics接口,返回【请求总数、成功数、失败数、平均响应时间、最大响应时间】五个指标,同时支持prop格式返回
json:
3.需要讨论一下 statistics接口的数据是否要合并在Metric接口中,目前没有合并是因为,原有指标结果JSON中只包含counter、summary等五种标准指标 ;
另外分开还有个好处是,如果后续想要按照图、接口查询统计指标,比较方便定制