Search in sources :

Example 6 with MeteringConfiguration

use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration in project cloudbreak by hortonworks.

the class DatabusRequestConverterTest method testConvertWithGrpcBody.

@Test
public void testConvertWithGrpcBody() {
    // GIVEN
    DbusProto.PutRecordRequest exampleProtoObj = DbusProto.PutRecordRequest.newBuilder().setRecord(DbusProto.Record.newBuilder().setStreamName("example").build()).build();
    MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, "CdpVmMetrics", "CdpVmMetrics");
    DatabusRequest input = DatabusRequest.Builder.newBuilder().withMessageBody(exampleProtoObj).withContext(DatabusRequestContext.Builder.newBuilder().withAccountId("cloudera").build()).build();
    // WHEN
    DbusProto.PutRecordRequest result = DatabusRequestConverter.convert(input, meteringConfiguration);
    // THEN
    assertTrue(result.getRecord().getBody().getPayload().toStringUtf8().contains("example"));
}
Also used : MeteringConfiguration(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration) DatabusRequest(com.sequenceiq.cloudbreak.sigmadbus.model.DatabusRequest) DbusProto(com.cloudera.sigma.service.dbus.DbusProto) Test(org.junit.jupiter.api.Test)

Example 7 with MeteringConfiguration

use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration in project cloudbreak by hortonworks.

the class TelemetryConverterTest method setUp.

@BeforeEach
public void setUp() {
    AltusDatabusConfiguration altusDatabusConfiguration = new AltusDatabusConfiguration(DATABUS_ENDPOINT, DATABUS_S3_BUCKET, false, "", null);
    MeteringConfiguration meteringConfiguration = new MeteringConfiguration(false, null, null);
    ClusterLogsCollectionConfiguration logCollectionConfig = new ClusterLogsCollectionConfiguration(true, null, null);
    MonitoringConfiguration monitoringConfig = new MonitoringConfiguration();
    monitoringConfig.setEnabled(true);
    TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration(altusDatabusConfiguration, meteringConfiguration, logCollectionConfig, monitoringConfig, null);
    underTest = new TelemetryConverter(telemetryConfiguration, true);
}
Also used : MeteringConfiguration(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration) TelemetryConfiguration(com.sequenceiq.cloudbreak.telemetry.TelemetryConfiguration) AltusDatabusConfiguration(com.sequenceiq.cloudbreak.altus.AltusDatabusConfiguration) MonitoringConfiguration(com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfiguration) ClusterLogsCollectionConfiguration(com.sequenceiq.cloudbreak.telemetry.logcollection.ClusterLogsCollectionConfiguration) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with MeteringConfiguration

use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration in project cloudbreak by hortonworks.

the class FluentConfigServiceTest method setUp.

@Before
public void setUp() {
    MeteringConfiguration meteringConfiguration = new MeteringConfiguration(false, null, null);
    ClusterLogsCollectionConfiguration logCollectionConfig = new ClusterLogsCollectionConfiguration(false, null, null);
    TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration(null, meteringConfiguration, logCollectionConfig, null, null);
    underTest = new FluentConfigService(new S3ConfigGenerator(), new AdlsGen2ConfigGenerator(), new GcsConfigGenerator(), new AnonymizationRuleResolver(), telemetryConfiguration);
}
Also used : MeteringConfiguration(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration) TelemetryConfiguration(com.sequenceiq.cloudbreak.telemetry.TelemetryConfiguration) S3ConfigGenerator(com.sequenceiq.cloudbreak.telemetry.fluent.cloud.S3ConfigGenerator) GcsConfigGenerator(com.sequenceiq.cloudbreak.telemetry.fluent.cloud.GcsConfigGenerator) AdlsGen2ConfigGenerator(com.sequenceiq.cloudbreak.telemetry.fluent.cloud.AdlsGen2ConfigGenerator) AnonymizationRuleResolver(com.sequenceiq.cloudbreak.telemetry.common.AnonymizationRuleResolver) ClusterLogsCollectionConfiguration(com.sequenceiq.cloudbreak.telemetry.logcollection.ClusterLogsCollectionConfiguration) Before(org.junit.Before)

Example 9 with MeteringConfiguration

use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithWADisabledGlobally.

@Test
public void testConvertFromEnvAndSdxResponseWithWADisabledGlobally() {
    // GIVEN
    TelemetryResponse response = new TelemetryResponse();
    SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
    sdxClusterResponse.setCrn("crn:cdp:cloudbreak:us-west-1:someone:sdxcluster:sdxId");
    sdxClusterResponse.setName("sdxName");
    AltusDatabusConfiguration altusDatabusConfiguration = new AltusDatabusConfiguration(DATABUS_ENDPOINT, DATABUS_S3_BUCKET, false, "", null);
    MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, null, null);
    ClusterLogsCollectionConfiguration logCollectionConfig = new ClusterLogsCollectionConfiguration(true, null, null);
    MonitoringConfiguration monitoringConfig = new MonitoringConfiguration();
    monitoringConfig.setEnabled(true);
    TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration(altusDatabusConfiguration, meteringConfiguration, logCollectionConfig, monitoringConfig, null);
    TelemetryConverter converter = new TelemetryConverter(telemetryConfiguration, false, true);
    // WHEN
    TelemetryRequest result = converter.convert(response, sdxClusterResponse);
    // THEN
    assertNull(result.getWorkloadAnalytics());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) MeteringConfiguration(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration) TelemetryConfiguration(com.sequenceiq.cloudbreak.telemetry.TelemetryConfiguration) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) AltusDatabusConfiguration(com.sequenceiq.cloudbreak.altus.AltusDatabusConfiguration) MonitoringConfiguration(com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfiguration) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) ClusterLogsCollectionConfiguration(com.sequenceiq.cloudbreak.telemetry.logcollection.ClusterLogsCollectionConfiguration) Test(org.junit.Test)

Example 10 with MeteringConfiguration

use of com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration in project cloudbreak by hortonworks.

the class DatabusRequestConverterTest method testConvertWithoutContext.

@Test
public void testConvertWithoutContext() {
    // GIVEN
    MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, "CdpVmMetrics", "CdpVmMetrics");
    DatabusRequest input = DatabusRequest.Builder.newBuilder().withRawBody("{}").build();
    // WHEN
    IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> DatabusRequestConverter.convert(input, meteringConfiguration));
    // THEN
    assertTrue(exception.getMessage().contains("Databus request context needs to be filled"));
}
Also used : MeteringConfiguration(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration) DatabusRequest(com.sequenceiq.cloudbreak.sigmadbus.model.DatabusRequest) Test(org.junit.jupiter.api.Test)

Aggregations

MeteringConfiguration (com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration)11 TelemetryConfiguration (com.sequenceiq.cloudbreak.telemetry.TelemetryConfiguration)6 ClusterLogsCollectionConfiguration (com.sequenceiq.cloudbreak.telemetry.logcollection.ClusterLogsCollectionConfiguration)6 AltusDatabusConfiguration (com.sequenceiq.cloudbreak.altus.AltusDatabusConfiguration)5 DatabusRequest (com.sequenceiq.cloudbreak.sigmadbus.model.DatabusRequest)5 MonitoringConfiguration (com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfiguration)5 Test (org.junit.jupiter.api.Test)5 DbusProto (com.cloudera.sigma.service.dbus.DbusProto)2 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)2 SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)2 Before (org.junit.Before)2 Test (org.junit.Test)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 AnonymizationRuleResolver (com.sequenceiq.cloudbreak.telemetry.common.AnonymizationRuleResolver)1 AdlsGen2ConfigGenerator (com.sequenceiq.cloudbreak.telemetry.fluent.cloud.AdlsGen2ConfigGenerator)1 GcsConfigGenerator (com.sequenceiq.cloudbreak.telemetry.fluent.cloud.GcsConfigGenerator)1 S3ConfigGenerator (com.sequenceiq.cloudbreak.telemetry.fluent.cloud.S3ConfigGenerator)1 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)1