org.apache.flink.streaming.util.LatencyStats Java Examples
The following examples show how to use
org.apache.flink.streaming.util.LatencyStats.
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: AbstractStreamOperatorV2.java From flink with Apache License 2.0 | 5 votes |
private LatencyStats createLatencyStats(Configuration taskManagerConfig, int indexInSubtaskGroup) { try { int historySize = taskManagerConfig.getInteger(MetricOptions.LATENCY_HISTORY_SIZE); if (historySize <= 0) { LOG.warn("{} has been set to a value equal or below 0: {}. Using default.", MetricOptions.LATENCY_HISTORY_SIZE, historySize); historySize = MetricOptions.LATENCY_HISTORY_SIZE.defaultValue(); } final String configuredGranularity = taskManagerConfig.getString(MetricOptions.LATENCY_SOURCE_GRANULARITY); LatencyStats.Granularity granularity; try { granularity = LatencyStats.Granularity.valueOf(configuredGranularity.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException iae) { granularity = LatencyStats.Granularity.OPERATOR; LOG.warn( "Configured value {} option for {} is invalid. Defaulting to {}.", configuredGranularity, MetricOptions.LATENCY_SOURCE_GRANULARITY.key(), granularity); } TaskManagerJobMetricGroup jobMetricGroup = this.metrics.parent().parent(); return new LatencyStats(jobMetricGroup.addGroup("latency"), historySize, indexInSubtaskGroup, getOperatorID(), granularity); } catch (Exception e) { LOG.warn("An error occurred while instantiating latency metrics.", e); return new LatencyStats( UnregisteredMetricGroups.createUnregisteredTaskManagerJobMetricGroup().addGroup("latency"), 1, 0, new OperatorID(), LatencyStats.Granularity.SINGLE); } }