public void setMetricStore(String deploymentName, MetricStore metricStore) { MetricStores metricStores = getMetricStores(deploymentName); switch (metricStore.getMetricStoreType()) { case DATADOG: metricStores.setDatadog((DatadogStore) metricStore); break; case PROMETHEUS: metricStores.setPrometheus((PrometheusStore) metricStore); break; case STACKDRIVER: metricStores.setStackdriver((StackdriverStore) metricStore); break; default: throw new RuntimeException("Unknown Metric Store " + metricStore.getMetricStoreType()); } }
public void setMetricStoreEnabled(String deploymentName, String metricStoreType, boolean enabled) { MetricStore metricStore = getMetricStore(deploymentName, metricStoreType); metricStore.setEnabled(enabled); setMetricStore(deploymentName, metricStore); }
@Override protected void executeThis() { String currentDeployment = getCurrentDeployment(); String metricStoreType = getMetricStoreType().getId(); // Disable validation here, since we don't want an illegal config to prevent us from fixing it. MetricStore metricStore = new OperationHandler<MetricStore>() .setOperation(Daemon.getMetricStore(currentDeployment, metricStoreType, false)) .setFailureMesssage("Failed to get " + metricStoreType + " method.") .get(); int originalHash = metricStore.hashCode(); metricStore = editMetricStore((T) metricStore); if (originalHash == metricStore.hashCode()) { AnsiUi.failure("No changes supplied."); return; } new OperationHandler<Void>() .setOperation(Daemon.setMetricStore(currentDeployment, metricStoreType, !noValidate, metricStore)) .setFailureMesssage("Failed to edit " + metricStoreType + " method.") .setSuccessMessage("Successfully edited " + metricStoreType + " method.") .get(); } }
@Override protected void executeThis() { String currentDeployment = getCurrentDeployment(); String metricStoreType = getMetricStoreType().getId(); // Disable validation here, since we don't want an illegal config to prevent us from fixing it. MetricStore metricStore = new OperationHandler<MetricStore>() .setOperation(Daemon.getMetricStore(currentDeployment, metricStoreType, false)) .setFailureMesssage("Failed to get " + metricStoreType + " method.") .get(); int originalHash = metricStore.hashCode(); metricStore = editMetricStore((T) metricStore); if (originalHash == metricStore.hashCode()) { AnsiUi.failure("No changes supplied."); return; } new OperationHandler<Void>() .setOperation(Daemon.setMetricStore(currentDeployment, metricStoreType, !noValidate, metricStore)) .setFailureMesssage("Failed to edit " + metricStoreType + " method.") .setSuccessMessage("Successfully edited " + metricStoreType + " method.") .get(); } }
public void setMetricStoreEnabled(String deploymentName, String metricStoreType, boolean enabled) { MetricStore metricStore = getMetricStore(deploymentName, metricStoreType); metricStore.setEnabled(enabled); setMetricStore(deploymentName, metricStore); }
public void setMetricStore(String deploymentName, MetricStore metricStore) { MetricStores metricStores = getMetricStores(deploymentName); switch (metricStore.getMetricStoreType()) { case DATADOG: metricStores.setDatadog((DatadogStore) metricStore); break; case PROMETHEUS: metricStores.setPrometheus((PrometheusStore) metricStore); break; case STACKDRIVER: metricStores.setStackdriver((StackdriverStore) metricStore); break; default: throw new RuntimeException("Unknown Metric Store " + metricStore.getMetricStoreType()); } }