Search in sources :

Example 1 with MonitoringResponse

use of com.sequenceiq.common.api.telemetry.response.MonitoringResponse in project cloudbreak by hortonworks.

the class TelemetryConverter method createMonitoringResponseFromSource.

private MonitoringResponse createMonitoringResponseFromSource(Monitoring monitoring) {
    MonitoringResponse monitoringResponse = null;
    if (monitoring != null) {
        monitoringResponse = new MonitoringResponse();
        monitoringResponse.setRemoteWriteUrl(monitoring.getRemoteWriteUrl());
    }
    return monitoringResponse;
}
Also used : MonitoringResponse(com.sequenceiq.common.api.telemetry.response.MonitoringResponse)

Example 2 with MonitoringResponse

use of com.sequenceiq.common.api.telemetry.response.MonitoringResponse in project cloudbreak by hortonworks.

the class TelemetryApiConverter method createMonitoringResponseFromSource.

private MonitoringResponse createMonitoringResponseFromSource(EnvironmentMonitoring monitoring) {
    MonitoringResponse monitoringResponse = null;
    if (monitoring != null) {
        monitoringResponse = new MonitoringResponse();
        monitoringResponse.setRemoteWriteUrl(monitoring.getRemoteWriteUrl());
    }
    return monitoringResponse;
}
Also used : MonitoringResponse(com.sequenceiq.common.api.telemetry.response.MonitoringResponse)

Example 3 with MonitoringResponse

use of com.sequenceiq.common.api.telemetry.response.MonitoringResponse 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);
    }
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) MonitoringRequest(com.sequenceiq.common.api.telemetry.request.MonitoringRequest) MonitoringResponse(com.sequenceiq.common.api.telemetry.response.MonitoringResponse) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest)

Example 4 with MonitoringResponse

use of com.sequenceiq.common.api.telemetry.response.MonitoringResponse in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithMonitoring.

@Test
public void testConvertFromEnvAndSdxResponseWithMonitoring() {
    // GIVEN
    TelemetryResponse response = new TelemetryResponse();
    FeaturesResponse featuresResponse = new FeaturesResponse();
    featuresResponse.addMonitoring(true);
    response.setFeatures(featuresResponse);
    MonitoringResponse monitoringResponse = new MonitoringResponse();
    monitoringResponse.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
    response.setMonitoring(monitoringResponse);
    // WHEN
    TelemetryRequest result = underTest.convert(response, null);
    // THEN
    assertTrue(result.getFeatures().getMonitoring().isEnabled());
    assertEquals(MONITORING_REMOTE_WRITE_URL, result.getMonitoring().getRemoteWriteUrl());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse) MonitoringResponse(com.sequenceiq.common.api.telemetry.response.MonitoringResponse) Test(org.junit.Test)

Example 5 with MonitoringResponse

use of com.sequenceiq.common.api.telemetry.response.MonitoringResponse in project cloudbreak by hortonworks.

the class TelemetryConverter method createMonitoringRequestFromResponse.

private MonitoringRequest createMonitoringRequestFromResponse(TelemetryResponse response) {
    MonitoringRequest monitoringRequest = null;
    if (response.getMonitoring() != null) {
        LOGGER.debug("Setting monitoring response (telemetry) based on environment response");
        MonitoringResponse monitoringResponse = response.getMonitoring();
        monitoringRequest = new MonitoringRequest();
        monitoringRequest.setRemoteWriteUrl(monitoringResponse.getRemoteWriteUrl());
    }
    return monitoringRequest;
}
Also used : MonitoringRequest(com.sequenceiq.common.api.telemetry.request.MonitoringRequest) MonitoringResponse(com.sequenceiq.common.api.telemetry.response.MonitoringResponse)

Aggregations

MonitoringResponse (com.sequenceiq.common.api.telemetry.response.MonitoringResponse)7 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)3 MonitoringRequest (com.sequenceiq.common.api.telemetry.request.MonitoringRequest)2 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)2 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)2 Monitoring (com.sequenceiq.common.api.telemetry.model.Monitoring)1 FeaturesRequest (com.sequenceiq.common.api.telemetry.request.FeaturesRequest)1 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)1 FeaturesResponse (com.sequenceiq.common.api.telemetry.response.FeaturesResponse)1 WorkloadAnalyticsResponse (com.sequenceiq.common.api.telemetry.response.WorkloadAnalyticsResponse)1 Test (org.junit.Test)1