Search in sources :

Example 1 with MonitoringRequest

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

Example 2 with MonitoringRequest

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

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

Example 4 with MonitoringRequest

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));
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) MonitoringRequest(com.sequenceiq.common.api.telemetry.request.MonitoringRequest) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.jupiter.api.Test)

Example 5 with MonitoringRequest

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);
    }
}
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)

Aggregations

MonitoringRequest (com.sequenceiq.common.api.telemetry.request.MonitoringRequest)9 FeaturesRequest (com.sequenceiq.common.api.telemetry.request.FeaturesRequest)4 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)4 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)4 Monitoring (com.sequenceiq.common.api.telemetry.model.Monitoring)2 MonitoringResponse (com.sequenceiq.common.api.telemetry.response.MonitoringResponse)2 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)1 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)1 WorkloadAnalyticsRequest (com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest)1 FeaturesResponse (com.sequenceiq.common.api.telemetry.response.FeaturesResponse)1 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)1 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)1 FeatureSetting (com.sequenceiq.common.api.type.FeatureSetting)1 Test (org.junit.jupiter.api.Test)1