use of com.sequenceiq.common.api.telemetry.request.MonitoringRequest in project cloudbreak by hortonworks.
the class TelemetryConverter method createMonitoringFromRequest.
private Monitoring createMonitoringFromRequest(TelemetryRequest request) {
Monitoring monitoring = null;
if (request.getMonitoring() != null) {
LOGGER.debug("Create monitoring telemetry settings from monitoring request.");
MonitoringRequest monitoringRequest = request.getMonitoring();
monitoring = new Monitoring();
monitoring.setRemoteWriteUrl(monitoringRequest.getRemoteWriteUrl());
}
return monitoring;
}
use of com.sequenceiq.common.api.telemetry.request.MonitoringRequest in project cloudbreak by hortonworks.
the class TelemetryConverter method createMonitoringRequestFromSource.
private MonitoringRequest createMonitoringRequestFromSource(Telemetry telemetry) {
MonitoringRequest monitoringRequest = null;
Monitoring monitoring = telemetry.getMonitoring();
if (monitoring != null) {
monitoringRequest = new MonitoringRequest();
monitoringRequest.setRemoteWriteUrl(monitoring.getRemoteWriteUrl());
}
return monitoringRequest;
}
use of com.sequenceiq.common.api.telemetry.request.MonitoringRequest in project cloudbreak by hortonworks.
the class StackToCreateFreeIpaRequestConverter method getMonitoringRequest.
private MonitoringRequest getMonitoringRequest(Monitoring monitoring) {
MonitoringRequest request = null;
if (monitoring != null) {
request = new MonitoringRequest();
request.setRemoteWriteUrl(monitoring.getRemoteWriteUrl());
}
LOGGER.debug("Created monitoring request {} from monitoring {}", request, monitoring);
return request;
}
use of com.sequenceiq.common.api.telemetry.request.MonitoringRequest in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromRequest.
@Test
public void testConvertFromRequest() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
LoggingRequest logging = new LoggingRequest();
logging.setS3(new S3CloudStorageV1Parameters());
FeaturesRequest featuresRequest = new FeaturesRequest();
featuresRequest.addClusterLogsCollection(false);
telemetryRequest.setLogging(logging);
MonitoringRequest monitoringRequest = new MonitoringRequest();
monitoringRequest.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
telemetryRequest.setMonitoring(monitoringRequest);
telemetryRequest.setFeatures(featuresRequest);
// WHEN
Telemetry result = underTest.convert(telemetryRequest);
// THEN
assertThat(result.getFeatures().getWorkloadAnalytics(), nullValue());
assertThat(result.getFeatures().getClusterLogsCollection().isEnabled(), is(false));
assertThat(result.getFeatures().getCloudStorageLogging().isEnabled(), is(true));
assertThat(result.getFeatures().getMonitoring().isEnabled(), is(true));
assertThat(result.getDatabusEndpoint(), is(DATABUS_ENDPOINT));
assertThat(result.getMonitoring().getRemoteWriteUrl(), is(MONITORING_REMOTE_WRITE_URL));
}
use of com.sequenceiq.common.api.telemetry.request.MonitoringRequest in project cloudbreak by hortonworks.
the class StackRequestManifester method prepareTelemetryForStack.
private void prepareTelemetryForStack(StackV4Request stackV4Request, DetailedEnvironmentResponse environment, SdxCluster sdxCluster) {
TelemetryResponse envTelemetry = environment.getTelemetry();
if (envTelemetry != null && envTelemetry.getLogging() != null) {
TelemetryRequest telemetryRequest = new TelemetryRequest();
LoggingRequest loggingRequest = new LoggingRequest();
LoggingResponse envLogging = envTelemetry.getLogging();
loggingRequest.setS3(envLogging.getS3());
loggingRequest.setAdlsGen2(envLogging.getAdlsGen2());
loggingRequest.setGcs(envLogging.getGcs());
loggingRequest.setCloudwatch(envLogging.getCloudwatch());
loggingRequest.setStorageLocation(envLogging.getStorageLocation());
telemetryRequest.setLogging(loggingRequest);
MonitoringRequest monitoringRequest = new MonitoringRequest();
MonitoringResponse envMonitoring = envTelemetry.getMonitoring();
if (envMonitoring != null) {
monitoringRequest.setRemoteWriteUrl(envMonitoring.getRemoteWriteUrl());
}
telemetryRequest.setMonitoring(monitoringRequest);
if (envTelemetry.getFeatures() != null) {
FeaturesRequest featuresRequest = new FeaturesRequest();
featuresRequest.setClusterLogsCollection(envTelemetry.getFeatures().getClusterLogsCollection());
featuresRequest.setMonitoring(envTelemetry.getFeatures().getMonitoring());
if (envTelemetry.getFeatures().getCloudStorageLogging() != null) {
featuresRequest.setCloudStorageLogging(envTelemetry.getFeatures().getCloudStorageLogging());
} else {
featuresRequest.addCloudStorageLogging(true);
}
telemetryRequest.setFeatures(featuresRequest);
}
if (envTelemetry.getFluentAttributes() != null) {
Map<String, Object> fluentAttributes = envTelemetry.getFluentAttributes();
if (!fluentAttributes.containsKey(TelemetryClusterDetails.CLUSTER_CRN_KEY)) {
fluentAttributes.put(TelemetryClusterDetails.CLUSTER_CRN_KEY, sdxCluster.getCrn());
}
addAzureIdbrokerMsiToTelemetry(fluentAttributes, stackV4Request);
telemetryRequest.setFluentAttributes(fluentAttributes);
}
stackV4Request.setTelemetry(telemetryRequest);
}
}
Aggregations