Search in sources :

Example 1 with Logging

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

the class TelemetryConverter method convert.

public Telemetry convert(TelemetryRequest request, StackType type) {
    Telemetry telemetry = new Telemetry();
    Features features = new Features();
    LOGGER.debug("Converting telemetry request to telemetry object");
    if (request != null) {
        Logging logging = createLoggingFromRequest(request);
        Monitoring monitoring = createMonitoringFromRequest(request);
        WorkloadAnalytics workloadAnalytics = createWorkloadAnalyticsFromRequest(request);
        telemetry.setLogging(logging);
        telemetry.setMonitoring(monitoring);
        telemetry.setWorkloadAnalytics(workloadAnalytics);
        setWorkloadAnalyticsFeature(telemetry, features);
        setClusterLogsCollection(request, features);
        setMonitoring(request, features);
        setUseSharedAltusCredential(features);
        setCloudStorageLogging(request, features);
        telemetry.setFluentAttributes(request.getFluentAttributes());
    }
    if (monitoringEnabled) {
        LOGGER.debug("Cluster level monitoring feature is enabled");
        features.addMonitoring(true);
    }
    setMeteringFeature(type, features);
    if (StringUtils.isNotEmpty(databusEndpoint)) {
        LOGGER.debug("Setting databus endpoint: {}", databusEndpoint);
        telemetry.setDatabusEndpoint(databusEndpoint);
    }
    telemetry.setFeatures(features);
    return telemetry;
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) 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)

Example 2 with Logging

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

the class CmDiagnosticsDataToParameterConverter method convert.

public CmDiagnosticsParameters convert(BaseCmDiagnosticsCollectionRequest request, Telemetry telemetry, String clusterName, String region) {
    Logging logging = telemetry.getLogging();
    CmDiagnosticsParameters.CmDiagnosticsParametersBuilder builder = CmDiagnosticsParameters.builder();
    if (logging.getS3() != null) {
        S3Config s3Config = s3ConfigGenerator.generateStorageConfig(logging.getStorageLocation());
        builder.withS3Bucket(s3Config.getBucket());
        builder.withS3Location(Paths.get(s3Config.getFolderPrefix(), DIAGNOSTICS_SUFFIX_PATH).toString());
        builder.withS3Region(region);
    } else if (logging.getAdlsGen2() != null) {
        AdlsGen2Config adlsGen2Config = adlsGen2ConfigGenerator.generateStorageConfig(logging.getStorageLocation());
        builder.withAdlsv2StorageAccount(adlsGen2Config.getAccount());
        builder.withAdlsv2StorageContainer(adlsGen2Config.getFileSystem());
        builder.withAdlsv2StorageLocation(Paths.get(adlsGen2Config.getFolderPrefix(), DIAGNOSTICS_SUFFIX_PATH).toString());
    } else if (logging.getGcs() != null) {
        GcsConfig gcsConfig = gcsConfigGenerator.generateStorageConfig(logging.getStorageLocation());
        builder.withGcsBucket(gcsConfig.getBucket());
        builder.withGcsLocation(Paths.get(gcsConfig.getFolderPrefix(), DIAGNOSTICS_SUFFIX_PATH).toString());
    }
    builder.withComments(request.getComments()).withDestination(request.getDestination()).withClusterName(clusterName).withStartTime(request.getStartTime()).withEndTime(request.getEndTime()).withTicketNumber(request.getTicket()).withRoles(request.getRoles()).withBundleSizeBytes(request.getBundleSizeBytes()).withEnableMonitorMetricsCollection(request.getEnableMonitorMetricsCollection()).withUpdatePackage(request.getUpdatePackage()).withSkipValidation(request.getSkipValidation());
    return builder.build();
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) S3Config(com.sequenceiq.cloudbreak.telemetry.fluent.cloud.S3Config) AdlsGen2Config(com.sequenceiq.cloudbreak.telemetry.fluent.cloud.AdlsGen2Config) GcsConfig(com.sequenceiq.cloudbreak.telemetry.fluent.cloud.GcsConfig) CmDiagnosticsParameters(com.sequenceiq.common.model.diagnostics.CmDiagnosticsParameters)

Example 3 with Logging

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

the class DiagnosticsDataToParameterConverter method convert.

public DiagnosticParameters convert(BaseDiagnosticsCollectionRequest request, Telemetry telemetry, String clusterType, String clusterVersion, String accountId, String region, String databusEndpoint) {
    Logging logging = telemetry.getLogging();
    DiagnosticParametersBuilder builder = DiagnosticParameters.builder().withCloudStorageDiagnosticsParameters(diagnosticCloudStorageConverter.loggingToCloudStorageDiagnosticsParameters(logging, region)).withDestination(request.getDestination()).withDescription(request.getDescription()).withClusterType(clusterType).withClusterVersion(clusterVersion).withAccountId(accountId).withIssue(request.getIssue()).withLabels(request.getLabels()).withStartTime(request.getStartTime()).withEndTime(request.getEndTime()).withHostGroups(Optional.ofNullable(request.getHostGroups()).orElse(new HashSet<>())).withHosts(Optional.ofNullable(request.getHosts()).orElse(new HashSet<>())).withExcludeHosts(Optional.ofNullable(request.getExcludeHosts()).orElse(new HashSet<>())).withIncludeSaltLogs(request.getIncludeSaltLogs()).withIncludeSarOutput(request.getIncludeSarOutput()).withIncludeNginxReport(request.getIncludeNginxReport()).withUpdatePackage(request.getUpdatePackage()).withSkipValidation(request.getSkipValidation()).withSkipWorkspaceCleanupOnStartup(request.getSkipWorkspaceCleanupOnStartup()).withSkipUnresponsiveHosts(request.getSkipUnresponsiveHosts()).withAdditionalLogs(request.getAdditionalLogs());
    if (supportBundleConfiguration.isEnabled()) {
        builder.withDbusUrl(databusEndpoint).withDbusS3Url(dataBusEndpointProvider.getDatabusS3Endpoint(databusEndpoint)).withSupportBundleDbusStreamName(supportBundleConfiguration.getDbusStreamName()).withSupportBundleDbusAppName(supportBundleConfiguration.getDbusAppName());
    }
    return builder.build();
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) DiagnosticParametersBuilder(com.sequenceiq.common.model.diagnostics.DiagnosticParameters.DiagnosticParametersBuilder) HashSet(java.util.HashSet)

Example 4 with Logging

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

the class CloudStorageFolderResolverService method updateStorageLocation.

public void updateStorageLocation(Telemetry telemetry, String clusterType, String clusterName, String clusterCrn) {
    LOGGER.debug("Updating/enriching telemetry storage locations with cluster data.");
    if (telemetry != null && telemetry.getLogging() != null && StringUtils.isNotEmpty(telemetry.getLogging().getStorageLocation())) {
        Logging logging = telemetry.getLogging();
        String storageLocation = logging.getStorageLocation();
        if (logging.getS3() != null) {
            storageLocation = resolveS3Location(storageLocation, clusterType, clusterName, clusterCrn);
        } else if (logging.getAdlsGen2() != null) {
            storageLocation = resolveAdlsGen2Location(storageLocation, clusterType, clusterName, clusterCrn);
        } else if (logging.getGcs() != null) {
            storageLocation = resolveGcsLocation(storageLocation, clusterType, clusterName, clusterCrn);
        } else {
            LOGGER.warn("None of the telemetry logging storage location was resolved, " + "make sure storage type is set properly (currently supported: s3, abfs)");
        }
        logging.setStorageLocation(storageLocation);
    } else {
        LOGGER.debug("Telemetry is not set, skipping cloud storage location updates.");
    }
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging)

Example 5 with Logging

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

the class DiagnosticsCollectionValidatorTest method testValidateWithValidCloudStorage.

@Test
void testValidateWithValidCloudStorage() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.CLOUD_STORAGE);
    Telemetry telemetry = new Telemetry();
    Logging logging = new Logging();
    logging.setS3(new S3CloudStorageV1Parameters());
    telemetry.setLogging(logging);
    underTest.validate(request, createStack(), telemetry);
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.jupiter.api.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