You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/09/05 14:11:20 UTC

[jira] [Commented] (FLINK-4389) Expose metrics to Webfrontend

    [ https://issues.apache.org/jira/browse/FLINK-4389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15465100#comment-15465100 ] 

ASF GitHub Bot commented on FLINK-4389:
---------------------------------------

Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2363#discussion_r77527444
  
    --- Diff: flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/metrics/MetricStore.java ---
    @@ -35,109 +46,111 @@
     	final Map<String, TaskManagerMetricStore> taskManagers = new HashMap<>();
     	final Map<String, JobMetricStore> jobs = new HashMap<>();
     
    -	/**
    -	 * Adds a metric to this MetricStore.
    -	 *
    -	 * @param name  the metric identifier
    -	 * @param value the metric value
    -	 */
    -	public void add(String name, Object value) {
    -		TaskManagerMetricStore tm;
    -		JobMetricStore job;
    -		TaskMetricStore task;
    -
    +	public void add(MetricDump metric) {
     		try {
    -			String[] components = name.split(":");
    -			switch (components[0]) {
    -				/**
    -				 * JobManagerMetricStore metric
    -				 * format: 0:<user_scope>.<name>
    -				 */
    -				case "0":
    -					jobManager.metrics.put(components[1], value);
    -					break;
    -				/**
    -				 * TaskManager metric
    -				 * format: 1:<tm_id>:<user_scope>.<name>
    -				 */
    -				case "1":
    -					if (components.length != 3) {
    -						break;
    -					}
    -					tm = taskManagers.get(components[1]);
    +			QueryScopeInfo info = metric.scopeInfo;
    +			TaskManagerMetricStore tm;
    +			JobMetricStore job;
    +			TaskMetricStore task;
    +
    +			String name = info.scope.isEmpty()
    +				? metric.name
    +				: info.scope + "." + metric.name;
    +			
    +			if (name.isEmpty()) { // malformed transmission
    +				return;
    +			}
    +
    +			switch (info.getCategory()) {
    +				case INFO_CATEGORY_JM:
    --- End diff --
    
    What's the benefit of having an explicit type field over using `instanceof`? I think encoding the type via the actual type has the advantage that you don't mix up classes with wrong category types.


> Expose metrics to Webfrontend
> -----------------------------
>
>                 Key: FLINK-4389
>                 URL: https://issues.apache.org/jira/browse/FLINK-4389
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Metrics, Webfrontend
>    Affects Versions: 1.1.0
>            Reporter: Chesnay Schepler
>            Assignee: Chesnay Schepler
>             Fix For: pre-apache
>
>
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-7%3A+Expose+metrics+to+WebInterface



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)