Search in sources :

Example 26 with Features

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

the class AccountTelemetryConverter method convertFeatures.

public Features convertFeatures(FeaturesRequest request) {
    Features features = null;
    if (request != null) {
        features = new Features();
        features.setClusterLogsCollection(request.getClusterLogsCollection());
        features.setMonitoring(request.getMonitoring());
        features.setWorkloadAnalytics(request.getWorkloadAnalytics());
    }
    return features;
}
Also used : Features(com.sequenceiq.common.api.telemetry.model.Features)

Example 27 with Features

use of com.sequenceiq.common.api.telemetry.model.Features 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 28 with Features

use of com.sequenceiq.common.api.telemetry.model.Features 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 29 with Features

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

the class DiagnosticsCollectionValidatorTest method testValidateWithValidEngDestination.

@Test
void testValidateWithValidEngDestination() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.ENG);
    Telemetry telemetry = new Telemetry();
    Features features = new Features();
    FeatureSetting clusterLogsCollection = new FeatureSetting();
    clusterLogsCollection.setEnabled(true);
    features.setClusterLogsCollection(clusterLogsCollection);
    telemetry.setFeatures(features);
    underTest.validate(request, createStack(), telemetry);
}
Also used : BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) FeatureSetting(com.sequenceiq.common.api.type.FeatureSetting) Features(com.sequenceiq.common.api.telemetry.model.Features) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.jupiter.api.Test)

Example 30 with Features

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

the class FluentConfigServiceTest method setClusterLogsCollection.

private void setClusterLogsCollection(Telemetry telemetry) {
    Features features = new Features();
    features.addClusterLogsCollection(true);
    telemetry.setFeatures(features);
}
Also used : Features(com.sequenceiq.common.api.telemetry.model.Features)

Aggregations

Features (com.sequenceiq.common.api.telemetry.model.Features)33 Test (org.junit.jupiter.api.Test)19 EnvironmentTelemetry (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry)16 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)10 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)10 AccountTelemetry (com.sequenceiq.environment.telemetry.domain.AccountTelemetry)10 ExperimentalFeatures (com.sequenceiq.environment.environment.domain.ExperimentalFeatures)8 EnvironmentFeatures (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures)8 NetworkDto (com.sequenceiq.environment.network.dto.NetworkDto)8 FeaturesRequest (com.sequenceiq.common.api.telemetry.request.FeaturesRequest)7 EnvironmentRequest (com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentRequest)7 EnvironmentCreationDto (com.sequenceiq.environment.environment.dto.EnvironmentCreationDto)7 FreeIpaCreationDto (com.sequenceiq.environment.environment.dto.FreeIpaCreationDto)7 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)4 Logging (com.sequenceiq.common.api.telemetry.model.Logging)4 FeatureSetting (com.sequenceiq.common.api.type.FeatureSetting)4 EnvironmentBackup (com.sequenceiq.environment.environment.dto.EnvironmentBackup)4 BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)3 WorkloadAnalytics (com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)3