Mohammad Arshad created AMBARI-25998:
----------------------------------------

             Summary: Host uuid is not getting synced to other collectors, 
causing NPE while accessing metric
                 Key: AMBARI-25998
                 URL: https://issues.apache.org/jira/browse/AMBARI-25998
             Project: Ambari
          Issue Type: Bug
          Components: ambari-metrics
    Affects Versions: metrics-3.0.0
            Reporter: Mohammad Arshad
            Assignee: Mohammad Arshad


Host uuid is not getting synced with other collectors, causing NPE while 
accessing metric
{code:java}
java.lang.NullPointerException
        at 
org.apache.ambari.metrics.core.timeline.PhoenixHBaseAccessor.getLastTimelineMetricFromResultSet(PhoenixHBaseAccessor.java:457)
        at 
org.apache.ambari.metrics.core.timeline.PhoenixHBaseAccessor.getLatestMetricRecords(PhoenixHBaseAccessor.java:1150)
        at 
org.apache.ambari.metrics.core.timeline.PhoenixHBaseAccessor.getMetricRecords(PhoenixHBaseAccessor.java:966)
        at 
org.apache.ambari.metrics.core.timeline.HBaseTimelineMetricsService.getTimelineMetrics(HBaseTimelineMetricsService.java:294)
        at 
org.apache.ambari.metrics.webapp.TimelineWebServices.getTimelineMetrics(TimelineWebServices.java:267)
{code}

*Steps to reproduce the issue*

1. Push below metrics through collector-1
{noformat}
{
  "metrics": [
    {
      "metricname": "cpu1",
      "appid": "app1",
      "hostname": "host1",
      "starttime": 1693294119309,
      "metrics": {
        "1693294119309": 100,
        "1693294129309": 200
      }
    }
  ]
}
{noformat}

After metadata sync interval elapsed, performed following operations
2. GET http://COLLECTOR-1-HOST:6188/ws/v1/timeline/metrics/hosts returned
{noformat}
{
    "host1": [
        "app1"
    ],
...
}
{noformat}

3. GET http://COLLECTOR-2-HOST:6188/ws/v1/timeline/metrics/hosts returned
{
"host1": [
    "app1"
],
...
}

4. GET 
http://COLLECTOR-1-HOST:6188/ws/v1/timeline/metrics?metricNames=cpu1&appId=app1&hostname=host1
 returned
{
"metrics": [
    {
        "metricname": "cpu1",
        "appid": "app1",
        "hostname": "host1",
        "timestamp": 0,
        "starttime": 1693294119309,
        "metrics": {
            "1693294129309": 200.0
        },
        "metadata": {}
    }
]
}

5. GET 
http://COLLECTOR-2-HOST:6188/ws/v1/timeline/metrics?metricNames=cpu1&appId=app1&hostname=host1
 returned 
{noformat}
{
    "exception": "NullPointerException",
    "javaClassName": "java.lang.NullPointerException"
}
{noformat}

When host name is being synced, host id also should be synced to fix this issue.
Similar to this issue another issue 
https://issues.apache.org/jira/browse/AMBARI-25963 was raised, but that NPE was 
because metrics uuid was not synced, this issue is because of host uuid is not 
synced.
















--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to