Search in sources :

Example 21 with Logging

use of com.sequenceiq.common.api.telemetry.model.Logging in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertToResponseWithEnabledClusterLogsCollectionFeatures.

@Test
public void testConvertToResponseWithEnabledClusterLogsCollectionFeatures() {
    // GIVEN
    Logging logging = new Logging();
    S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
    s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
    logging.setS3(s3Params);
    Telemetry telemetry = new Telemetry();
    telemetry.setLogging(logging);
    Features features = new Features();
    features.setWorkloadAnalytics(null);
    features.addClusterLogsCollection(true);
    telemetry.setFeatures(features);
    // WHEN
    TelemetryResponse result = underTest.convert(telemetry);
    // THEN
    assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
    assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
    assertNull(result.getFeatures().getWorkloadAnalytics());
    assertNull(result.getFeatures().getMetering());
}
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) Features(com.sequenceiq.common.api.telemetry.model.Features) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 22 with Logging

use of com.sequenceiq.common.api.telemetry.model.Logging in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertToResponse.

@Test
public void testConvertToResponse() {
    // GIVEN
    Logging logging = new Logging();
    S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
    s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
    logging.setS3(s3Params);
    Telemetry telemetry = new Telemetry();
    telemetry.setLogging(logging);
    // WHEN
    TelemetryResponse result = underTest.convert(telemetry);
    // THEN
    assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
}
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) Test(org.junit.Test)

Example 23 with Logging

use of com.sequenceiq.common.api.telemetry.model.Logging 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)

Example 24 with Logging

use of com.sequenceiq.common.api.telemetry.model.Logging in project cloudbreak by hortonworks.

the class FluentConfigService method determineAndSetLogging.

private boolean determineAndSetLogging(FluentConfigView.Builder builder, Telemetry telemetry, boolean databusEnabled, boolean meteringEnabled) {
    boolean cloudStorageLoggingEnabled = false;
    boolean cloudLogServiceLoggingEnabled = false;
    if (telemetry.getLogging() != null) {
        Logging logging = telemetry.getLogging();
        if (logging.getS3() != null) {
            fillS3Configs(builder, logging.getStorageLocation());
            LOGGER.debug("Fluent will be configured to use S3 output.");
            cloudStorageLoggingEnabled = true;
        } else if (logging.getAdlsGen2() != null) {
            fillAdlsGen2Configs(builder, logging.getStorageLocation(), logging.getAdlsGen2());
            LOGGER.debug("Fluent will be configured to use ADLS Gen2 output.");
            cloudStorageLoggingEnabled = true;
        } else if (logging.getGcs() != null) {
            fillGcsConfigs(builder, logging.getStorageLocation(), logging.getGcs());
            LOGGER.debug("Fluent will be configured to use GCS output");
            cloudStorageLoggingEnabled = true;
        } else if (logging.getCloudwatch() != null) {
            fillCloudwatchConfigs(builder, logging.getStorageLocation(), logging.getCloudwatch());
            LOGGER.debug("Fluent will be configured to use Cloudwatch output.");
            cloudLogServiceLoggingEnabled = true;
        }
    }
    if (!telemetry.isCloudStorageLoggingEnabled()) {
        LOGGER.debug("Disable (override) cloud storage logging as feature setting is disabled.");
        cloudStorageLoggingEnabled = false;
    }
    builder.withCloudStorageLoggingEnabled(cloudStorageLoggingEnabled).withCloudLoggingServiceEnabled(cloudLogServiceLoggingEnabled);
    boolean databusLogEnabled = fillDiagnosticsConfigs(telemetry, databusEnabled, meteringEnabled, builder);
    return cloudStorageLoggingEnabled || databusLogEnabled || cloudLogServiceLoggingEnabled;
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging)

Example 25 with Logging

use of com.sequenceiq.common.api.telemetry.model.Logging in project cloudbreak by hortonworks.

the class TelemetryConverter method createLoggingResponseFromSource.

private LoggingResponse createLoggingResponseFromSource(Telemetry telemetry) {
    LoggingResponse loggingResponse = null;
    if (telemetry.getLogging() != null) {
        LOGGER.debug("Setting logging telemetry settings (response).");
        Logging logging = telemetry.getLogging();
        loggingResponse = new LoggingResponse();
        loggingResponse.setStorageLocation(logging.getStorageLocation());
        loggingResponse.setS3(logging.getS3());
        loggingResponse.setAdlsGen2(logging.getAdlsGen2());
        loggingResponse.setGcs(logging.getGcs());
        loggingResponse.setCloudwatch(CloudwatchParams.copy(logging.getCloudwatch()));
    }
    return loggingResponse;
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse)

Aggregations

Logging (com.sequenceiq.common.api.telemetry.model.Logging)38 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)30 Test (org.junit.Test)21 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)15 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)10 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)7 Backup (com.sequenceiq.freeipa.api.model.Backup)7 Test (org.junit.jupiter.api.Test)7 BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)4 Features (com.sequenceiq.common.api.telemetry.model.Features)4 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)4 CloudFileSystemView (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView)3 Monitoring (com.sequenceiq.common.api.telemetry.model.Monitoring)3 WorkloadAnalytics (com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)3 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)2 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)2 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)2 StackTags (com.sequenceiq.cloudbreak.cloud.model.StackTags)1 AwsInstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1