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;
}
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();
}
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();
}
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.");
}
}
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);
}
Aggregations