use of com.sequenceiq.common.api.telemetry.model.Monitoring 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.model.Monitoring 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.model.Monitoring in project cloudbreak by hortonworks.
the class TelemetryConverter method convert.
public Telemetry convert(TelemetryRequest request, StackType type) {
Telemetry telemetry = new Telemetry();
Features features = new Features();
LOGGER.debug("Converting telemetry request to telemetry object");
if (request != null) {
Logging logging = createLoggingFromRequest(request);
Monitoring monitoring = createMonitoringFromRequest(request);
WorkloadAnalytics workloadAnalytics = createWorkloadAnalyticsFromRequest(request);
telemetry.setLogging(logging);
telemetry.setMonitoring(monitoring);
telemetry.setWorkloadAnalytics(workloadAnalytics);
setWorkloadAnalyticsFeature(telemetry, features);
setClusterLogsCollection(request, features);
setMonitoring(request, features);
setUseSharedAltusCredential(features);
setCloudStorageLogging(request, features);
telemetry.setFluentAttributes(request.getFluentAttributes());
}
if (monitoringEnabled) {
LOGGER.debug("Cluster level monitoring feature is enabled");
features.addMonitoring(true);
}
setMeteringFeature(type, features);
if (StringUtils.isNotEmpty(databusEndpoint)) {
LOGGER.debug("Setting databus endpoint: {}", databusEndpoint);
telemetry.setDatabusEndpoint(databusEndpoint);
}
telemetry.setFeatures(features);
return telemetry;
}
use of com.sequenceiq.common.api.telemetry.model.Monitoring in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToResponse.
@Test
public void testConvertToResponse() {
Logging logging = new Logging();
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
logging.setS3(s3Params);
Telemetry telemetry = new Telemetry();
telemetry.setLogging(logging);
Monitoring monitoring = new Monitoring();
monitoring.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
telemetry.setMonitoring(monitoring);
// WHEN
TelemetryResponse result = underTest.convert(telemetry);
// THEN
assertThat(result.getLogging().getS3().getInstanceProfile(), is(INSTANCE_PROFILE_VALUE));
assertThat(result.getMonitoring().getRemoteWriteUrl(), is(MONITORING_REMOTE_WRITE_URL));
}
use of com.sequenceiq.common.api.telemetry.model.Monitoring in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToRequest.
@Test
public void testConvertToRequest() {
// GIVEN
Telemetry telemetry = new Telemetry();
telemetry.setDatabusEndpoint(DATABUS_ENDPOINT);
Logging logging = new Logging();
logging.setS3(new S3CloudStorageV1Parameters());
telemetry.setLogging(logging);
Monitoring monitoring = new Monitoring();
monitoring.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
telemetry.setMonitoring(monitoring);
Features features = new Features();
features.addClusterLogsCollection(true);
features.addMonitoring(true);
telemetry.setFeatures(features);
WorkloadAnalytics workloadAnalytics = new WorkloadAnalytics();
Map<String, Object> waAttributes = new HashMap<>();
waAttributes.put("myWAKey", "myWAValue");
workloadAnalytics.setAttributes(waAttributes);
telemetry.setWorkloadAnalytics(workloadAnalytics);
Map<String, Object> fluentAttributes = new HashMap<>();
fluentAttributes.put("myKey", "myValue");
telemetry.setFluentAttributes(fluentAttributes);
// WHEN
TelemetryRequest result = underTest.convertToRequest(telemetry);
// THEN
assertNotNull(result.getLogging().getS3());
assertEquals("myValue", result.getFluentAttributes().get("myKey"));
assertEquals("myWAValue", result.getWorkloadAnalytics().getAttributes().get("myWAKey"));
assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
assertTrue(result.getFeatures().getMonitoring().isEnabled());
assertEquals(MONITORING_REMOTE_WRITE_URL, result.getMonitoring().getRemoteWriteUrl());
}
Aggregations