Search in sources :

Example 26 with Logging

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

the class TelemetryConverter method createLoggingRequestFromSource.

private LoggingRequest createLoggingRequestFromSource(Telemetry telemetry) {
    LoggingRequest loggingRequest = null;
    Logging logging = telemetry.getLogging();
    if (logging != null) {
        loggingRequest = new LoggingRequest();
        loggingRequest.setS3(logging.getS3());
        loggingRequest.setAdlsGen2(logging.getAdlsGen2());
        loggingRequest.setGcs(logging.getGcs());
        loggingRequest.setCloudwatch(CloudwatchParams.copy(logging.getCloudwatch()));
        loggingRequest.setStorageLocation(logging.getStorageLocation());
    }
    return loggingRequest;
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest)

Example 27 with Logging

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

the class TelemetryConverter method createLoggingFromRequest.

private Logging createLoggingFromRequest(TelemetryRequest request) {
    Logging logging = null;
    if (request.getLogging() != null) {
        LOGGER.debug("Create loggging telemetry settings from logging request.");
        LoggingRequest loggingRequest = request.getLogging();
        logging = new Logging();
        logging.setStorageLocation(loggingRequest.getStorageLocation());
        logging.setS3(loggingRequest.getS3());
        logging.setAdlsGen2(loggingRequest.getAdlsGen2());
        logging.setGcs(loggingRequest.getGcs());
        logging.setCloudwatch(CloudwatchParams.copy(loggingRequest.getCloudwatch()));
    }
    return logging;
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest)

Example 28 with Logging

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

the class DiagnosticsCollectionValidatorTest method testValidateWithCloudStorageWithEmptyTelemetryLoggingSetting.

@Test
void testValidateWithCloudStorageWithEmptyTelemetryLoggingSetting() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.CLOUD_STORAGE);
    Telemetry telemetry = new Telemetry();
    telemetry.setLogging(new Logging());
    BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, createStack(), telemetry));
    assertTrue(thrown.getMessage().contains("S3, ABFS or GCS cloud storage logging setting should be enabled for Data Hub"));
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.jupiter.api.Test)

Example 29 with Logging

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

the class FluentConfigServiceTest method testCreateFluentConfig.

@Test
public void testCreateFluentConfig() {
    // GIVEN
    Logging logging = new Logging();
    logging.setStorageLocation("mybucket/cluster-logs/datahub/cl1");
    logging.setS3(new S3CloudStorageV1Parameters());
    Telemetry telemetry = new Telemetry();
    telemetry.setLogging(logging);
    // WHEN
    FluentConfigView result = underTest.createFluentConfigs(DEFAULT_FLUENT_CLUSTER_DETAILS, false, false, REGION_SAMPLE, telemetry);
    // THEN
    assertTrue(result.isEnabled());
    assertTrue(result.isCloudStorageLoggingEnabled());
    assertEquals("cluster-logs/datahub/cl1", result.getLogFolderName());
    assertEquals("mybucket", result.getS3LogArchiveBucketName());
    assertEquals(Crn.Region.EU_1.getName(), result.toMap().get("environmentRegion"));
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 30 with Logging

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

the class FluentConfigServiceTest method testCreateFluentConfigWithFullAdlsGen2Path.

@Test
public void testCreateFluentConfigWithFullAdlsGen2Path() {
    // GIVEN
    Logging logging = new Logging();
    logging.setStorageLocation("abfs://mycontainer@myaccount.dfs.core.windows.net/my/custom/path");
    AdlsGen2CloudStorageV1Parameters parameters = new AdlsGen2CloudStorageV1Parameters();
    parameters.setAccountKey("myAccountKey");
    parameters.setAccountName("myAccount");
    logging.setAdlsGen2(parameters);
    Telemetry telemetry = new Telemetry();
    telemetry.setLogging(logging);
    // WHEN
    FluentConfigView result = underTest.createFluentConfigs(DEFAULT_FLUENT_CLUSTER_DETAILS, false, false, REGION_SAMPLE, telemetry);
    // THEN
    assertTrue(result.isEnabled());
    assertEquals("myAccountKey", result.getAzureStorageAccessKey());
    assertEquals("myaccount", result.getAzureStorageAccount());
    assertEquals("/my/custom/path", result.getLogFolderName());
    assertEquals("mycontainer", result.getAzureContainer());
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

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