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

Elek, Marton commented on HDDS-910:
-----------------------------------

Thanks [~bharatviswa] to explain it. I am not so familiar with the Ambari 
metrics but it's a little bit strange for me.

As I see in the MetricsSystemImpl.register a MetricsSourceBuilder is used to 
register the metrics POJO (OMMetrics in our case). It seems that the 
MetricsSourceBuilder creates the required MetricsSource for the POJO:

{code}
  public MetricsSource build() {
    if (source instanceof MetricsSource) {
      if (hasAtMetric && !hasRegistry) {
        throw new MetricsException("Hybrid metrics: registry required.");
      }
      return (MetricsSource) source;
    }
    else if (!hasAtMetric) {
      throw new MetricsException("No valid @Metric annotation found.");
    }
    return new MetricsSource() {
      @Override
      public void getMetrics(MetricsCollector builder, boolean all) {
        registry.snapshot(builder.addRecord(registry.info()), all);
      }
    };
  }
{code}

It's not clear why the MetricsSource should be implemented.

I also checked other metrics classes: CapacitySchedulerMetrics, 
BlockReaderLocalMetrics, DataNodeMetrics, ... They don't implement the 
MetricsSource interface (but my guess is that the Ambari Metric still read the 
values from them somehow).


> Expose OMMetrics
> ----------------
>
>                 Key: HDDS-910
>                 URL: https://issues.apache.org/jira/browse/HDDS-910
>             Project: Hadoop Distributed Data Store
>          Issue Type: Bug
>            Reporter: Bharat Viswanadham
>            Assignee: Bharat Viswanadham
>            Priority: Major
>         Attachments: HDDS-910.00.patch
>
>
> Implement MetricsSource interface, so that external metrics can collect the 
> OMMetrics.
>  
> From *MetricsSource.java:*
> It registers with \{@link MetricsSystem}, which periodically polls it to 
> collect \{@link MetricsRecord} and passes it to \{@link MetricsSink}.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to