private String appendPgId(String name, ProcessGroupStatus status, boolean appendPgId) { if(appendPgId) { return name + MetricNames.METRIC_NAME_SEPARATOR + status.getId(); } else { return name; } }
public static ComponentMapHolder createComponentMap(final ProcessGroupStatus status) { return createComponentMap(status, new ParentProcessGroupSearchNode(status.getId(), null)); }
public static ComponentDetails forProcessGroup(final ProcessGroupStatus status) { return forProcessGroup(status.getId(), status.getName()); }
.add(MetricFields.APP_ID, applicationId) .add(MetricFields.HOSTNAME, hostname) .add(MetricFields.INSTANCE_ID, status.getId()) .add(MetricFields.TIMESTAMP, currentTimeMillis);
try { existingNiFiFlow = atlasClient.fetchNiFiFlow(rootProcessGroup.getId(), clusterName); } catch (AtlasServiceException e) { if (ClientResponse.Status.NOT_FOUND.equals(e.getStatus())){ getLogger().debug("Existing flow was not found for {}@{}", new Object[]{rootProcessGroup.getId(), clusterName}); } else { throw new RuntimeException("Failed to fetch existing NiFI flow. " + e, e); final NiFiFlow nifiFlow = existingNiFiFlow != null ? existingNiFiFlow : new NiFiFlow(rootProcessGroup.getId()); nifiFlow.setFlowName(flowName); nifiFlow.setUrl(nifiUrl);
componentNameMap.put(status.getId(), status.getName()); componentNameMap.put(childGroup.getId(), childGroup.getName()); ParentProcessGroupSearchNode childProcessGroupNode = new ParentProcessGroupSearchNode(childGroup.getId(), thisProcessGroupNode); componentToParentGroupMap.put(childGroup.getId(), thisProcessGroupNode); holder.putAll(createComponentMap(childGroup, childProcessGroupNode));
@Override public void onTrigger(ReportingContext context) { final ProcessGroupStatus status = context.getEventAccess().getControllerStatus(); metricsPrefix = context.getProperty(METRICS_PREFIX).evaluateAttributeExpressions().getValue(); environment = context.getProperty(ENVIRONMENT).evaluateAttributeExpressions().getValue(); statusId = status.getId(); defaultTags = ImmutableMap.of("env", environment, "dataflow_id", statusId); try { updateDataDogTransport(context); } catch (IOException e) { e.printStackTrace(); } updateAllMetricGroups(status); ddMetricRegistryBuilder.getDatadogReporter().report(); }
final JsonObject metricsObject = metricsBuilder .applicationId(applicationId) .instanceId(status.getId()) .hostname(hostname) .timestamp(System.currentTimeMillis()) attributes.put(CoreAttributes.MIME_TYPE.key(), "application/json"); } else { final JsonObject metricsObject = metricsService.getMetrics(factory, status, virtualMachineMetrics, applicationId, status.getId(), hostname, System.currentTimeMillis(), os.getAvailableProcessors(), systemLoad >= 0 ? systemLoad : -1); data = getData(context, new ByteArrayInputStream(metricsObject.toString().getBytes(StandardCharsets.UTF_8)), attributes);
final PermissionsDTO permissions = createPermissionsDto(childGroup); final ProcessGroupStatusDTO status = getComponentStatus( () -> groupStatus.getProcessGroupStatus().stream().filter(processGroupStatus -> childGroup.getIdentifier().equals(processGroupStatus.getId())).findFirst().orElse(null), processGroupStatus -> createConciseProcessGroupStatusDto(processGroupStatus) );
.instanceId(status.getId()) .hostname(hostname) .timestamp(start)
componentType, componentName); addField(builder, "componentId", status.getId()); addField(builder, "bytesRead", status.getBytesRead()); addField(builder, "bytesWritten", status.getBytesWritten()); applicationName, platform, status.getId(), currentDate); applicationName, platform, status.getId(), currentDate); applicationName, platform, status.getId(), currentDate); hostname, applicationName, platform, status.getId(), currentDate); hostname, applicationName, platform, status.getId(), currentDate); applicationName, platform, status.getId(), currentDate);
final PermissionsDTO permissions = createPermissionsDto(processGroup); final ProcessGroupStatusDTO status = getComponentStatus( () -> groupStatus.getProcessGroupStatus().stream().filter(processGroupStatus -> processGroup.getIdentifier().equals(processGroupStatus.getId())).findFirst().orElse(null), processGroupStatus -> createConciseProcessGroupStatusDto(processGroupStatus) );
public ProcessGroupStatusDTO createConciseProcessGroupStatusDto(final ProcessGroupStatus processGroupStatus) { final ProcessGroupStatusDTO processGroupStatusDto = new ProcessGroupStatusDTO(); processGroupStatusDto.setId(processGroupStatus.getId()); processGroupStatusDto.setName(processGroupStatus.getName()); processGroupStatusDto.setStatsLastRefreshed(new Date()); processGroupStatusDto.setAggregateSnapshot(snapshot); snapshot.setId(processGroupStatus.getId()); snapshot.setName(processGroupStatus.getName());
try { existingNiFiFlow = atlasClient.fetchNiFiFlow(rootProcessGroup.getId(), clusterName); } catch (AtlasServiceException e) { if (ClientResponse.Status.NOT_FOUND.equals(e.getStatus())){ getLogger().debug("Existing flow was not found for {}@{}", new Object[]{rootProcessGroup.getId(), clusterName}); } else { throw new RuntimeException("Failed to fetch existing NiFI flow. " + e, e); final NiFiFlow nifiFlow = existingNiFiFlow != null ? existingNiFiFlow : new NiFiFlow(rootProcessGroup.getId()); nifiFlow.setFlowName(flowName); nifiFlow.setUrl(nifiUrl);
final JsonObject metricsObject = metricsBuilder .applicationId(applicationId) .instanceId(status.getId()) .hostname(hostname) .timestamp(System.currentTimeMillis()) attributes.put(CoreAttributes.MIME_TYPE.key(), "application/json"); } else { final JsonObject metricsObject = metricsService.getMetrics(factory, status, virtualMachineMetrics, applicationId, status.getId(), hostname, System.currentTimeMillis(), os.getAvailableProcessors(), systemLoad >= 0 ? systemLoad : -1); data = getData(context, new ByteArrayInputStream(metricsObject.toString().getBytes(StandardCharsets.UTF_8)), attributes);
if (status.getId().equals(componentId)) { return status.getName();
.instanceId(status.getId()) .hostname(hostname) .timestamp(start)
componentType, componentName); addField(builder, "componentId", status.getId()); addField(builder, "bytesRead", status.getBytesRead()); addField(builder, "bytesWritten", status.getBytesWritten()); applicationName, platform, status.getId(), currentDate); applicationName, platform, status.getId(), currentDate); applicationName, platform, status.getId(), currentDate); hostname, applicationName, platform, status.getId(), currentDate); hostname, applicationName, platform, status.getId(), currentDate); applicationName, platform, status.getId(), currentDate);