Java Code Examples for org.apache.flink.runtime.rest.handler.legacy.metrics.MetricStore#TaskManagerMetricStore

The following examples show how to use org.apache.flink.runtime.rest.handler.legacy.metrics.MetricStore#TaskManagerMetricStore . 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: TaskManagerDetailsHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private static List<TaskManagerMetricsInfo.GarbageCollectorInfo> createGarbageCollectorInfo(MetricStore.TaskManagerMetricStore taskManagerMetricStore) {
	Preconditions.checkNotNull(taskManagerMetricStore);

	ArrayList<TaskManagerMetricsInfo.GarbageCollectorInfo> garbageCollectorInfos = new ArrayList<>(taskManagerMetricStore.garbageCollectorNames.size());

	for (String garbageCollectorName: taskManagerMetricStore.garbageCollectorNames) {
		final String count = taskManagerMetricStore.getMetric("Status.JVM.GarbageCollector." + garbageCollectorName + ".Count", null);
		final String time = taskManagerMetricStore.getMetric("Status.JVM.GarbageCollector." + garbageCollectorName + ".Time", null);

		if (count != null && time != null) {
			garbageCollectorInfos.add(
				new TaskManagerMetricsInfo.GarbageCollectorInfo(
					garbageCollectorName,
					Long.valueOf(count),
					Long.valueOf(time)));
		}
	}

	return garbageCollectorInfos;
}
 
Example 2
Source File: AggregatingTaskManagersMetricsHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
Collection<? extends MetricStore.ComponentMetricStore> getStores(MetricStore store, HandlerRequest<EmptyRequestBody, AggregateTaskManagerMetricsParameters> request) {
	List<ResourceID> taskmanagers = request.getQueryParameter(TaskManagersFilterQueryParameter.class);
	if (taskmanagers.isEmpty()) {
		return store.getTaskManagers().values();
	} else {
		Collection<MetricStore.TaskManagerMetricStore> taskmanagerStores = new ArrayList<>(taskmanagers.size());
		for (ResourceID taskmanager : taskmanagers) {
			MetricStore.TaskManagerMetricStore taskManagerMetricStore = store.getTaskManagerMetricStore(taskmanager.getResourceIdString());
			if (taskManagerMetricStore != null) {
				taskmanagerStores.add(taskManagerMetricStore);
			}
		}
		return taskmanagerStores;
	}
}
 
Example 3
Source File: TaskManagerDetailsHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
private static List<TaskManagerMetricsInfo.GarbageCollectorInfo> createGarbageCollectorInfo(MetricStore.TaskManagerMetricStore taskManagerMetricStore) {
	Preconditions.checkNotNull(taskManagerMetricStore);

	ArrayList<TaskManagerMetricsInfo.GarbageCollectorInfo> garbageCollectorInfos = new ArrayList<>(taskManagerMetricStore.garbageCollectorNames.size());

	for (String garbageCollectorName: taskManagerMetricStore.garbageCollectorNames) {
		final String count = taskManagerMetricStore.getMetric("Status.JVM.GarbageCollector." + garbageCollectorName + ".Count", null);
		final String time = taskManagerMetricStore.getMetric("Status.JVM.GarbageCollector." + garbageCollectorName + ".Time", null);

		if (count != null && time != null) {
			garbageCollectorInfos.add(
				new TaskManagerMetricsInfo.GarbageCollectorInfo(
					garbageCollectorName,
					Long.valueOf(count),
					Long.valueOf(time)));
		}
	}

	return garbageCollectorInfos;
}
 
Example 4
Source File: AggregatingTaskManagersMetricsHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
Collection<? extends MetricStore.ComponentMetricStore> getStores(MetricStore store, HandlerRequest<EmptyRequestBody, AggregateTaskManagerMetricsParameters> request) {
	List<ResourceID> taskmanagers = request.getQueryParameter(TaskManagersFilterQueryParameter.class);
	if (taskmanagers.isEmpty()) {
		return store.getTaskManagers().values();
	} else {
		Collection<MetricStore.TaskManagerMetricStore> taskmanagerStores = new ArrayList<>(taskmanagers.size());
		for (ResourceID taskmanager : taskmanagers) {
			MetricStore.TaskManagerMetricStore taskManagerMetricStore = store.getTaskManagerMetricStore(taskmanager.getResourceIdString());
			if (taskManagerMetricStore != null) {
				taskmanagerStores.add(taskManagerMetricStore);
			}
		}
		return taskmanagerStores;
	}
}
 
Example 5
Source File: TaskManagerDetailsHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
private static List<TaskManagerMetricsInfo.GarbageCollectorInfo> createGarbageCollectorInfo(MetricStore.TaskManagerMetricStore taskManagerMetricStore) {
	Preconditions.checkNotNull(taskManagerMetricStore);

	ArrayList<TaskManagerMetricsInfo.GarbageCollectorInfo> garbageCollectorInfos = new ArrayList<>(taskManagerMetricStore.garbageCollectorNames.size());

	for (String garbageCollectorName: taskManagerMetricStore.garbageCollectorNames) {
		final String count = taskManagerMetricStore.getMetric("Status.JVM.GarbageCollector." + garbageCollectorName + ".Count", null);
		final String time = taskManagerMetricStore.getMetric("Status.JVM.GarbageCollector." + garbageCollectorName + ".Time", null);

		if (count != null && time != null) {
			garbageCollectorInfos.add(
				new TaskManagerMetricsInfo.GarbageCollectorInfo(
					garbageCollectorName,
					Long.valueOf(count),
					Long.valueOf(time)));
		}
	}

	return garbageCollectorInfos;
}
 
Example 6
Source File: AggregatingTaskManagersMetricsHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
Collection<? extends MetricStore.ComponentMetricStore> getStores(MetricStore store, HandlerRequest<EmptyRequestBody, AggregateTaskManagerMetricsParameters> request) {
	List<ResourceID> taskmanagers = request.getQueryParameter(TaskManagersFilterQueryParameter.class);
	if (taskmanagers.isEmpty()) {
		return store.getTaskManagers().values();
	} else {
		Collection<MetricStore.TaskManagerMetricStore> taskmanagerStores = new ArrayList<>(taskmanagers.size());
		for (ResourceID taskmanager : taskmanagers) {
			MetricStore.TaskManagerMetricStore taskManagerMetricStore = store.getTaskManagerMetricStore(taskmanager.getResourceIdString());
			if (taskManagerMetricStore != null) {
				taskmanagerStores.add(taskManagerMetricStore);
			}
		}
		return taskmanagerStores;
	}
}
 
Example 7
Source File: TaskManagerDetailsHandler.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
private static TaskManagerMetricsInfo createTaskManagerMetricsInfo(MetricStore.TaskManagerMetricStore tmMetrics) {

		Preconditions.checkNotNull(tmMetrics);

		long heapUsed = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Heap.Used", "0"));
		long heapCommitted = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Heap.Committed", "0"));
		long heapTotal = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Heap.Max", "0"));

		long nonHeapUsed = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.NonHeap.Used", "0"));
		long nonHeapCommitted = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.NonHeap.Committed", "0"));
		long nonHeapTotal = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.NonHeap.Max", "0"));

		long directCount = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Direct.Count", "0"));
		long directUsed = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Direct.MemoryUsed", "0"));
		long directMax = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Direct.TotalCapacity", "0"));

		long mappedCount = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Mapped.Count", "0"));
		long mappedUsed = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Mapped.MemoryUsed", "0"));
		long mappedMax = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Mapped.TotalCapacity", "0"));

		long memorySegmentsAvailable = Long.valueOf(tmMetrics.getMetric("Status.Network.AvailableMemorySegments", "0"));
		long memorySegmentsTotal = Long.valueOf(tmMetrics.getMetric("Status.Network.TotalMemorySegments", "0"));

		final List<TaskManagerMetricsInfo.GarbageCollectorInfo> garbageCollectorInfo = createGarbageCollectorInfo(tmMetrics);

		return new TaskManagerMetricsInfo(
			heapUsed,
			heapCommitted,
			heapTotal,
			nonHeapUsed,
			nonHeapCommitted,
			nonHeapTotal,
			directCount,
			directUsed,
			directMax,
			mappedCount,
			mappedUsed,
			mappedMax,
			memorySegmentsAvailable,
			memorySegmentsTotal,
			garbageCollectorInfo);
	}
 
Example 8
Source File: TaskManagerDetailsHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
private static TaskManagerMetricsInfo createTaskManagerMetricsInfo(MetricStore.TaskManagerMetricStore tmMetrics) {

		Preconditions.checkNotNull(tmMetrics);

		long heapUsed = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Heap.Used", "0"));
		long heapCommitted = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Heap.Committed", "0"));
		long heapTotal = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Heap.Max", "0"));

		long nonHeapUsed = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.NonHeap.Used", "0"));
		long nonHeapCommitted = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.NonHeap.Committed", "0"));
		long nonHeapTotal = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.NonHeap.Max", "0"));

		long directCount = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Direct.Count", "0"));
		long directUsed = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Direct.MemoryUsed", "0"));
		long directMax = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Direct.TotalCapacity", "0"));

		long mappedCount = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Mapped.Count", "0"));
		long mappedUsed = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Mapped.MemoryUsed", "0"));
		long mappedMax = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Mapped.TotalCapacity", "0"));

		long memorySegmentsAvailable = Long.valueOf(tmMetrics.getMetric("Status.Network.AvailableMemorySegments", "0"));
		long memorySegmentsTotal = Long.valueOf(tmMetrics.getMetric("Status.Network.TotalMemorySegments", "0"));

		final List<TaskManagerMetricsInfo.GarbageCollectorInfo> garbageCollectorInfo = createGarbageCollectorInfo(tmMetrics);

		return new TaskManagerMetricsInfo(
			heapUsed,
			heapCommitted,
			heapTotal,
			nonHeapUsed,
			nonHeapCommitted,
			nonHeapTotal,
			directCount,
			directUsed,
			directMax,
			mappedCount,
			mappedUsed,
			mappedMax,
			memorySegmentsAvailable,
			memorySegmentsTotal,
			garbageCollectorInfo);
	}
 
Example 9
Source File: TaskManagerDetailsHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
private static TaskManagerMetricsInfo createTaskManagerMetricsInfo(MetricStore.TaskManagerMetricStore tmMetrics) {

		Preconditions.checkNotNull(tmMetrics);

		long heapUsed = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Heap.Used", "0"));
		long heapCommitted = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Heap.Committed", "0"));
		long heapTotal = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Heap.Max", "0"));

		long nonHeapUsed = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.NonHeap.Used", "0"));
		long nonHeapCommitted = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.NonHeap.Committed", "0"));
		long nonHeapTotal = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.NonHeap.Max", "0"));

		long directCount = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Direct.Count", "0"));
		long directUsed = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Direct.MemoryUsed", "0"));
		long directMax = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Direct.TotalCapacity", "0"));

		long mappedCount = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Mapped.Count", "0"));
		long mappedUsed = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Mapped.MemoryUsed", "0"));
		long mappedMax = Long.valueOf(tmMetrics.getMetric("Status.JVM.Memory.Mapped.TotalCapacity", "0"));

		long memorySegmentsAvailable = Long.valueOf(tmMetrics.getMetric("Status.Network.AvailableMemorySegments", "0"));
		long memorySegmentsTotal = Long.valueOf(tmMetrics.getMetric("Status.Network.TotalMemorySegments", "0"));

		final List<TaskManagerMetricsInfo.GarbageCollectorInfo> garbageCollectorInfo = createGarbageCollectorInfo(tmMetrics);

		return new TaskManagerMetricsInfo(
			heapUsed,
			heapCommitted,
			heapTotal,
			nonHeapUsed,
			nonHeapCommitted,
			nonHeapTotal,
			directCount,
			directUsed,
			directMax,
			mappedCount,
			mappedUsed,
			mappedMax,
			memorySegmentsAvailable,
			memorySegmentsTotal,
			garbageCollectorInfo);
	}