Skip to content

Commit

Permalink
prometheus aggregator
Browse files Browse the repository at this point in the history
  • Loading branch information
zxwing committed Aug 23, 2018
1 parent a45628e commit cf692a6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/zstack/core/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ private static void prepareDefaultDbProperties() {

static {
try {
msId = getUuid();
msId = UUID.nameUUIDFromBytes(getManagementServerIp().getBytes()).toString().replaceAll("-", "");;

Set<Class> baseResourceClasses = reflections.getTypesAnnotatedWith(BaseResource.class).stream()
.filter(clz -> clz.isAnnotationPresent(BaseResource.class)).collect(Collectors.toSet());
Expand Down
4 changes: 0 additions & 4 deletions core/src/main/java/org/zstack/core/gc/GarbageCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ final protected void saveToDb() {
}
}

FieldUtils.getAllFields(getClass()).forEach(f -> {

});

GarbageCollectorVO vo = new GarbageCollectorVO();
vo.setUuid(Platform.getUuid());
vo.setContext(JSONObjectUtil.toJsonString(context));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.zstack.core.config.GlobalConfigUpdateExtensionPoint;
import org.zstack.core.db.DatabaseFacade;
import org.zstack.core.db.GLock;
import org.zstack.core.db.SQLBatch;
import org.zstack.core.thread.AsyncThread;
import org.zstack.core.thread.Task;
import org.zstack.core.thread.ThreadFacade;
Expand Down Expand Up @@ -404,10 +405,23 @@ public void rollback(FlowRollback trigger, Map data) {

@Override
public void run(FlowTrigger trigger, Map data) {
ManagementNodeVO vo = new ManagementNodeVO();
vo.setHostName(Platform.getManagementServerIp());
vo.setUuid(UUID.nameUUIDFromBytes(vo.getHostName().getBytes()).toString());
node = dbf.persistAndRefresh(vo);
new SQLBatch() {
@Override
protected void scripts() {
String ip = Platform.getManagementServerIp();
String uuid = Platform.getManagementServerId();

sql(ManagementNodeVO.class).eq(ManagementNodeVO_.uuid, uuid).hardDelete();

ManagementNodeVO vo = new ManagementNodeVO();
vo.setHostName(ip);
vo.setUuid(uuid);
persist(vo);
reload(vo);
node = vo;
}
}.execute();

trigger.next();
}

Expand Down

0 comments on commit cf692a6

Please sign in to comment.