org.apache.flink.runtime.metrics.MetricNames Java Examples
The following examples show how to use
org.apache.flink.runtime.metrics.MetricNames.
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: MultipleInputStreamTaskTest.java From flink with Apache License 2.0 | 6 votes |
/** * Tests the checkpoint related metrics are registered into {@link TaskIOMetricGroup} * correctly while generating the {@link TwoInputStreamTask}. */ @Test public void testCheckpointBarrierMetrics() throws Exception { final Map<String, Metric> metrics = new ConcurrentHashMap<>(); final TaskMetricGroup taskMetricGroup = new StreamTaskTestHarness.TestTaskMetricGroup(metrics); try (StreamTaskMailboxTestHarness<String> testHarness = new MultipleInputStreamTaskTestHarnessBuilder<>(MultipleInputStreamTask::new, BasicTypeInfo.STRING_TYPE_INFO) .addInput(BasicTypeInfo.STRING_TYPE_INFO, 2) .addInput(BasicTypeInfo.INT_TYPE_INFO, 2) .addInput(BasicTypeInfo.DOUBLE_TYPE_INFO, 2) .setupOutputForSingletonOperatorChain(new MapToStringMultipleInputOperatorFactory()) .setTaskMetricGroup(taskMetricGroup) .build()) { assertThat(metrics, IsMapContaining.hasKey(MetricNames.CHECKPOINT_ALIGNMENT_TIME)); assertThat(metrics, IsMapContaining.hasKey(MetricNames.CHECKPOINT_START_DELAY_TIME)); testHarness.endInput(); testHarness.waitForTaskCompletion(); } }
Example #2
Source File: MetricUtilsTest.java From flink with Apache License 2.0 | 6 votes |
/** * Tests that heap/non-heap metrics do not rely on a static MemoryUsage instance. * * <p>We can only check this easily for the currently used heap memory, so we use it this as a proxy for testing * the functionality in general. */ @Test public void testHeapMetrics() throws Exception { final InterceptingOperatorMetricGroup heapMetrics = new InterceptingOperatorMetricGroup(); MetricUtils.instantiateHeapMemoryMetrics(heapMetrics); @SuppressWarnings("unchecked") final Gauge<Long> used = (Gauge<Long>) heapMetrics.get(MetricNames.MEMORY_USED); final long usedHeapInitially = used.getValue(); // check memory usage difference multiple times since other tests may affect memory usage as well for (int x = 0; x < 10; x++) { final byte[] array = new byte[1024 * 1024 * 8]; final long usedHeapAfterAllocation = used.getValue(); if (usedHeapInitially != usedHeapAfterAllocation) { return; } Thread.sleep(50); } Assert.fail("Heap usage metric never changed it's value."); }
Example #3
Source File: TaskIOMetricGroup.java From flink with Apache License 2.0 | 6 votes |
public TaskIOMetricGroup(TaskMetricGroup parent) { super(parent); this.numBytesIn = counter(MetricNames.IO_NUM_BYTES_IN); this.numBytesOut = counter(MetricNames.IO_NUM_BYTES_OUT); this.numBytesInRate = meter(MetricNames.IO_NUM_BYTES_IN_RATE, new MeterView(numBytesIn, 60)); this.numBytesOutRate = meter(MetricNames.IO_NUM_BYTES_OUT_RATE, new MeterView(numBytesOut, 60)); this.numRecordsIn = counter(MetricNames.IO_NUM_RECORDS_IN, new SumCounter()); this.numRecordsOut = counter(MetricNames.IO_NUM_RECORDS_OUT, new SumCounter()); this.numRecordsInRate = meter(MetricNames.IO_NUM_RECORDS_IN_RATE, new MeterView(numRecordsIn, 60)); this.numRecordsOutRate = meter(MetricNames.IO_NUM_RECORDS_OUT_RATE, new MeterView(numRecordsOut, 60)); this.numBuffersOut = counter(MetricNames.IO_NUM_BUFFERS_OUT); this.numBuffersOutRate = meter(MetricNames.IO_NUM_BUFFERS_OUT_RATE, new MeterView(numBuffersOut, 60)); }
Example #4
Source File: TaskIOMetricGroup.java From flink with Apache License 2.0 | 6 votes |
public TaskIOMetricGroup(TaskMetricGroup parent) { super(parent); this.numBytesIn = counter(MetricNames.IO_NUM_BYTES_IN); this.numBytesOut = counter(MetricNames.IO_NUM_BYTES_OUT); this.numBytesInRate = meter(MetricNames.IO_NUM_BYTES_IN_RATE, new MeterView(numBytesIn)); this.numBytesOutRate = meter(MetricNames.IO_NUM_BYTES_OUT_RATE, new MeterView(numBytesOut)); this.numRecordsIn = counter(MetricNames.IO_NUM_RECORDS_IN, new SumCounter()); this.numRecordsOut = counter(MetricNames.IO_NUM_RECORDS_OUT, new SumCounter()); this.numRecordsInRate = meter(MetricNames.IO_NUM_RECORDS_IN_RATE, new MeterView(numRecordsIn)); this.numRecordsOutRate = meter(MetricNames.IO_NUM_RECORDS_OUT_RATE, new MeterView(numRecordsOut)); this.numBuffersOut = counter(MetricNames.IO_NUM_BUFFERS_OUT); this.numBuffersOutRate = meter(MetricNames.IO_NUM_BUFFERS_OUT_RATE, new MeterView(numBuffersOut)); this.idleTimePerSecond = meter(MetricNames.TASK_IDLE_TIME, new MeterView(new SimpleCounter())); }
Example #5
Source File: MetricUtilsTest.java From flink with Apache License 2.0 | 6 votes |
/** * Tests that heap/non-heap metrics do not rely on a static MemoryUsage instance. * * <p>We can only check this easily for the currently used heap memory, so we use it this as a proxy for testing * the functionality in general. */ @Test public void testHeapMetrics() throws Exception { final InterceptingOperatorMetricGroup heapMetrics = new InterceptingOperatorMetricGroup(); MetricUtils.instantiateHeapMemoryMetrics(heapMetrics); @SuppressWarnings("unchecked") final Gauge<Long> used = (Gauge<Long>) heapMetrics.get(MetricNames.MEMORY_USED); final long usedHeapInitially = used.getValue(); // check memory usage difference multiple times since other tests may affect memory usage as well for (int x = 0; x < 10; x++) { final byte[] array = new byte[1024 * 1024 * 8]; final long usedHeapAfterAllocation = used.getValue(); if (usedHeapInitially != usedHeapAfterAllocation) { return; } Thread.sleep(50); } Assert.fail("Heap usage metric never changed it's value."); }
Example #6
Source File: MetricUtilsTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Tests that heap/non-heap metrics do not rely on a static MemoryUsage instance. * * <p>We can only check this easily for the currently used heap memory, so we use it this as a proxy for testing * the functionality in general. */ @Test public void testHeapMetrics() throws Exception { final InterceptingOperatorMetricGroup heapMetrics = new InterceptingOperatorMetricGroup(); MetricUtils.instantiateHeapMemoryMetrics(heapMetrics); @SuppressWarnings("unchecked") final Gauge<Long> used = (Gauge<Long>) heapMetrics.get(MetricNames.MEMORY_USED); final long usedHeapInitially = used.getValue(); // check memory usage difference multiple times since other tests may affect memory usage as well for (int x = 0; x < 10; x++) { final byte[] array = new byte[1024 * 1024 * 8]; final long usedHeapAfterAllocation = used.getValue(); if (usedHeapInitially != usedHeapAfterAllocation) { return; } Thread.sleep(50); } Assert.fail("Heap usage metric never changed it's value."); }
Example #7
Source File: OneInputStreamTask.java From flink with Apache License 2.0 | 6 votes |
@Override public void init() throws Exception { StreamConfig configuration = getConfiguration(); int numberOfInputs = configuration.getNumberOfInputs(); if (numberOfInputs > 0) { CheckpointedInputGate inputGate = createCheckpointedInputGate(); DataOutput<IN> output = createDataOutput(); StreamTaskInput<IN> input = createTaskInput(inputGate, output); inputProcessor = new StreamOneInputProcessor<>( input, output, operatorChain); } headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, this.inputWatermarkGauge); // wrap watermark gauge since registered metrics must be unique getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, this.inputWatermarkGauge::getValue); }
Example #8
Source File: OneInputStreamTaskTest.java From flink with Apache License 2.0 | 6 votes |
/** * Tests the checkpoint related metrics are registered into {@link TaskIOMetricGroup} * correctly while generating the {@link OneInputStreamTask}. */ @Test public void testCheckpointBarrierMetrics() throws Exception { final OneInputStreamTaskTestHarness<String, String> testHarness = new OneInputStreamTaskTestHarness<>( OneInputStreamTask::new, BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO); testHarness.setupOutputForSingletonOperatorChain(); StreamConfig streamConfig = testHarness.getStreamConfig(); streamConfig.setStreamOperator(new TestOperator()); final Map<String, Metric> metrics = new ConcurrentHashMap<>(); final TaskMetricGroup taskMetricGroup = new StreamTaskTestHarness.TestTaskMetricGroup(metrics); final StreamMockEnvironment environment = testHarness.createEnvironment(); environment.setTaskMetricGroup(taskMetricGroup); testHarness.invoke(environment); testHarness.waitForTaskRunning(); assertThat(metrics, IsMapContaining.hasKey(MetricNames.CHECKPOINT_ALIGNMENT_TIME)); assertThat(metrics, IsMapContaining.hasKey(MetricNames.CHECKPOINT_START_DELAY_TIME)); testHarness.endInput(); testHarness.waitForTaskCompletion(); }
Example #9
Source File: TaskIOMetricGroup.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
public TaskIOMetricGroup(TaskMetricGroup parent) { super(parent); this.numBytesOut = counter(MetricNames.IO_NUM_BYTES_OUT); this.numBytesInLocal = counter(MetricNames.IO_NUM_BYTES_IN_LOCAL); this.numBytesInRemote = counter(MetricNames.IO_NUM_BYTES_IN_REMOTE); this.numBytesOutRate = meter(MetricNames.IO_NUM_BYTES_OUT_RATE, new MeterView(numBytesOut, 60)); this.numBytesInRateLocal = meter(MetricNames.IO_NUM_BYTES_IN_LOCAL_RATE, new MeterView(numBytesInLocal, 60)); this.numBytesInRateRemote = meter(MetricNames.IO_NUM_BYTES_IN_REMOTE_RATE, new MeterView(numBytesInRemote, 60)); this.numRecordsIn = counter(MetricNames.IO_NUM_RECORDS_IN, new SumCounter()); this.numRecordsOut = counter(MetricNames.IO_NUM_RECORDS_OUT, new SumCounter()); this.numRecordsInRate = meter(MetricNames.IO_NUM_RECORDS_IN_RATE, new MeterView(numRecordsIn, 60)); this.numRecordsOutRate = meter(MetricNames.IO_NUM_RECORDS_OUT_RATE, new MeterView(numRecordsOut, 60)); this.numBuffersOut = counter(MetricNames.IO_NUM_BUFFERS_OUT); this.numBuffersInLocal = counter(MetricNames.IO_NUM_BUFFERS_IN_LOCAL); this.numBuffersInRemote = counter(MetricNames.IO_NUM_BUFFERS_IN_REMOTE); this.numBuffersOutRate = meter(MetricNames.IO_NUM_BUFFERS_OUT_RATE, new MeterView(numBuffersOut, 60)); this.numBuffersInRateLocal = meter(MetricNames.IO_NUM_BUFFERS_IN_LOCAL_RATE, new MeterView(numBuffersInLocal, 60)); this.numBuffersInRateRemote = meter(MetricNames.IO_NUM_BUFFERS_IN_REMOTE_RATE, new MeterView(numBuffersInRemote, 60)); }
Example #10
Source File: AbstractTwoInputStreamTask.java From flink with Apache License 2.0 | 5 votes |
@Override public void init() throws Exception { StreamConfig configuration = getConfiguration(); ClassLoader userClassLoader = getUserCodeClassLoader(); TypeSerializer<IN1> inputDeserializer1 = configuration.getTypeSerializerIn1(userClassLoader); TypeSerializer<IN2> inputDeserializer2 = configuration.getTypeSerializerIn2(userClassLoader); int numberOfInputs = configuration.getNumberOfInputs(); ArrayList<IndexedInputGate> inputList1 = new ArrayList<>(); ArrayList<IndexedInputGate> inputList2 = new ArrayList<>(); List<StreamEdge> inEdges = configuration.getInPhysicalEdges(userClassLoader); for (int i = 0; i < numberOfInputs; i++) { int inputType = inEdges.get(i).getTypeNumber(); IndexedInputGate reader = getEnvironment().getInputGate(i); switch (inputType) { case 1: inputList1.add(reader); break; case 2: inputList2.add(reader); break; default: throw new RuntimeException("Invalid input type number: " + inputType); } } createInputProcessor(inputList1, inputList2, inputDeserializer1, inputDeserializer2); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_1_WATERMARK, input1WatermarkGauge); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_2_WATERMARK, input2WatermarkGauge); // wrap watermark gauge since registered metrics must be unique getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge::getValue); }
Example #11
Source File: MultipleInputStreamTask.java From flink with Apache License 2.0 | 5 votes |
@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); }
Example #12
Source File: MetricUtilsTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testHeapMetricsCompleteness() { final InterceptingOperatorMetricGroup heapMetrics = new InterceptingOperatorMetricGroup(); MetricUtils.instantiateHeapMemoryMetrics(heapMetrics); Assert.assertNotNull(heapMetrics.get(MetricNames.MEMORY_USED)); Assert.assertNotNull(heapMetrics.get(MetricNames.MEMORY_COMMITTED)); Assert.assertNotNull(heapMetrics.get(MetricNames.MEMORY_MAX)); }
Example #13
Source File: MetricUtilsTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testNonHeapMetricsCompleteness() { final InterceptingOperatorMetricGroup nonHeapMetrics = new InterceptingOperatorMetricGroup(); MetricUtils.instantiateNonHeapMemoryMetrics(nonHeapMetrics); Assert.assertNotNull(nonHeapMetrics.get(MetricNames.MEMORY_USED)); Assert.assertNotNull(nonHeapMetrics.get(MetricNames.MEMORY_COMMITTED)); Assert.assertNotNull(nonHeapMetrics.get(MetricNames.MEMORY_MAX)); }
Example #14
Source File: InputChannelMetrics.java From flink with Apache License 2.0 | 5 votes |
private static Counter createCounter(String name, MetricGroup ... parents) { Counter[] counters = new Counter[parents.length]; for (int i = 0; i < parents.length; i++) { counters[i] = parents[i].counter(name); parents[i].meter(name + MetricNames.SUFFIX_RATE, new MeterView(counters[i])); } return new MultiCounterWrapper(counters); }
Example #15
Source File: JobVertexWatermarksHandler.java From flink with Apache License 2.0 | 5 votes |
@Override protected MetricCollectionResponseBody handleRequest( HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request, AccessExecutionJobVertex jobVertex) throws RestHandlerException { String jobID = request.getPathParameter(JobIDPathParameter.class).toString(); String taskID = jobVertex.getJobVertexId().toString(); metricFetcher.update(); MetricStore.TaskMetricStore taskMetricStore = metricFetcher.getMetricStore().getTaskMetricStore(jobID, taskID); if (taskMetricStore == null) { return new MetricCollectionResponseBody(Collections.emptyList()); } AccessExecutionVertex[] taskVertices = jobVertex.getTaskVertices(); List<Metric> metrics = new ArrayList<>(taskVertices.length); for (AccessExecutionVertex taskVertex : taskVertices) { String id = taskVertex.getParallelSubtaskIndex() + "." + MetricNames.IO_CURRENT_INPUT_WATERMARK; String watermarkValue = taskMetricStore.getMetric(id); if (watermarkValue != null) { metrics.add(new Metric(id, watermarkValue)); } } return new MetricCollectionResponseBody(metrics); }
Example #16
Source File: SlotManagerImpl.java From flink with Apache License 2.0 | 5 votes |
private void registerSlotManagerMetrics() { slotManagerMetricGroup.gauge( MetricNames.TASK_SLOTS_AVAILABLE, () -> (long) getNumberFreeSlots()); slotManagerMetricGroup.gauge( MetricNames.TASK_SLOTS_TOTAL, () -> (long) getNumberRegisteredSlots()); }
Example #17
Source File: TwoInputStreamTaskTest.java From flink with Apache License 2.0 | 5 votes |
/** * Tests the checkpoint related metrics are registered into {@link TaskIOMetricGroup} * correctly while generating the {@link TwoInputStreamTask}. */ @Test public void testCheckpointBarrierMetrics() throws Exception { final TwoInputStreamTaskTestHarness<String, Integer, String> testHarness = new TwoInputStreamTaskTestHarness<>( TwoInputStreamTask::new, BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO); final StreamConfig streamConfig = testHarness.getStreamConfig(); final CoStreamMap<String, Integer, String> coMapOperator = new CoStreamMap<>(new IdentityMap()); testHarness.setupOutputForSingletonOperatorChain(); streamConfig.setStreamOperator(coMapOperator); final Map<String, Metric> metrics = new ConcurrentHashMap<>(); final TaskMetricGroup taskMetricGroup = new StreamTaskTestHarness.TestTaskMetricGroup(metrics); final StreamMockEnvironment environment = testHarness.createEnvironment(); environment.setTaskMetricGroup(taskMetricGroup); testHarness.invoke(environment); testHarness.waitForTaskRunning(); assertThat(metrics, IsMapContaining.hasKey(MetricNames.CHECKPOINT_ALIGNMENT_TIME)); assertThat(metrics, IsMapContaining.hasKey(MetricNames.CHECKPOINT_START_DELAY_TIME)); testHarness.endInput(); testHarness.waitForTaskCompletion(); }
Example #18
Source File: OperatorIOMetricGroup.java From flink with Apache License 2.0 | 5 votes |
public OperatorIOMetricGroup(OperatorMetricGroup parentMetricGroup) { super(parentMetricGroup); numRecordsIn = parentMetricGroup.counter(MetricNames.IO_NUM_RECORDS_IN); numRecordsOut = parentMetricGroup.counter(MetricNames.IO_NUM_RECORDS_OUT); numRecordsInRate = parentMetricGroup.meter(MetricNames.IO_NUM_RECORDS_IN_RATE, new MeterView(numRecordsIn)); numRecordsOutRate = parentMetricGroup.meter(MetricNames.IO_NUM_RECORDS_OUT_RATE, new MeterView(numRecordsOut)); }
Example #19
Source File: MetricFunction.java From alchemy with Apache License 2.0 | 5 votes |
default Counter createOrGet(Counter numRecordsOut, RuntimeContext runtimeContext) { if (numRecordsOut == null) { MetricGroup metricGroup = runtimeContext.getMetricGroup().addGroup(metricGroupName()); numRecordsOut = metricGroup.counter(MetricNames.IO_NUM_RECORDS_OUT); metricGroup.meter(MetricNames.IO_NUM_RECORDS_OUT_RATE, new MeterView(numRecordsOut, 60)); } return numRecordsOut; }
Example #20
Source File: AbstractTwoInputStreamTask.java From flink with Apache License 2.0 | 5 votes |
@Override public void init() throws Exception { StreamConfig configuration = getConfiguration(); ClassLoader userClassLoader = getUserCodeClassLoader(); TypeSerializer<IN1> inputDeserializer1 = configuration.getTypeSerializerIn1(userClassLoader); TypeSerializer<IN2> inputDeserializer2 = configuration.getTypeSerializerIn2(userClassLoader); int numberOfInputs = configuration.getNumberOfInputs(); ArrayList<InputGate> inputList1 = new ArrayList<InputGate>(); ArrayList<InputGate> inputList2 = new ArrayList<InputGate>(); List<StreamEdge> inEdges = configuration.getInPhysicalEdges(userClassLoader); for (int i = 0; i < numberOfInputs; i++) { int inputType = inEdges.get(i).getTypeNumber(); InputGate reader = getEnvironment().getInputGate(i); switch (inputType) { case 1: inputList1.add(reader); break; case 2: inputList2.add(reader); break; default: throw new RuntimeException("Invalid input type number: " + inputType); } } createInputProcessor(inputList1, inputList2, inputDeserializer1, inputDeserializer2); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_1_WATERMARK, input1WatermarkGauge); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_2_WATERMARK, input2WatermarkGauge); // wrap watermark gauge since registered metrics must be unique getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, minInputWatermarkGauge::getValue); }
Example #21
Source File: OneInputStreamTask.java From flink with Apache License 2.0 | 5 votes |
@Override public void init() throws Exception { StreamConfig configuration = getConfiguration(); TypeSerializer<IN> inSerializer = configuration.getTypeSerializerIn1(getUserCodeClassLoader()); int numberOfInputs = configuration.getNumberOfInputs(); if (numberOfInputs > 0) { InputGate[] inputGates = getEnvironment().getAllInputGates(); inputProcessor = new StreamOneInputProcessor<>( inputGates, inSerializer, this, configuration.getCheckpointMode(), getCheckpointLock(), getEnvironment().getIOManager(), getEnvironment().getTaskManagerInfo().getConfiguration(), getStreamStatusMaintainer(), this.headOperator, getEnvironment().getMetricGroup().getIOMetricGroup(), inputWatermarkGauge, getTaskNameWithSubtaskAndId(), operatorChain); } headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, this.inputWatermarkGauge); // wrap watermark gauge since registered metrics must be unique getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, this.inputWatermarkGauge::getValue); }
Example #22
Source File: OperatorChain.java From flink with Apache License 2.0 | 5 votes |
private <IN, OUT> WatermarkGaugeExposingOutput<StreamRecord<IN>> createChainedOperator( StreamTask<?, ?> containingTask, StreamConfig operatorConfig, Map<Integer, StreamConfig> chainedConfigs, ClassLoader userCodeClassloader, Map<StreamEdge, RecordWriterOutput<?>> streamOutputs, List<StreamOperator<?>> allOperators, OutputTag<IN> outputTag) { // create the output that the operator writes to first. this may recursively create more operators WatermarkGaugeExposingOutput<StreamRecord<OUT>> chainedOperatorOutput = createOutputCollector( containingTask, operatorConfig, chainedConfigs, userCodeClassloader, streamOutputs, allOperators); // now create the operator and give it the output collector to write its output to StreamOperatorFactory<OUT> chainedOperatorFactory = operatorConfig.getStreamOperatorFactory(userCodeClassloader); OneInputStreamOperator<IN, OUT> chainedOperator = chainedOperatorFactory.createStreamOperator( containingTask, operatorConfig, chainedOperatorOutput); allOperators.add(chainedOperator); WatermarkGaugeExposingOutput<StreamRecord<IN>> currentOperatorOutput; if (containingTask.getExecutionConfig().isObjectReuseEnabled()) { currentOperatorOutput = new ChainingOutput<>(chainedOperator, this, outputTag); } else { TypeSerializer<IN> inSerializer = operatorConfig.getTypeSerializerIn1(userCodeClassloader); currentOperatorOutput = new CopyingChainingOutput<>(chainedOperator, inSerializer, outputTag, this); } // wrap watermark gauges since registered metrics must be unique chainedOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, currentOperatorOutput.getWatermarkGauge()::getValue); chainedOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_OUTPUT_WATERMARK, chainedOperatorOutput.getWatermarkGauge()::getValue); return currentOperatorOutput; }
Example #23
Source File: MetricUtilsTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testNonHeapMetricsCompleteness() { final InterceptingOperatorMetricGroup nonHeapMetrics = new InterceptingOperatorMetricGroup(); MetricUtils.instantiateNonHeapMemoryMetrics(nonHeapMetrics); Assert.assertNotNull(nonHeapMetrics.get(MetricNames.MEMORY_USED)); Assert.assertNotNull(nonHeapMetrics.get(MetricNames.MEMORY_COMMITTED)); Assert.assertNotNull(nonHeapMetrics.get(MetricNames.MEMORY_MAX)); }
Example #24
Source File: OperatorIOMetricGroup.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public OperatorIOMetricGroup(OperatorMetricGroup parentMetricGroup) { super(parentMetricGroup); numRecordsIn = parentMetricGroup.counter(MetricNames.IO_NUM_RECORDS_IN); numRecordsOut = parentMetricGroup.counter(MetricNames.IO_NUM_RECORDS_OUT); numRecordsInRate = parentMetricGroup.meter(MetricNames.IO_NUM_RECORDS_IN_RATE, new MeterView(numRecordsIn, 60)); numRecordsOutRate = parentMetricGroup.meter(MetricNames.IO_NUM_RECORDS_OUT_RATE, new MeterView(numRecordsOut, 60)); }
Example #25
Source File: ResourceManager.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void registerSlotAndTaskExecutorMetrics() { jobManagerMetricGroup.gauge( MetricNames.TASK_SLOTS_AVAILABLE, () -> (long) slotManager.getNumberFreeSlots()); jobManagerMetricGroup.gauge( MetricNames.TASK_SLOTS_TOTAL, () -> (long) slotManager.getNumberRegisteredSlots()); jobManagerMetricGroup.gauge( MetricNames.NUM_REGISTERED_TASK_MANAGERS, () -> (long) taskExecutors.size()); }
Example #26
Source File: MetricUtilsTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testNonHeapMetricsCompleteness() { final InterceptingOperatorMetricGroup nonHeapMetrics = new InterceptingOperatorMetricGroup(); MetricUtils.instantiateNonHeapMemoryMetrics(nonHeapMetrics); Assert.assertNotNull(nonHeapMetrics.get(MetricNames.MEMORY_USED)); Assert.assertNotNull(nonHeapMetrics.get(MetricNames.MEMORY_COMMITTED)); Assert.assertNotNull(nonHeapMetrics.get(MetricNames.MEMORY_MAX)); }
Example #27
Source File: MetricUtilsTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testHeapMetricsCompleteness() { final InterceptingOperatorMetricGroup heapMetrics = new InterceptingOperatorMetricGroup(); MetricUtils.instantiateHeapMemoryMetrics(heapMetrics); Assert.assertNotNull(heapMetrics.get(MetricNames.MEMORY_USED)); Assert.assertNotNull(heapMetrics.get(MetricNames.MEMORY_COMMITTED)); Assert.assertNotNull(heapMetrics.get(MetricNames.MEMORY_MAX)); }
Example #28
Source File: OneInputStreamTask.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void init() throws Exception { StreamConfig configuration = getConfiguration(); TypeSerializer<IN> inSerializer = configuration.getTypeSerializerIn1(getUserCodeClassLoader()); int numberOfInputs = configuration.getNumberOfInputs(); if (numberOfInputs > 0) { InputGate[] inputGates = getEnvironment().getAllInputGates(); inputProcessor = new StreamInputProcessor<>( inputGates, inSerializer, this, configuration.getCheckpointMode(), getCheckpointLock(), getEnvironment().getIOManager(), getEnvironment().getTaskManagerInfo().getConfiguration(), getStreamStatusMaintainer(), this.headOperator, getEnvironment().getMetricGroup().getIOMetricGroup(), inputWatermarkGauge); } headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, this.inputWatermarkGauge); // wrap watermark gauge since registered metrics must be unique getEnvironment().getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, this.inputWatermarkGauge::getValue); }
Example #29
Source File: OperatorChain.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private <IN, OUT> WatermarkGaugeExposingOutput<StreamRecord<IN>> createChainedOperator( StreamTask<?, ?> containingTask, StreamConfig operatorConfig, Map<Integer, StreamConfig> chainedConfigs, ClassLoader userCodeClassloader, Map<StreamEdge, RecordWriterOutput<?>> streamOutputs, List<StreamOperator<?>> allOperators, OutputTag<IN> outputTag) { // create the output that the operator writes to first. this may recursively create more operators WatermarkGaugeExposingOutput<StreamRecord<OUT>> chainedOperatorOutput = createOutputCollector( containingTask, operatorConfig, chainedConfigs, userCodeClassloader, streamOutputs, allOperators); // now create the operator and give it the output collector to write its output to OneInputStreamOperator<IN, OUT> chainedOperator = operatorConfig.getStreamOperator(userCodeClassloader); chainedOperator.setup(containingTask, operatorConfig, chainedOperatorOutput); allOperators.add(chainedOperator); WatermarkGaugeExposingOutput<StreamRecord<IN>> currentOperatorOutput; if (containingTask.getExecutionConfig().isObjectReuseEnabled()) { currentOperatorOutput = new ChainingOutput<>(chainedOperator, this, outputTag); } else { TypeSerializer<IN> inSerializer = operatorConfig.getTypeSerializerIn1(userCodeClassloader); currentOperatorOutput = new CopyingChainingOutput<>(chainedOperator, inSerializer, outputTag, this); } // wrap watermark gauges since registered metrics must be unique chainedOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_INPUT_WATERMARK, currentOperatorOutput.getWatermarkGauge()::getValue); chainedOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_OUTPUT_WATERMARK, chainedOperatorOutput.getWatermarkGauge()::getValue); return currentOperatorOutput; }
Example #30
Source File: OperatorIOMetricGroup.java From flink with Apache License 2.0 | 5 votes |
public OperatorIOMetricGroup(OperatorMetricGroup parentMetricGroup) { super(parentMetricGroup); numRecordsIn = parentMetricGroup.counter(MetricNames.IO_NUM_RECORDS_IN); numRecordsOut = parentMetricGroup.counter(MetricNames.IO_NUM_RECORDS_OUT); numRecordsInRate = parentMetricGroup.meter(MetricNames.IO_NUM_RECORDS_IN_RATE, new MeterView(numRecordsIn, 60)); numRecordsOutRate = parentMetricGroup.meter(MetricNames.IO_NUM_RECORDS_OUT_RATE, new MeterView(numRecordsOut, 60)); }