@Override public FlowletId getParent() { return new FlowletId(namespace, application, flow, flowlet); }
public static Map<String, String> flowlet(FlowletId flowletId) { return ImmutableMap.of( Constants.Metrics.Tag.NAMESPACE, flowletId.getNamespace(), Constants.Metrics.Tag.APP, flowletId.getApplication(), Constants.Metrics.Tag.FLOW, flowletId.getFlow(), Constants.Metrics.Tag.FLOWLET, flowletId.getFlowlet()); }
@Override public Iterable<String> toIdParts() { return Collections.unmodifiableList(Arrays.asList(getNamespace(), getApplication(), getVersion(), getFlow(), flowlet)); }
@SuppressWarnings("unused") public static FlowletId fromIdParts(Iterable<String> idString) { Iterator<String> iterator = idString.iterator(); return new FlowletId( new ApplicationId(next(iterator, "namespace"), next(iterator, "application"), next(iterator, "version")), next(iterator, "flow"), nextAndEnd(iterator, "flowlet")); }
public static Flowlet fromEntityId(FlowletId flowletId) { return from(Id.Application.fromEntityId(flowletId.getParent().getParent()), flowletId.getFlow(), flowletId.getFlowlet()); }
public FlowletQueueId queue(String queue) { // Note: FlowletQueueId is not versioned return new FlowletQueueId(getNamespace(), getApplication(), getFlow(), flowlet, queue); }
@Override public String getEntityName() { return getFlowlet(); }
public String getFlowletId() { return flowletId.getFlowlet(); }
@Override public int hashCode() { Integer hashCode = this.hashCode; if (hashCode == null) { this.hashCode = hashCode = Objects.hash(super.hashCode(), getNamespace(), getApplication(), getVersion(), getFlow(), flowlet); } return hashCode; }
private FlowletId deserializeFlowletId(JsonObject id) { FlowId flow = deserializeFlowId(id); String flowletId = id.get("flowlet").getAsString(); return new FlowletId(flow.getParent(), flow.getProgram(), flowletId); }
CConfiguration cConf) { super(program, programOptions, cConf, datasets, dsFramework, txClient, discoveryServiceClient, false, metricsService, ImmutableMap.of(Constants.Metrics.Tag.FLOWLET, flowletId.getFlowlet(), Constants.Metrics.Tag.INSTANCE_ID, String.valueOf(instanceId)), secureStore, secureStoreManager, messagingService, null, metadataReader, metadataPublisher); this.groupId = FlowUtils.generateConsumerGroupId(program.getId(), flowletId.getFlowlet()); this.instanceId = instanceId; this.instanceCount = instanceCount;
@Override public ProgramId getParent() { return new ProgramId(new ApplicationId(getNamespace(), getApplication(), getVersion()), ProgramType.FLOW, getFlow()); }
private FlowletId deserializeFlowletId(JsonObject id) { FlowId flow = deserializeFlowId(id.getAsJsonObject("flow")); String flowletId = id.get("id").getAsString(); return new FlowletId(flow.getParent(), flow.getProgram(), flowletId); }
@Override public MetricsContext load(ImmutablePair<String, String> key) throws Exception { return getProgramMetrics() .childContext(ImmutableMap.of( Constants.Metrics.Tag.PRODUCER, key.getFirst(), Constants.Metrics.Tag.FLOWLET_QUEUE, key.getSecond(), Constants.Metrics.Tag.CONSUMER, BasicFlowletContext.this.flowletId.getFlowlet())); } });
/** * returns flowlet related metrics * @param namespace * @param appName * @param flowName * @param flowletName * @return {@link co.cask.cdap.api.metrics.RuntimeMetrics} */ public RuntimeMetrics getFlowletMetrics(String namespace, String appName, String flowName, String flowletName) { FlowletId flowletId = new FlowletId(namespace, appName, flowName, flowletName); return getMetrics(MetricsTags.flowlet(flowletId), Constants.Metrics.Name.Flow.FLOWLET_INPUT, Constants.Metrics.Name.Flow.FLOWLET_PROCESSED, Constants.Metrics.Name.Flow.FLOWLET_EXCEPTIONS); }
@Override public FlowletId toEntityId() { return new FlowletId(flow.getNamespaceId(), flow.getApplicationId(), flow.getId(), id); }
public FlowletId flowlet(String flowlet) { if (type != ProgramType.FLOW) { throw new IllegalArgumentException("Expected program type for flowlet to be " + ProgramType.FLOW); } return new FlowletId(new ApplicationId(getNamespace(), getApplication(), getVersion()), program, flowlet); }