Search in sources :

Example 1 with Monitoring

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;
}
Also used : MonitoringRequest(com.sequenceiq.common.api.telemetry.request.MonitoringRequest) Monitoring(com.sequenceiq.common.api.telemetry.model.Monitoring)

Example 2 with 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;
}
Also used : MonitoringRequest(com.sequenceiq.common.api.telemetry.request.MonitoringRequest) Monitoring(com.sequenceiq.common.api.telemetry.model.Monitoring)

Example 3 with Monitoring

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;
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) Features(com.sequenceiq.common.api.telemetry.model.Features) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Monitoring(com.sequenceiq.common.api.telemetry.model.Monitoring) WorkloadAnalytics(com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)

Example 4 with Monitoring

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));
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Monitoring(com.sequenceiq.common.api.telemetry.model.Monitoring) Test(org.junit.jupiter.api.Test)

Example 5 with Monitoring

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());
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) HashMap(java.util.HashMap) Features(com.sequenceiq.common.api.telemetry.model.Features) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Monitoring(com.sequenceiq.common.api.telemetry.model.Monitoring) WorkloadAnalytics(com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics) Test(org.junit.Test)

Aggregations

Monitoring (com.sequenceiq.common.api.telemetry.model.Monitoring)8 Logging (com.sequenceiq.common.api.telemetry.model.Logging)3 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)3 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)2 Features (com.sequenceiq.common.api.telemetry.model.Features)2 WorkloadAnalytics (com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)2 MonitoringRequest (com.sequenceiq.common.api.telemetry.request.MonitoringRequest)2 HashMap (java.util.HashMap)2 SaltPillarProperties (com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)1 MonitoringConfigView (com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfigView)1 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)1 MonitoringResponse (com.sequenceiq.common.api.telemetry.response.MonitoringResponse)1 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1