[ 
https://issues.apache.org/jira/browse/AMBARI-24652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

amarnath reddy pappu updated AMBARI-24652:
------------------------------------------
    Description: 
*Steps to reproduce:
*
1. First generate metrics and post it to AMS.

curl --header "Content-Type: application/json" -X POST 
http://apappu3.hdp.com:6188/ws/v1/timeline/metrics --data @data1.json


{noformat}
{
  "metrics": [
    {
      "metricname": "AMBARI_METRICS.SmokeTest.FakeMetric",
      "appid": "AMS-TEST-APPID",
      "hostname": "ambari20-5",
      "timestamp": 1537211229000,
      "starttime": 1537211229000,
      "metrics": {
        "1537211229000": 0.963781711428,
        "1537211230000": 1432075898000
      }
    }
  ]
}
{noformat}

2. Now make REST api call to see if the data is present.

http://apappu3.hdp.com:3000/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=AMBARI_METRICS.SmokeTest.FakeMetric._avg&hostname=%&appId=AMS-TEST-APPID

This does not return any data - reason for this is , while writing it takes the 
appid as case sensitive but while reading always looks for lower case appid.

Workaround: change the appid from "AMS-TEST-APPID" to "ams-test-appid" (all 
lower case)- then GET REST API works fine.

  was:
Steps to reproduce:

1. First generate metrics and post it to AMS.

curl --header "Content-Type: application/json" -X POST 
http://apappu3.hdp.com:6188/ws/v1/timeline/metrics --data @data1.json


{noformat}
{
  "metrics": [
    {
      "metricname": "AMBARI_METRICS.SmokeTest.FakeMetric",
      "appid": "AMS-TEST-APPID",
      "hostname": "ambari20-5",
      "timestamp": 1537211229000,
      "starttime": 1537211229000,
      "metrics": {
        "1537211229000": 0.963781711428,
        "1537211230000": 1432075898000
      }
    }
  ]
}
{noformat}

2. Now make REST api call to see if the data is present.

http://apappu3.hdp.com:3000/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=AMBARI_METRICS.SmokeTest.FakeMetric._avg&hostname=%&appid=AMS-TEST-APPID

Note that app*i*d is lowercase "i" not appId

3. Now generate a new dashboard in grafana and then generate a Graph.

select the component name as "AMS-TEST-APPID" - here Grafana sends "appId" 
instead of "appid" and it does not get any data.

If we try to post REST API with appId (upper case I) call would fail.

So AMS should accept the REST calls with appId and then it may work with Grafana


> Grafana failed to show data for custom metrics
> ----------------------------------------------
>
>                 Key: AMBARI-24652
>                 URL: https://issues.apache.org/jira/browse/AMBARI-24652
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-server
>    Affects Versions: trunk, 2.6.2
>            Reporter: amarnath reddy pappu
>            Priority: Major
>
> *Steps to reproduce:
> *
> 1. First generate metrics and post it to AMS.
> curl --header "Content-Type: application/json" -X POST 
> http://apappu3.hdp.com:6188/ws/v1/timeline/metrics --data @data1.json
> {noformat}
> {
>   "metrics": [
>     {
>       "metricname": "AMBARI_METRICS.SmokeTest.FakeMetric",
>       "appid": "AMS-TEST-APPID",
>       "hostname": "ambari20-5",
>       "timestamp": 1537211229000,
>       "starttime": 1537211229000,
>       "metrics": {
>         "1537211229000": 0.963781711428,
>         "1537211230000": 1432075898000
>       }
>     }
>   ]
> }
> {noformat}
> 2. Now make REST api call to see if the data is present.
> http://apappu3.hdp.com:3000/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=AMBARI_METRICS.SmokeTest.FakeMetric._avg&hostname=%&appId=AMS-TEST-APPID
> This does not return any data - reason for this is , while writing it takes 
> the appid as case sensitive but while reading always looks for lower case 
> appid.
> Workaround: change the appid from "AMS-TEST-APPID" to "ams-test-appid" (all 
> lower case)- then GET REST API works fine.



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

Reply via email to