generated from pinterest/.github
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
orion-server/src/main/java/com/pinterest/orion/core/clickhouse/ClickHouseCluster.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.pinterest.orion.core.clickhouse; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Properties; | ||
import java.util.logging.Logger; | ||
|
||
import com.pinterest.orion.common.NodeInfo; | ||
import com.pinterest.orion.core.Cluster; | ||
import com.pinterest.orion.core.ClusterStateSink; | ||
import com.pinterest.orion.core.CostCalculator; | ||
import com.pinterest.orion.core.Node; | ||
import com.pinterest.orion.core.PluginConfigurationException; | ||
import com.pinterest.orion.core.Utilization; | ||
import com.pinterest.orion.core.actions.ActionFactory; | ||
import com.pinterest.orion.core.actions.alert.AlertFactory; | ||
import com.pinterest.orion.core.actions.audit.ActionAuditor; | ||
import com.pinterest.orion.core.automation.operator.Operator; | ||
import com.pinterest.orion.core.automation.sensor.Sensor; | ||
|
||
public class ClickHouseCluster extends Cluster { | ||
|
||
private static final long serialVersionUID = 1L; | ||
private static final Logger logger = Logger.getLogger(ClickHouseNode.class.getName()); | ||
public static final String CLUSTER_REGION = "region"; | ||
public static final String DEFAULT_REGION = "us-east-1"; | ||
private Map<String, Object> config; | ||
|
||
public ClickHouseCluster(String id, | ||
String name, | ||
List<Sensor> monitors, | ||
List<Operator> operators, | ||
ActionFactory actionFactory, | ||
AlertFactory alertFactory, | ||
ActionAuditor auditSink, | ||
ClusterStateSink stateSink, | ||
CostCalculator costCalculator) { | ||
super(id, name, "ClickHouse", monitors, operators, actionFactory, alertFactory, auditSink, stateSink, | ||
costCalculator); | ||
} | ||
|
||
@Override | ||
protected void bootstrapClusterInfo(Map<String, Object> config) throws PluginConfigurationException { | ||
this.config = config; | ||
setAttribute(CLUSTER_REGION, config.getOrDefault(CLUSTER_REGION, DEFAULT_REGION)); | ||
} | ||
|
||
@Override | ||
protected Node getNodeInstance(NodeInfo info) { | ||
return new ClickHouseNode(this, info, new Properties()); | ||
} | ||
|
||
@Override | ||
public void addNodeWithoutAgent(NodeInfo info) { | ||
getNodeMap().put(info.getNodeId(), getNodeInstance(info)); | ||
} | ||
|
||
@Override | ||
public Logger logger() { | ||
return logger; | ||
} | ||
|
||
public Map<String, Object> getConfig() { | ||
return config; | ||
} | ||
|
||
@Override | ||
public Map<String, Utilization> getUtilizationMap() { | ||
return new HashMap<>(); | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
orion-server/src/main/java/com/pinterest/orion/core/clickhouse/ClickHouseNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.pinterest.orion.core.clickhouse; | ||
|
||
import java.util.Properties; | ||
|
||
import com.pinterest.orion.common.NodeInfo; | ||
import com.pinterest.orion.core.Cluster; | ||
import com.pinterest.orion.core.Node; | ||
|
||
public class ClickHouseNode extends Node { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public ClickHouseNode(Cluster cluster, NodeInfo currentNodeInfo, Properties connectionProps) { | ||
super(cluster, currentNodeInfo, connectionProps); | ||
} | ||
|
||
} |