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
add "nodes" metadata for backends #821
Conversation
Codecov Report
@@ Coverage Diff @@
## master #821 +/- ##
==========================================
+ Coverage 65.2% 71.8% +6.6%
- Complexity 4043 4372 +329
==========================================
Files 283 286 +3
Lines 20995 21073 +78
Branches 2961 2963 +2
==========================================
+ Hits 13689 15132 +1443
+ Misses 5938 4446 -1492
- Partials 1368 1495 +127
Continue to review full report at Codecov.
|
serverMetrics.getRequestCountPerSecond()); | ||
for (RegionMetrics region : regions) { | ||
String table = region.getNameAsString().split(",")[0]; | ||
metrics.put(table, this.getRegionMetrics(region)); |
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.
don't override regions of one table
public Map<String, Object> getMetrics() { | ||
Map<String, Object> results = InsertionOrderUtil.newMap(); | ||
try { | ||
Admin admin = this.hbase.getAdmin(); |
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.
try(Admin admin = this.hbase.getAdmin())
|
||
@Override | ||
public Map<String, Object> getMetrics() { | ||
return ImmutableMap.of("nodes", 1); |
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.
NODES
|
||
@Override | ||
public Map<String, Object> getMetrics() { | ||
return ImmutableMap.of("nodes", 1); |
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.
NODES
String address = server.getAddress().toString(); | ||
List<RegionMetrics> regions = admin.getRegionMetrics(server); | ||
regionServers.put(address, this.getRegionServerMetrics( | ||
e.getValue(), regions)); |
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.
define a var for e.getValue()
|
||
private void registerMetaHandlers() { | ||
this.registerMetaHandler("metrics", (session, meta, args) -> { | ||
HbaseMetrics metrics = new HbaseMetrics(hbase()); |
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.
this.sessions
Cassandra protected Cluster cluster()
@@ -85,6 +85,10 @@ public HbaseSessions(HugeConfig config, String namespace, String store) { | |||
this.namespace = namespace; | |||
} | |||
|
|||
public Connection hbase() { |
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.
set package access or protected
check this.hbase != null
} | ||
|
||
protected void registerTableManager(HugeType type, HbaseTable table) { | ||
this.tables.put(type, table); | ||
} | ||
|
||
private Connection hbase() { |
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.
delete it
hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseMetrics.java
Show resolved
Hide resolved
return metrics; | ||
} | ||
|
||
private Map<String, Object> getRegionMetrics(RegionMetrics region) { |
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.
set static and rename formatMetrics
return results; | ||
} | ||
|
||
private Map<String, Object> getRegionServerMetrics( |
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.
set static
and rename to formatMetrics
serverMetrics.getRequestCountPerSecond()); | ||
for (RegionMetrics region : regions) { | ||
metrics.put(region.getNameAsString(), | ||
this.getRegionMetrics(region)); |
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.
add regions layer
List<RegionMetrics> regions = admin.getRegionMetrics(server); | ||
ServerMetrics serverMetrics = e.getValue(); | ||
regionServers.put(address, this.getRegionServerMetrics( | ||
serverMetrics, regions)); |
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.
regionServers.put(server.getAddress().toString(),
formatMetri(csserverMetrics, regions));
Map<String, Object> metrics = InsertionOrderUtil.newMap(); | ||
metrics.put("max_heap_size", | ||
serverMetrics.getMaxHeapSize().get(Size.Unit.MEGABYTE)); | ||
metrics.put("used_heap_size", |
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.
add "heap_size_unit: MB"
Map<String, Object> metrics = InsertionOrderUtil.newMap(); | ||
metrics.put("mem_store_size", | ||
region.getMemStoreSize().get(Size.Unit.MEGABYTE)); | ||
metrics.put("mem_store_file_size", |
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 file_store_size
metrics.put("mem_store_size", | ||
region.getMemStoreSize().get(Size.Unit.MEGABYTE)); | ||
metrics.put("mem_store_file_size", | ||
region.getStoreFileSize().get(Size.Unit.MEGABYTE)); |
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.
also add unit
implemented: #816 Change-Id: Ica7be59f1af1f290342b010c0c018cc541a1122b
Change-Id: I7538d76682d0e6620eefc3ce53c787e111ba1dcf
Change-Id: I041cf915e565b4ba90c94b73d938ff9e27abf905
implemented: #816
Change-Id: Ica7be59f1af1f290342b010c0c018cc541a1122b