org.apache.flink.streaming.runtime.metrics.MinWatermarkGauge Java Examples

The following examples show how to use org.apache.flink.streaming.runtime.metrics.MinWatermarkGauge. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TwoInputStreamTask.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor for initialization, possibly with initial state (recovery / savepoint / etc).
 *
 * @param env The task environment for this task.
 */
public TwoInputStreamTask(Environment env) {
	super(env);
	input1WatermarkGauge = new WatermarkGauge();
	input2WatermarkGauge = new WatermarkGauge();
	minInputWatermarkGauge = new MinWatermarkGauge(input1WatermarkGauge, input2WatermarkGauge);
}
 
Example #2
Source File: AbstractTwoInputStreamTask.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor for initialization, possibly with initial state (recovery / savepoint / etc).
 *
 * @param env The task environment for this task.
 */
public AbstractTwoInputStreamTask(Environment env) {
	super(env);

	input1WatermarkGauge = new WatermarkGauge();
	input2WatermarkGauge = new WatermarkGauge();
	minInputWatermarkGauge = new MinWatermarkGauge(input1WatermarkGauge, input2WatermarkGauge);
}
 
Example #3
Source File: AbstractTwoInputStreamTask.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor for initialization, possibly with initial state (recovery / savepoint / etc).
 *
 * @param env The task environment for this task.
 */
public AbstractTwoInputStreamTask(Environment env) throws Exception {
	super(env);

	input1WatermarkGauge = new WatermarkGauge();
	input2WatermarkGauge = new WatermarkGauge();
	minInputWatermarkGauge = new MinWatermarkGauge(input1WatermarkGauge, input2WatermarkGauge);
}
 
Example #4
Source File: MultipleInputStreamTask.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void init() throws Exception {
	StreamConfig configuration = getConfiguration();
	ClassLoader userClassLoader = getUserCodeClassLoader();

	TypeSerializer<?>[] inputDeserializers = configuration.getTypeSerializersIn(userClassLoader);

	ArrayList<IndexedInputGate>[] inputLists = new ArrayList[inputDeserializers.length];
	WatermarkGauge[] watermarkGauges = new WatermarkGauge[inputDeserializers.length];

	for (int i = 0; i < inputDeserializers.length; i++) {
		inputLists[i] = new ArrayList<>();
		watermarkGauges[i] = new WatermarkGauge();
		headOperator.getMetricGroup().gauge(MetricNames.currentInputWatermarkName(i + 1), watermarkGauges[i]);
	}

	MinWatermarkGauge minInputWatermarkGauge = new MinWatermarkGauge(watermarkGauges);
	headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge);

	List<StreamEdge> inEdges = configuration.getInPhysicalEdges(userClassLoader);
	int numberOfInputs = configuration.getNumberOfInputs();

	for (int i = 0; i < numberOfInputs; i++) {
		int inputType = inEdges.get(i).getTypeNumber();
		IndexedInputGate reader = getEnvironment().getInputGate(i);
		inputLists[inputType - 1].add(reader);
	}

	createInputProcessor(inputLists, inputDeserializers, watermarkGauges);

	// wrap watermark gauge since registered metrics must be unique
	getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge::getValue);
}