use of com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics in project cloudbreak by hortonworks.
the class TelemetryConverter method createWorkloadAnalyticsResponseFromSource.
private WorkloadAnalyticsResponse createWorkloadAnalyticsResponseFromSource(Telemetry telemetry) {
WorkloadAnalyticsResponse waResponse = null;
if (telemetry.getWorkloadAnalytics() != null) {
LOGGER.debug("Setting workload analytics telemetry settings (response).");
WorkloadAnalytics workloadAnalytics = telemetry.getWorkloadAnalytics();
waResponse = new WorkloadAnalyticsResponse();
waResponse.setAttributes(workloadAnalytics.getAttributes());
}
return waResponse;
}
use of com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics 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.WorkloadAnalytics in project cloudbreak by hortonworks.
the class TelemetryConverter method createWorkloadAnalyticsFromRequest.
private WorkloadAnalytics createWorkloadAnalyticsFromRequest(TelemetryRequest request) {
WorkloadAnalytics workloadAnalytics = null;
if (request.getWorkloadAnalytics() != null) {
LOGGER.debug("Create workload analytics telemetry settings from workload analytics request.");
WorkloadAnalyticsRequest workloadAnalyticsRequest = request.getWorkloadAnalytics();
workloadAnalytics = new WorkloadAnalytics();
workloadAnalytics.setAttributes(workloadAnalyticsRequest.getAttributes());
workloadAnalytics.setDatabusEndpoint(databusEndpoint);
}
return workloadAnalytics;
}
use of com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics in project cloudbreak by hortonworks.
the class TelemetryConverter method createWorkloadAnalyticsRequestFromSource.
private WorkloadAnalyticsRequest createWorkloadAnalyticsRequestFromSource(Telemetry telemetry) {
WorkloadAnalyticsRequest waRequest = null;
WorkloadAnalytics workloadAnalytics = telemetry.getWorkloadAnalytics();
if (workloadAnalytics != null) {
waRequest = new WorkloadAnalyticsRequest();
waRequest.setAttributes(workloadAnalytics.getAttributes());
}
return waRequest;
}
use of com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics in project cloudbreak by hortonworks.
the class ClouderaManagerMgmtTelemetryService method setupTelemetryRole.
public void setupTelemetryRole(final Stack stack, final ApiClient client, final ApiHostRef cmHostRef, final ApiRoleList mgmtRoles, final Telemetry telemetry, String sdxStackCrn) throws ApiException {
if (isWorkflowAnalyticsEnabled(stack, telemetry)) {
WorkloadAnalytics workloadAnalytics = telemetry.getWorkloadAnalytics();
String accountId = Crn.safeFromString(stack.getResourceCrn()).getAccountId();
boolean useDbusCnameEndpoint = entitlementService.useDataBusCNameEndpointEnabled(accountId);
String databusEndpoint = dataBusEndpointProvider.getDataBusEndpoint(workloadAnalytics.getDatabusEndpoint(), useDbusCnameEndpoint);
ClouderaManagerResourceApi cmResourceApi = clouderaManagerApiFactory.getClouderaManagerResourceApi(client);
ApiConfigList apiConfigList = buildTelemetryCMConfigList(workloadAnalytics, databusEndpoint);
cmResourceApi.updateConfig("Adding telemetry settings.", apiConfigList);
AltusCredential credentials = clouderaManagerDatabusService.getAltusCredential(stack, sdxStackCrn);
Map<String, String> accountConfigs = new HashMap<>();
accountConfigs.put(ALTUS_CREDENTIAL_ACCESS_KEY_NAME, credentials.getAccessKey());
accountConfigs.put(ALTUS_CREDENTIAL_PRIVATE_KEY_NAME, new String(credentials.getPrivateKey()));
externalAccountService.createExternalAccount(ALTUS_CREDENTIAL_NAME, ALTUS_CREDENTIAL_NAME, ALTUS_CREDENTIAL_TYPE, accountConfigs, client);
final ApiRole telemetryPublisher = new ApiRole();
telemetryPublisher.setName(TELEMETRYPUBLISHER);
telemetryPublisher.setType(TELEMETRYPUBLISHER);
telemetryPublisher.setHostRef(cmHostRef);
mgmtRoles.addItemsItem(telemetryPublisher);
} else {
LOGGER.info("Telemetry WA is disabled");
}
}
Aggregations