Skip to content
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

Merged
merged 5 commits into from Feb 4, 2020
Merged

add "nodes" metadata for backends #821

merged 5 commits into from Feb 4, 2020

Conversation

zhoney
Copy link
Contributor

@zhoney zhoney commented Jan 9, 2020

implemented: #816

Change-Id: Ica7be59f1af1f290342b010c0c018cc541a1122b

@codecov
Copy link

codecov bot commented Jan 9, 2020

Codecov Report

Merging #821 into master will increase coverage by 6.6%.
The diff coverage is 13.41%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ Complexity Δ
...src/main/java/com/baidu/hugegraph/HugeFactory.java 68% <ø> (ø) 6 <0> (ø) ⬇️
.../backend/store/cassandra/CassandraSessionPool.java 56.25% <ø> (+56.25%) 11 <0> (+11) ⬆️
...du/hugegraph/backend/store/hbase/HbaseMetrics.java 0% <0%> (ø) 0 <0> (?)
...aidu/hugegraph/backend/store/hbase/HbaseStore.java 73.36% <0%> (-0.21%) 33 <0> (+1)
...egraph/backend/store/cassandra/CassandraStore.java 65.46% <0%> (+57.91%) 47 <0> (+41) ⬆️
...raph/backend/store/cassandra/CassandraMetrics.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...u/hugegraph/backend/store/hbase/HbaseSessions.java 65.68% <0%> (-0.49%) 21 <0> (ø)
...du/hugegraph/backend/store/mysql/MysqlMetrics.java 0% <0%> (ø) 0 <0> (?)
...ugegraph/backend/store/rocksdb/RocksDBMetrics.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...ugegraph/backend/store/memory/InMemoryDBStore.java 87.59% <100%> (+0.56%) 31 <2> (+2) ⬆️
... and 65 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1b2a4c...835e70b. Read the comment docs.

serverMetrics.getRequestCountPerSecond());
for (RegionMetrics region : regions) {
String table = region.getNameAsString().split(",")[0];
metrics.put(table, this.getRegionMetrics(region));
Copy link
Contributor

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();
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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));
Copy link
Contributor

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());
Copy link
Contributor

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() {
Copy link
Contributor

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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete it

return metrics;
}

private Map<String, Object> getRegionMetrics(RegionMetrics region) {
Copy link
Contributor

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(
Copy link
Contributor

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));
Copy link
Contributor

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));
Copy link
Contributor

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",
Copy link
Contributor

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",
Copy link
Contributor

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));
Copy link
Contributor

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
Change-Id: Ia8abda118a0cf181b31ff39cb0a7a0a9d94996e8
Change-Id: I538eb57a52873c139a3302428f61851c1040ab5a
@Linary Linary merged commit 1428c8b into master Feb 4, 2020
@Linary Linary deleted the backend-nodes branch February 4, 2020 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants