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

Bibin A Chundatt commented on YARN-9615:
----------------------------------------

Thank you [~jhung] adding the poc 

* We could go for a generic approach for each type  of event  types

{code}
public class GenericEventTypeMetrics<T extends Enum<T>>
    implements EventTypeMetrics<T> {

  private final EnumMap<T, MutableGaugeLong> metrics;
  private final MetricsRegistry registry;
  private final MetricsSystem ms;
  private final MetricsInfo info;
  private final Class<T> enumClass;

  public GenericEventTypeMetrics(MetricsInfo info, MetricsSystem ms,
                                 T[] enums, Class<T> enumClass) {

    this.enumClass = enumClass;
    this.metrics = new EnumMap<>(this.enumClass);
    this.ms = ms;
    this.info = info;
    this.registry = new MetricsRegistry(this.info);


    //Initialze enum
    for (T type : enums) {
      String metricsName = type.toString().toLowerCase() + "_" + 
info.description();
      metrics.put(type, this.registry.newGauge(metricsName, metricsName, 0L));
    }
  }

  }
{code}

*Interface*

{code}
public interface EventTypeMetrics<T extends Enum<T>>
        extends MetricsSource {

    public void incr(T type);

    public void decr(T type);

    public long get(T type);

    public EventTypeMetrics register();

    public void unregister();

}
{code}

*Initialize each type of metrics using*

{code}
      this.appEventTypeMetrics =
          new GenericEventTypeMetrics.EventTypeMetricsBuilder<RMAppEventType>()
              .setMetricsInfo(RMAPPEEVENTTYPE_RECORD_INFO).setMetricsSystem(ms)
              .setEnumVals(RMAppEventType.values())
              .setEnumClass(RMAppEventType.class).build();
{code}


* Then above design avoid creating individual class for each type of events
* Add event metrics manager which creates the eventtypemetrics instance based 
on configuration to enable dispatcher metrics 
* Incase event type metrics conf is not enabled assign with 
{{DisableEventTypeMetrics}} implementing  {{EventTypeMetrics}} which does 
nothing.



> Add dispatcher metrics to RM
> ----------------------------
>
>                 Key: YARN-9615
>                 URL: https://issues.apache.org/jira/browse/YARN-9615
>             Project: Hadoop YARN
>          Issue Type: Task
>            Reporter: Jonathan Hung
>            Assignee: Jonathan Hung
>            Priority: Major
>         Attachments: YARN-9615.poc.patch, screenshot-1.png
>
>
> It'd be good to have counts/processing times for each event type in RM async 
> dispatcher and scheduler async dispatcher.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to