이것은 뉴렐릭 데이터 API (v2)를 사용하여 특정 기간에 대한 평균 오류율을 얻는 방법에 대한 예입니다. 이 값은 APM Summary 페이지 의 오류율 차트 위에 백분율로 표시됩니다.
중요 예제에서는 뉴렐릭의 REST API v2를 활용하지만, 지표 타임슬라이스 쿼리 실행에는 NRQL 함수를 사용하는 것이 좋습니다. 각 API 값은 동등한 NRQL 함수에 매핑될 수 있습니다. 이러한 API 예제를 기반으로 NRQL 쿼리를 만드는 방법을 알아보려면 설명서를 참조하세요.
API를 사용하려면 다음이 필요합니다.
평균 비율은 앱의 Summary 페이지 에 있는 Error rate 차트 위에 표시됩니다. 뉴렐릭은 다음 공식을 사용하여 계산합니다.
Application Error Rate = 100 * Errors/all:error_count / (HttpDispatcher:call_count + OtherTransaction/all:call_count)
API 명령 메트릭 타임슬라이스 값을 얻으려면 다음 세 가지 명령을 사용하십시오. 이 예에서는 각 명령에 대해 동일한 기간을 사용하며 모두 요약되어 있습니다.
얻기 위해서는 error count:
오류 수를 얻기 위해 호출 $ curl -X GET "https://api.newrelic.com/v2/applications/ $APP_ID /metrics/data.xml" \
> -H "Api-Key: $API_KEY " -i \
> -d 'names[]=Errors/all&values[]=error_count&from=2014-04-01T00:00:00+00:00&to=2014-04-01T23:35:00+00:00&summarize=true'
오류 카운트 호출의 출력 예 "from" : "2014-04-01T00:00:00+00:00" ,
"from" : "2014-04-01T00:35:00+00:00" ,
"to" : "2014-04-01T23:35:00+00:00" ,
"metrics_found" : [ "Errors/all" ] ,
"to" : "2014-04-01T23:35:00+00:00"
HttpDispatcher call count (웹 애플리케이션)을 얻으려면:
HttpDispatcher 호출 수를 얻기 위한 호출 $ curl -X GET "https://api.newrelic.com/v2/applications/ $APP_ID /metrics/data.xml" \
> -H "Api-Key: $API_KEY " -i \
> -d 'names[]=HttpDispatcher&values[]=call_count&from=2014-04-01T00:00:00+00:00&to=2014-04-01T23:35:00+00:00&summarize=true'
HttpDispatcher 호출 횟수 호출의 출력 예 "from" : "2014-04-01T00:00:00+00:00" ,
"name" : "HttpDispatcher" ,
"from" : "2014-04-01T00:35:00+00:00" ,
"to" : "2014-04-01T23:35:00+00:00" ,
"metrics_found" : [ "HttpDispatcher" ] ,
"to" : "2014-04-01T23:35:00+00:00"
OtherTransaction call count (웹 앱이 아닌 앱)을 가져오려면 다음을 수행하세요.
OtherTransaction 호출 수를 얻기 위한 호출 $ curl -X GET "https://api.newrelic.com/v2/applications/ $APP_ID /metrics/data.xml" \
> -H "Api-Key: $API_KEY " -i \
> -d 'names[]=OtherTransaction/all&values[]=call_count&from=2014-04-01T00:00:00+00:00&to=2014-04-01T23:35:00+00:00&summarize=true'
OtherTransaction 호출 횟수 호출의 출력 예 "from" : "2014-04-01T00:00:00+00:00" ,
"name" : "OtherTransaction/all" ,
"from" : "2014-04-01T00:35:00+00:00" ,
"to" : "2014-04-01T23:35:00+00:00" ,
"metrics_found" : [ "OtherTransaction/all" ] ,
"to" : "2014-04-01T23:35:00+00:00"