newrelic_api 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,47 @@
1
+ 1.2.4
2
+
3
+ * Update docs to reflect that api.newrelic.com should be used instead of rpm.newrelic.com
4
+ * Update gemspec with new dependencies, remove active resource dependency
5
+ * Misc doc updates and fixes (thanks Wei Feng)
6
+ * Force XmlFormat for compatibility with ActiveResource 3.1 (thanks Jeff Gran)
7
+ * Update routes for metric name lookup
8
+ * Add documentation for instances API
9
+ * Add documentation for hosts API
10
+ * Add documentation for servers API
11
+
12
+ 1.2.3
13
+
14
+ * Fix XML compatibility
15
+
16
+ 1.2.2
17
+
18
+ * Add support for querying multiple applications in the data api
19
+ * Support for proxies (thanks to Wei Feng)
20
+
21
+ 1.2.1
22
+
23
+ * Updated for new product names
24
+ * Minor bugs and compatibility fixes
25
+
26
+ 1.2.0
27
+
28
+ * Added support for metric names and metric data API
29
+
30
+ 1.1.2
31
+
32
+ * Update deployments to support an app id # as well as app name
33
+ * Updated documentation
34
+
35
+ 1.1.1
36
+
37
+ * Fixes for Ruby 1.9.1 support
38
+
39
+ 1.1.0
40
+
41
+ * Remove support for license key authentication; using api_key
42
+
43
+ 1.0.0
44
+
45
+ * Initial versioning of the API
46
+ * Added tests pointing at integration.newrelic.com
47
+
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ group :development do
5
5
  gem "bundler", "~> 1.0.0"
6
6
  gem "jeweler", "~> 1.5.2"
7
7
  gem "rcov", ">= 0"
8
- gem 'shoulda', '~>2.10.3'
8
+ gem 'shoulda', '~>2.11.0'
9
9
  gem 'ci_reporter', '1.6.0'
10
10
  gem 'rdiscount'
11
11
  gem "rdoc", ">= 3.3"
@@ -40,17 +40,18 @@ GEM
40
40
  bundler (~> 1.0.0)
41
41
  git (>= 1.2.5)
42
42
  rake
43
+ json (1.6.1)
43
44
  little-plugger (1.1.2)
44
- logging (1.6.0)
45
+ logging (1.6.1)
45
46
  little-plugger (>= 1.1.2)
46
47
  mail (2.2.19)
47
48
  activesupport (>= 2.3.6)
48
49
  i18n (>= 0.4.0)
49
50
  mime-types (~> 1.16)
50
51
  treetop (~> 1.4.8)
51
- mime-types (1.16)
52
- polyglot (0.3.2)
53
- rack (1.2.3)
52
+ mime-types (1.18)
53
+ polyglot (0.3.3)
54
+ rack (1.2.5)
54
55
  rack-mount (0.6.14)
55
56
  rack (>= 1.0.0)
56
57
  rack-test (0.5.7)
@@ -68,16 +69,17 @@ GEM
68
69
  activesupport (= 3.0.7)
69
70
  rake (>= 0.8.7)
70
71
  thor (~> 0.14.4)
71
- rake (0.9.2)
72
- rcov (0.9.10)
72
+ rake (0.9.2.2)
73
+ rcov (0.9.11)
73
74
  rdiscount (1.6.8)
74
- rdoc (3.9.4)
75
- shoulda (2.10.3)
75
+ rdoc (3.11)
76
+ json (~> 1.4)
77
+ shoulda (2.11.3)
76
78
  thor (0.14.6)
77
79
  treetop (1.4.10)
78
80
  polyglot
79
81
  polyglot (>= 0.3.1)
80
- tzinfo (0.3.29)
82
+ tzinfo (0.3.33)
81
83
 
82
84
  PLATFORMS
83
85
  ruby
@@ -91,4 +93,4 @@ DEPENDENCIES
91
93
  rcov
92
94
  rdiscount
93
95
  rdoc (>= 3.3)
94
- shoulda (~> 2.10.3)
96
+ shoulda (~> 2.11.0)
@@ -23,6 +23,12 @@ x-api-key:: API key for account, used for authentication (required)
23
23
 
24
24
  NewRelicApi.api_key = '<api key>'
25
25
 
26
+ == Proxy Support
27
+
28
+ If you are behind a proxy:
29
+
30
+ NewRelicApi.proxy = 'http://localhost:3128'
31
+
26
32
  == ActiveResource API
27
33
 
28
34
  The New Relic ActiveResource-based API helper is NewRelicApi.
@@ -32,12 +38,12 @@ The remainder of this document will describe our XML API.
32
38
 
33
39
  == View applications
34
40
 
35
- URL:: <code>https://rpm.newrelic.com/accounts/:account_id/applications.xml</code>
41
+ URL:: <code>https://api.newrelic.com/accounts/:account_id/applications.xml</code>
36
42
  Method:: GET
37
43
  Restrictions:: None
38
44
  Active Resource Helper :: {NewRelicApi::Account}[link:NewRelicApi/Account.html]
39
45
 
40
- Replace <tt>:account_id</tt> with the your account number. You can see this in the browser URL when you log in to rpm.newrelic.com.
46
+ Replace <tt>:account_id</tt> with your account number. You can see this in the browser URL when you log in to api.newrelic.com.
41
47
 
42
48
  === Data Returned
43
49
 
@@ -48,12 +54,12 @@ Sample data:
48
54
  <application>
49
55
  <id type="integer">123</id>
50
56
  <name>My Application</name>
51
- <overview-url><a href="https://rpm.newrelic.com/browser/agent?account_id=1&agent=123%3C">https://rpm.newrelic.com/browser...</a>/overview-url>
57
+ <overview-url><a href="https://api.newrelic.com/browser/agent?account_id=1&agent=123%3C">https://api.newrelic.com/browser...</a>/overview-url>
52
58
  </application>
53
59
  <application>
54
60
  <id type="integer">124</id>
55
61
  <name>My Application2</name>
56
- <overview-url><a href="https://rpm.newrelic.com/browser/agent?account_id=1&agent=124%3C">https://rpm.newrelic.com/browser...</a>/overview-url>
62
+ <overview-url><a href="https://api.newrelic.com/browser/agent?account_id=1&agent=124%3C">https://api.newrelic.com/browser...</a>/overview-url>
57
63
  </application>
58
64
  </applications>
59
65
 
@@ -61,11 +67,149 @@ Sample data:
61
67
 
62
68
  * Invalid API Key (403)
63
69
 
70
+ == View servers
71
+
72
+ URL:: <code>https://api.newrelic.com/api/v1/accounts/:account_id/servers.xml</code>
73
+ Method:: GET
74
+ Restrictions:: None
75
+
76
+ Replace <tt>:account_id</tt> with your account number. You can see this in the browser URL when you log in to api.newrelic.com.
77
+
78
+ === Data Returned
79
+
80
+ Sample data:
81
+
82
+ <?xml version="1.0" encoding="UTF-8"?>
83
+ <servers type="array">
84
+ <server>
85
+ <overview-url>https://staging.newrelic.com/accounts/1/servers/555</overview-url>
86
+ <hostname>my-hostname.newrelic.com</hostname>
87
+ <id type="integer">555</id>
88
+ </server>
89
+ <server>
90
+ <overview-url>https://staging.newrelic.com/accounts/1/servers/556</overview-url>
91
+ <hostname>my-hostname-2.newrelic.com</hostname>
92
+ <id type="integer">556</id>
93
+ </server>
94
+ <server>
95
+
96
+ === Possible Error Conditions
97
+
98
+ * Invalid API Key (403)
99
+
100
+ == View hosts
101
+
102
+ This gives you the list of hosts, so you can look up application data filtered by host.
103
+
104
+ URL:: <code>https://api.newrelic.com/api/v1/accounts/:account_id/applications/:app_id/hosts.xml</code>
105
+ Method:: GET
106
+ Restrictions:: None
107
+
108
+ Replace <tt>:account_id</tt> with your account number, and <tt>:app_id</tt> with the application ID. You can see this in the browser URL when you log in to api.newrelic.com, or you can look up the applications using the API to view applications. JSON is also supported.
109
+
110
+ === Data Returned
111
+
112
+ Sample data:
113
+
114
+ <?xml version="1.0" encoding="UTF-8"?>
115
+ <hosts type="array">
116
+ <host>
117
+ <overview-url>https://staging.newrelic.com/accounts/1/applications/123_h3333</overview-url>
118
+ <name>App name (my-hostname.newrelic.com)</name>
119
+ <id>123_h3333</id>
120
+ </host>
121
+ </hosts>
122
+
123
+ === Possible Error Conditions
124
+
125
+ * Invalid API Key (403)
126
+
127
+
128
+ == View instances
129
+
130
+ This gives you the list of instances of your application, so you can look up application data filtered by instance.
131
+
132
+ URL:: <code>https://api.newrelic.com/api/v1/accounts/:account_id/applications/:app_id/instances.xml</code>
133
+ Method:: GET
134
+ Restrictions:: None
135
+
136
+ Replace <tt>:account_id</tt> with your account number, and <tt>:app_id</tt> with the application ID. You can see this in the browser URL when you log in to api.newrelic.com, or you can look up the applications using the API to view applications. JSON is also supported.
137
+
138
+ === Data Returned
139
+
140
+ Sample data:
141
+
142
+ <?xml version="1.0" encoding="UTF-8"?>
143
+ <instances type="array">
144
+ <instance>
145
+ <overview-url>https://staging.newrelic.com/accounts/1/applications/123/instances/1441_i7584</overview-url>
146
+ <name>App name (my-hostname.newrelic.com)</name>
147
+ <id>1441_i7584</id>
148
+ </instance>
149
+ </instances>
150
+
151
+ The overview URL may vary depending on the language of your application.
152
+
153
+ === Possible Error Conditions
154
+
155
+ * Invalid API Key (403)
156
+
157
+
158
+ == Delete applications
159
+ URL:: <code>https://api.newrelic.com/api/v1/accounts/:account_id/applications/delete.xml</code>
160
+ Method:: POST
161
+ Parameters:: app, a string representing the name of your application, or
162
+ app_id, an integer representing the id of your application
163
+ Replace <tt>:account_id</tt> with the your account number. You can see this in the browser URL when you log in to api.newrelic.com.
164
+
165
+ EXAMPLE 1 - Deleting an app via browser URL field
166
+ We want to delete the app called "dotNet qa3" which has the app_id of 11068.
167
+ The account # is 26286. The data_access_key is the API key for this account.
168
+
169
+ https://api.newrelic.com/api/v1/accounts/26286/applications/delete.xml?app_id[]=11068&data_access_key=4a249e3f3b437002efb6121844e0a4ee1d00942b18cfb9
170
+
171
+ Actual response via browser:
172
+
173
+ <applications type="array">
174
+ <application name="dotNet qa3" id="11068">
175
+ <result>deleted</result>
176
+ </application>
177
+ </applications>
178
+
179
+ EXAMPLE 2 - Deleting an app via Curl
180
+
181
+ curl -H "x-api-key:4a249e3f3b437002efb6121844e0a4ee1d00942b18cfb9" 'https://api.newrelic.com/api/v1/accounts/26286/applications/delete.xml?app_id=11253'
182
+
183
+ Actual response:
184
+
185
+ <?xml version="1.0" encoding="UTF-8"?>
186
+ <applications type="array">
187
+ <application name="test100" id="11253">
188
+ <result>deleted</result>
189
+ </application>
190
+ </applications>
191
+
192
+
193
+ === Data Returned
194
+
195
+ Sample data:
196
+
197
+ <?xml version="1.0" encoding="UTF-8"?>
198
+ <applications type="array">
199
+ <application name="MyApp" id="1234">
200
+ <result>deleted</result>
201
+ </application>
202
+ <application name="MyApp 2" id="2345">
203
+ <result>failed</result>
204
+ </application>
205
+ </record>
206
+ </applications>
207
+
64
208
  == Application Summary Metrics
65
209
 
66
210
  Fetch summary metrics and threshold values (traffic light information) for one application.
67
211
 
68
- URL:: <code>https://rpm.newrelic.com/accounts/:account_id/applications/:app_id/threshold_values.xml</code> Replace <tt>:account_id</tt> and <tt>:app_id</tt> with the account and application IDs.
212
+ URL:: <code>https://api.newrelic.com/accounts/:account_id/applications/:app_id/threshold_values.xml</code> Replace <tt>:account_id</tt> and <tt>:app_id</tt> with the account and application IDs.
69
213
  Method:: GET
70
214
  Restrictions:: This API should be called at most once per minute
71
215
  Active Resource Helper:: {NewRelicApi::Account}[link:NewRelicApi/Application.html]
@@ -96,7 +240,7 @@ Sample data:
96
240
 
97
241
  Fetch summary metrics and threshold values (traffic light information) for all applications.
98
242
 
99
- URL:: <code>https://rpm.newrelic.com/accounts.xml?include=application_health</code>
243
+ URL:: <code>https://api.newrelic.com/accounts.xml?include=application_health</code>
100
244
  Method:: GET
101
245
  Restrictions:: This API should be called at most once per minute
102
246
  Active Resource Helper:: {NewRelicApi::Account}[link:NewRelicApi/Application.html]
@@ -136,9 +280,9 @@ Sample data:
136
280
 
137
281
  == Dashboard HTML fragment (All applications)
138
282
 
139
- New Relic provides an HTML fragment of the {dashboard view}[https://rpm.newrelic.com] of RPM. CSS styles are included, and images linked absolutely, which enables callers to embed the response directly in their applications. Authentication is through setting the appropriate API key header as outlined above, or through the regular login cookie. When using the regular login cookie, the logged-in user's default account's applications will be shown.
283
+ New Relic provides an HTML fragment of the {dashboard view}[https://api.newrelic.com] of RPM. CSS styles are included, and images linked absolutely, which enables callers to embed the response directly in their applications. Authentication is through setting the appropriate API key header as outlined above, or through the regular login cookie. When using the regular login cookie, the logged-in user's default account's applications will be shown.
140
284
 
141
- URL:: <code>https://rpm.newrelic.com/application_dashboard</code>
285
+ URL:: <code>https://api.newrelic.com/application_dashboard</code>
142
286
  Method:: GET
143
287
  Restrictions:: This API should be called at most once per minute
144
288
  Active Resource Helper:: None available currently
@@ -157,7 +301,7 @@ Sample data:
157
301
  <thead>
158
302
  <tr>
159
303
  <th class="header">Application</th>
160
- <th title="Apdex Score is a industry-standard measurement of customer satisfaction. It is calculated essentially as weighted response time. The larger number is your Apdex Score, out of 1, and the smaller number is the threshold for an acceptable response time, in seconds." class="apdex">Apdex Score <a href="http://support.newrelic.com/faqs/general/apdex" target="_blank"><img alt="?" src="https://rpm.newrelic.com/images/v2/12x12/moreinfo.png?1285097852" style="border: 0px none;" /></a></th>
304
+ <th title="Apdex Score is a industry-standard measurement of customer satisfaction. It is calculated essentially as weighted response time. The larger number is your Apdex Score, out of 1, and the smaller number is the threshold for an acceptable response time, in seconds." class="apdex">Apdex Score <a href="http://support.newrelic.com/faqs/general/apdex" target="_blank"><img alt="?" src="https://api.newrelic.com/images/v2/12x12/moreinfo.png?1285097852" style="border: 0px none;" /></a></th>
161
305
  <th title="Response Time is the average time it took to generate a response to all requests.">Resp. Time</th>
162
306
  <th title="Errors is the percentage of your requests that received an error as a response.">Errors</th>
163
307
  <th title="Throughput is total number of requests processed by your application per minute." class="throughput last">Throughput<br>(change from <abbr title="24 hours ago">24h</abbr>/<abbr title="7 days ago">7d</abbr>)</th>
@@ -166,19 +310,19 @@ Sample data:
166
310
  <tbody class="application application_1">
167
311
  <tr class="application_tier data">
168
312
  <td class="agent">
169
- <img alt="Normal" src="https://rpm.newrelic.com/images/v2/16x16/light-green.png?1285097852" />
313
+ <img alt="Normal" src="https://api.newrelic.com/images/v2/16x16/light-green.png?1285097852" />
170
314
  <span class="name">
171
- <a href="https://rpm.newrelic.com/accounts/1/applications/1" class="application">RPM</a>
315
+ <a href="https://api.newrelic.com/accounts/1/applications/1" class="application">RPM</a>
172
316
  </span>
173
317
  <span class="status reporting">1 Host and 5 Instances</span>
174
318
  </td>
175
319
  <td class="data apdex">
176
- <a href="https://rpm.newrelic.com/accounts/1/applications/1/transactions#sort_by%3Dapdex">0.99<sub>0.025</sub></a>
320
+ <a href="https://api.newrelic.com/accounts/1/applications/1/transactions#sort_by%3Dapdex">0.99<sub>0.025</sub></a>
177
321
  </td>
178
- <td class="data"><a href="https://rpm.newrelic.com/accounts/1/applications/1/transactions">5.7 ms</a></td>
179
- <td class="data"><a href="https://rpm.newrelic.com/accounts/1/applications/1/traced_errors">0.00 %</a></td>
322
+ <td class="data"><a href="https://api.newrelic.com/accounts/1/applications/1/transactions">5.7 ms</a></td>
323
+ <td class="data"><a href="https://api.newrelic.com/accounts/1/applications/1/traced_errors">0.00 %</a></td>
180
324
  <td class="data throughput last">
181
- <a href="https://rpm.newrelic.com/accounts/1/applications/1/transactions#sort_by%3Dthroughput">92 rpm</a>
325
+ <a href="https://api.newrelic.com/accounts/1/applications/1/transactions#sort_by%3Dthroughput">92 rpm</a>
182
326
  <div class="throughput_history">
183
327
  <span class="yesterday" title="Throughput down 2% from 24 hours ago"><strong class="down ">-2%</strong></span>
184
328
  <span class="last_week" title="Throughput up 0% from 7 days ago"><strong class="up ">0%</strong></span>
@@ -233,7 +377,7 @@ Sample data:
233
377
 
234
378
  == Dashboard HTML fragment (One application)
235
379
 
236
- URL:: <code>https://rpm.newrelic.com/application_dashboard?application_id=:id</code> Replace <tt>:id</tt> with application ID.
380
+ URL:: <code>https://api.newrelic.com/application_dashboard?application_id=:id</code> Replace <tt>:id</tt> with application ID.
237
381
  Method:: GET
238
382
  Restrictions:: This API should be called at most once per minute
239
383
  Active Resource Helper:: None available currently
@@ -256,7 +400,7 @@ Sample data:
256
400
  <thead>
257
401
  <tr>
258
402
  <th class="header">Application</th>
259
- <th title="Apdex Score is a industry-standard measurement of customer satisfaction. It is calculated essentially as weighted response time. The larger number is your Apdex Score, out of 1, and the smaller number is the threshold for an acceptable response time, in seconds." class="apdex">Apdex Score <a href="http://support.newrelic.com/faqs/general/apdex" target="_blank"><img alt="?" src="https://rpm.newrelic.com/images/v2/12x12/moreinfo.png?1285097852" style="border: 0px none;" /></a></th>
403
+ <th title="Apdex Score is a industry-standard measurement of customer satisfaction. It is calculated essentially as weighted response time. The larger number is your Apdex Score, out of 1, and the smaller number is the threshold for an acceptable response time, in seconds." class="apdex">Apdex Score <a href="http://support.newrelic.com/faqs/general/apdex" target="_blank"><img alt="?" src="https://api.newrelic.com/images/v2/12x12/moreinfo.png?1285097852" style="border: 0px none;" /></a></th>
260
404
  <th title="Response Time is the average time it took to generate a response to all requests.">Resp. Time</th>
261
405
  <th title="Errors is the percentage of your requests that received an error as a response.">Errors</th>
262
406
  <th title="Throughput is total number of requests processed by your application per minute." class="throughput last">Throughput<br>(change from <abbr title="24 hours ago">24h</abbr>/<abbr title="7 days ago">7d</abbr>)</th>
@@ -265,19 +409,19 @@ Sample data:
265
409
  <tbody class="application application_1">
266
410
  <tr class="application_tier data">
267
411
  <td class="agent">
268
- <img alt="Normal" src="https://rpm.newrelic.com/images/v2/16x16/light-green.png?1285097852" />
412
+ <img alt="Normal" src="https://api.newrelic.com/images/v2/16x16/light-green.png?1285097852" />
269
413
  <span class="name">
270
- <a href="https://rpm.newrelic.com/accounts/1/applications/1" class="application">RPM</a>
414
+ <a href="https://api.newrelic.com/accounts/1/applications/1" class="application">RPM</a>
271
415
  </span>
272
416
  <span class="status reporting">1 Host and 5 Instances</span>
273
417
  </td>
274
418
  <td class="data apdex">
275
- <a href="https://rpm.newrelic.com/accounts/1/applications/1/transactions#sort_by%3Dapdex">0.99<sub>0.025</sub></a>
419
+ <a href="https://api.newrelic.com/accounts/1/applications/1/transactions#sort_by%3Dapdex">0.99<sub>0.025</sub></a>
276
420
  </td>
277
- <td class="data"><a href="https://rpm.newrelic.com/accounts/1/applications/1/transactions">5.7 ms</a></td>
278
- <td class="data"><a href="https://rpm.newrelic.com/accounts/1/applications/1/traced_errors">0.00 %</a></td>
421
+ <td class="data"><a href="https://api.newrelic.com/accounts/1/applications/1/transactions">5.7 ms</a></td>
422
+ <td class="data"><a href="https://api.newrelic.com/accounts/1/applications/1/traced_errors">0.00 %</a></td>
279
423
  <td class="data throughput last">
280
- <a href="https://rpm.newrelic.com/accounts/1/applications/1/transactions#sort_by%3Dthroughput">92 rpm</a>
424
+ <a href="https://api.newrelic.com/accounts/1/applications/1/transactions#sort_by%3Dthroughput">92 rpm</a>
281
425
  <div class="throughput_history">
282
426
  <span class="yesterday" title="Throughput down 2% from 24 hours ago"><strong class="down ">-2%</strong></span>
283
427
  <span class="last_week" title="Throughput up 0% from 7 days ago"><strong class="up ">0%</strong></span>
@@ -334,7 +478,7 @@ Sample data:
334
478
 
335
479
  Unlike other API requests, the deployments API will accept either a license key (in the +x-license-key+ header) or an API key (in the +x-api-key+ header). Furthermore, when using the license key, you do not need to enable the API in the account settings. This is the standard mechanism used by the agent to upload deployments from the built in capistrano recipes.
336
480
 
337
- URL:: <code>https://rpm.newrelic.com/deployments.xml</code>
481
+ URL:: <code>https://api.newrelic.com/deployments.xml</code>
338
482
  Method:: POST
339
483
  Active Resource Helper:: {NewRelicApi::Account}[link:NewRelicApi/Deployment.html]
340
484
 
@@ -356,26 +500,25 @@ The optional fields may be set to anything you wish, and are not validated. For
356
500
 
357
501
  Here's an example using <tt>curl</tt>:
358
502
 
359
- curl -H "x-api-key:YOUR_API_KEY_HERE" -d "deployment[app_name]=iMyFace.ly Production" https://rpm.newrelic.com/deployments.xml
503
+ curl -H "x-api-key:YOUR_API_KEY_HERE" -d "deployment[app_name]=iMyFace.ly Production" https://api.newrelic.com/deployments.xml
360
504
 
361
505
  If you were to specify the optional <tt>description</tt>, <tt>changelog</tt> and <tt>user</tt> fields, the command would look like this:
362
506
 
363
- curl -H "x-api-key:YOUR_API_KEY_HERE" -d "deployment[app_name]=iMyFace.ly Production" -d "deployment[description]=This deployment was sent using curl" -d "deployment[changelog]=many hands make light work" -d "deployment[user]=Joe User" https://rpm.newrelic.com/deployments.xml
507
+ curl -H "x-api-key:YOUR_API_KEY_HERE" -d "deployment[app_name]=iMyFace.ly Production" -d "deployment[description]=This deployment was sent using curl" -d "deployment[changelog]=many hands make light work" -d "deployment[user]=Joe User" https://api.newrelic.com/deployments.xml
364
508
 
365
509
  == Metric Names
366
510
 
367
511
  Fetches all metrics for an application, or allows you to use a regular expression to get a subset of the metrics. These metrics are used to retrieve metric values from the Metric Data API (below). Each metric is returned with a list of fields that are valid for that metric.
368
512
 
369
- URL:: <code>https://api.newrelic.com/api/v1/applications/:app_id/metrics.:format</code> Replace +:app_id+ and +:format+ with the application ID and for format use one of (+json+, +xml+, +csv+).
513
+ URL:: <code>https://api.newrelic.com/api/v1/agents/:agent_id/metrics.:format</code> Replace +:format+ with the one of (+json+, +xml+, +csv+). +:agent_id+ is either an application ID, server ID, host ID, or instance ID, from the APIs documented above.
370
514
  Method:: GET
371
515
  Restrictions:: This API should be called at most once per minute.
372
516
 
373
517
  For partner admins, you can use a slightly different URL to get metric names for your customers (requires partner permissions).
374
518
 
375
- URL:: <code>https://api.newrelic.com/api/v1/accounts/:account_id/applications/:app_id/metrics.:format</code> Replace +:account_id+ with the account ID of the customer, +:app_id+ with the application ID for the customer, and +:format+ with one of (+json+, +xml+, +csv+).
519
+ URL:: <code>https://api.newrelic.com/api/v1/accounts/:account_id/agents/:agent_id/metrics.:format</code> Replace +:account_id+ with the account ID of the customer, +:agent_id+ with the application, server, host, or instance ID for the customer, and +:format+ with one of (+json+, +xml+, +csv+).
376
520
  Method:: GET
377
- Restrictions:: This API should be called at most once per minute.
378
-
521
+ Restrictions:: This API should be called at most once per minute.
379
522
 
380
523
  === Request Parameters
381
524
 
@@ -388,7 +531,7 @@ Note: Metric names will only be returned to Pro customers.
388
531
 
389
532
  Sample requests:
390
533
 
391
- https://api.newrelic.com/api/v1/applications/APPLICATION_ID/metrics.xml?re=WebTransaction&limit=2
534
+ https://api.newrelic.com/api/v1/agents/:agent_id/metrics.xml?re=WebTransaction&limit=2
392
535
 
393
536
  Sample data:
394
537
 
@@ -465,20 +608,20 @@ Apdex metrics support a particular set of fields:
465
608
 
466
609
  Returns the data values for metrics collected by New Relic for your application. You can use this API to build your own view of almost any metric data tracked by New Relic.
467
610
 
468
- URL:: <code>https://api.newrelic.com/api/v1/accounts/:account_id/data.:format</code> Replace +:account_id+ and +:format+ with your New Relic account ID (found in the URL when you access New Relic), and for format use one of (+json+, +xml+, +csv+).
611
+ URL:: <code>https://api.newrelic.com/api/v1/accounts/:account_id/metrics/data.:format</code> Replace +:account_id+ and +:format+ with your New Relic account ID (found in the URL when you access New Relic), and for format use one of (+json+, +xml+, +csv+).
469
612
  Method:: GET
470
613
  Restrictions:: This API is rate-limited per minute, and the limit is subject to change at any point.
471
614
 
472
615
  For partner admins, you can use a slightly different URL to get metric data for your customers (requires partner permissions).
473
616
 
474
- URL:: <code>https://api.newrelic.com/api/v1/accounts/:account_id/applications/:app_id/data.:format</code> Replace +:account_id+ with the account ID of the customer, +:app_id+ with the application ID for the customer, and +:format+ with one of (+json+, +xml+, +csv+).
617
+ URL:: <code>https://api.newrelic.com/api/v1/accounts/:account_id/agents/:agent_id/data.:format</code> Replace +:account_id+ with the account ID of the customer, +:agent_id+ with the application, server, host, or instance ID for the customer, and +:format+ with one of (+json+, +xml+, +csv+).
475
618
  Method:: GET
476
619
  Restrictions:: This API is rate-limited per minute, and the limit is subject to change at any point.
477
620
 
478
621
 
479
622
  === Request Parameters
480
623
 
481
- * +app+ or +app_id+: Application name, or application ID, respectively. The application name must be an exact match. You can pass in an array of apps to query by specifying app[]=First&app[]=Second or app_id[]=1234&app_id[]=2345
624
+ * +app+ or +agent_id+: Application name, or agent ID, respectively. The application name must be an exact match. You can pass in an array of apps to query by specifying app[]=First&app[]=Second . The agent_id is either an ID for an application, an instance, a server, or a host. You can look each of these up using our API (see documentation above for "view applications", "view servers", "view hosts", "view instances"). You can query multiple agents at the same time, but they must all be of the same type: application, instance, server, or host. Examples: agent_id[]=1234&agent_id[]=2345 (for applications), agent_id[]=1441_i7584&agent_id[]=1441_i7588 (for instances), agent_id[]=123_h3333&agent_id[]=123_h3388 (for host filtered application data), agent_id[]=555&agent_id[]=556 (for server data)
482
625
  * +begin+: Begin time, in XML UTC format. For example: <tt>2011-04-20T15:47:00Z</tt> (note that the New Relic site graphs are NOT in UTC format, so when comparing results, be sure to convert)
483
626
  * +end+: End time, in XML UTC format. For example: <tt>2011-04-20T15:52:00Z</tt>
484
627
  * +metrics+: Included one or many times, this lists the metrics you are interested in. If you specify multiple metrics, the request parameter should look like <tt>metrics[]=foo&metrics[]=bar</tt> (append '[]' to the end of the name of the parameter). You can specify <tt>metrics[]</tt> even if there is a single metric.
@@ -491,7 +634,7 @@ Note: Metric data will only be returned to Pro customers.
491
634
 
492
635
  Sample time series request:
493
636
 
494
- https://api.newrelic.com/api/v1/accounts/ACCOUNT_ID/data.xml?begin=2011-04-20T15:47:19Z&end=2011-04-20T15:52:19Z&metrics[]=ActiveRecord/all&field=average_response_time&app=My%20Application
637
+ https://api.newrelic.com/api/v1/accounts/:account_id/metrics/data.xml?begin=2011-04-20T15:47:19Z&end=2011-04-20T15:52:19Z&metrics[]=ActiveRecord/all&field=average_response_time&app=My%20Application
495
638
 
496
639
  Sample time series data:
497
640
 
@@ -516,7 +659,7 @@ Sample time series data:
516
659
 
517
660
  Sample summary request:
518
661
 
519
- https://api.newrelic.com/api/v1/accounts/ACCOUNT_ID/data.xml?begin=2011-04-20T15:47:19Z&end=2011-04-20T15:52:19Z&metrics[]=ActiveRecord/all&field=average_response_time&app=My%20Application&summary=1
662
+ https://api.newrelic.com/api/v1/accounts/:account_id/metrics/data.xml?begin=2011-04-20T15:47:19Z&end=2011-04-20T15:52:19Z&metrics[]=ActiveRecord/all&field=average_response_time&app=My%20Application&summary=1
520
663
 
521
664
  Sample summary data:
522
665
 
@@ -535,5 +678,5 @@ Sample summary data:
535
678
 
536
679
  == Copyright
537
680
 
538
- Copyright (c) 2011 New Relic, Inc.
681
+ Copyright (c) 2012 New Relic, Inc.
539
682
 
data/Rakefile CHANGED
@@ -12,9 +12,11 @@ require 'jeweler'
12
12
  require 'rdiscount'
13
13
 
14
14
  require 'ci/reporter/rake/test_unit'
15
+ API_VERSION = File.read('CHANGELOG.md')[/^.*$/]
15
16
  TITLE = %Q{Documentation and helper code for the New Relic API}
16
- RDOC_FILES=['README*', 'CHANGELOG', 'sample*']
17
+ RDOC_FILES=Dir['README*', 'CHANGELOG*', 'sample*']
17
18
  Jeweler::Tasks.new do |gem|
19
+ gem.version = API_VERSION
18
20
  gem.name = "newrelic_api"
19
21
  gem.homepage = "http://www.github.com/newrelic/newrelic_api"
20
22
  gem.license = "MIT"
@@ -48,9 +50,9 @@ task :default => :test
48
50
 
49
51
  require 'rdoc/task'
50
52
  Rake::RDocTask.new do |rdoc|
51
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
53
  rdoc.rdoc_dir = 'rdoc'
53
54
  rdoc.title = TITLE
55
+ # I don't know why, but the next line has no effect
54
56
  rdoc.rdoc_files.include(*RDOC_FILES)
55
57
  rdoc.rdoc_files.include('lib/**/*.rb')
56
58
  rdoc.main = "README.rdoc"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.3
1
+ 1.2.4
@@ -1,3 +1,4 @@
1
+ require 'active_resource'
1
2
  require 'active_resource_associations'
2
3
 
3
4
  # = New Relic REST API
@@ -74,6 +75,7 @@ module NewRelicApi
74
75
  NewRelicApi.proxy
75
76
  end
76
77
  end
78
+ self.format = ActiveResource::Formats::XmlFormat
77
79
  self.site = self.site_url
78
80
  self.proxy = self.proxy
79
81
  end
@@ -0,0 +1 @@
1
+ require 'new_relic_api'
@@ -4,21 +4,20 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{newrelic_api}
8
- s.version = "1.2.1"
7
+ s.name = "newrelic_api"
8
+ s.version = "1.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["New Relic"]
12
- s.date = %q{2011-09-07}
13
- s.description = %q{Use this gem to access New Relic application information via a REST api}
14
- s.email = %q{support@newrelic.com}
12
+ s.date = "2012-05-24"
13
+ s.description = "Use this gem to access New Relic application information via a REST api"
14
+ s.email = "support@newrelic.com"
15
15
  s.extra_rdoc_files = [
16
- "CHANGELOG",
16
+ "CHANGELOG.md",
17
17
  "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
- ".project",
21
- "CHANGELOG",
20
+ "CHANGELOG.md",
22
21
  "Gemfile",
23
22
  "Gemfile.lock",
24
23
  "LICENSE.txt",
@@ -27,16 +26,17 @@ Gem::Specification.new do |s|
27
26
  "VERSION",
28
27
  "lib/active_resource_associations.rb",
29
28
  "lib/new_relic_api.rb",
29
+ "lib/newrelic_api.rb",
30
30
  "newrelic_api.gemspec",
31
31
  "test/integration/newrelic_api_test.rb",
32
32
  "test/test_helper.rb"
33
33
  ]
34
- s.homepage = %q{http://www.github.com/newrelic/newrelic_api}
34
+ s.homepage = "http://www.github.com/newrelic/newrelic_api"
35
35
  s.licenses = ["MIT"]
36
36
  s.rdoc_options = ["--line-numbers", "--title", "Documentation and helper code for the New Relic API", "-m", "README.rdoc"]
37
37
  s.require_paths = ["lib"]
38
- s.rubygems_version = %q{1.6.2}
39
- s.summary = %q{Documentation and helper code for the New Relic API}
38
+ s.rubygems_version = "1.8.24"
39
+ s.summary = "Documentation and helper code for the New Relic API"
40
40
  s.test_files = [
41
41
  "test/integration/newrelic_api_test.rb",
42
42
  "test/test_helper.rb"
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
50
50
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
51
51
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
52
52
  s.add_development_dependency(%q<rcov>, [">= 0"])
53
- s.add_development_dependency(%q<shoulda>, ["~> 2.10.3"])
53
+ s.add_development_dependency(%q<shoulda>, ["~> 2.11.0"])
54
54
  s.add_development_dependency(%q<ci_reporter>, ["= 1.6.0"])
55
55
  s.add_development_dependency(%q<rdiscount>, [">= 0"])
56
56
  s.add_development_dependency(%q<rdoc>, [">= 3.3"])
@@ -60,7 +60,7 @@ Gem::Specification.new do |s|
60
60
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
61
61
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
62
62
  s.add_dependency(%q<rcov>, [">= 0"])
63
- s.add_dependency(%q<shoulda>, ["~> 2.10.3"])
63
+ s.add_dependency(%q<shoulda>, ["~> 2.11.0"])
64
64
  s.add_dependency(%q<ci_reporter>, ["= 1.6.0"])
65
65
  s.add_dependency(%q<rdiscount>, [">= 0"])
66
66
  s.add_dependency(%q<rdoc>, [">= 3.3"])
@@ -71,7 +71,7 @@ Gem::Specification.new do |s|
71
71
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
72
72
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
73
73
  s.add_dependency(%q<rcov>, [">= 0"])
74
- s.add_dependency(%q<shoulda>, ["~> 2.10.3"])
74
+ s.add_dependency(%q<shoulda>, ["~> 2.11.0"])
75
75
  s.add_dependency(%q<ci_reporter>, ["= 1.6.0"])
76
76
  s.add_dependency(%q<rdiscount>, [">= 0"])
77
77
  s.add_dependency(%q<rdoc>, [">= 3.3"])
@@ -51,8 +51,7 @@ class NewrelicApiTest < ActiveSupport::TestCase
51
51
  check_applications(apps)
52
52
  ui_app = apps.first
53
53
 
54
- # Unfortunately, if you ask for a non-existent app, you get a redirect right now.
55
- assert_raises ActiveResource::Redirection do
54
+ assert_raises ActiveResource::ResourceNotFound do
56
55
  account.applications(9999)
57
56
  end
58
57
 
@@ -23,6 +23,7 @@ require 'shoulda'
23
23
  require 'logging'
24
24
 
25
25
  $LOAD_PATH << File.expand_path("../../lib", __FILE__)
26
+ Dir.mkdir "log" unless File.directory? "log"
26
27
  ActiveResource::Base.logger = Logger.new(File.expand_path('../../log/test.log', __FILE__))
27
28
  ActiveResource::Base.logger.level = Logger::DEBUG
28
29
  class ActiveSupport::TestCase
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease: false
4
+ hash: 23
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 3
10
- version: 1.2.3
9
+ - 4
10
+ version: 1.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - New Relic
@@ -15,13 +15,9 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-07 00:00:00 -07:00
19
- default_executable:
18
+ date: 2012-05-24 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- prerelease: false
23
- type: :development
24
- name: rails
25
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
26
22
  none: false
27
23
  requirements:
@@ -34,10 +30,10 @@ dependencies:
34
30
  - 7
35
31
  version: 3.0.7
36
32
  requirement: *id001
37
- - !ruby/object:Gem::Dependency
38
33
  prerelease: false
34
+ name: rails
39
35
  type: :development
40
- name: bundler
36
+ - !ruby/object:Gem::Dependency
41
37
  version_requirements: &id002 !ruby/object:Gem::Requirement
42
38
  none: false
43
39
  requirements:
@@ -50,10 +46,10 @@ dependencies:
50
46
  - 0
51
47
  version: 1.0.0
52
48
  requirement: *id002
53
- - !ruby/object:Gem::Dependency
54
49
  prerelease: false
50
+ name: bundler
55
51
  type: :development
56
- name: jeweler
52
+ - !ruby/object:Gem::Dependency
57
53
  version_requirements: &id003 !ruby/object:Gem::Requirement
58
54
  none: false
59
55
  requirements:
@@ -66,10 +62,10 @@ dependencies:
66
62
  - 2
67
63
  version: 1.5.2
68
64
  requirement: *id003
69
- - !ruby/object:Gem::Dependency
70
65
  prerelease: false
66
+ name: jeweler
71
67
  type: :development
72
- name: rcov
68
+ - !ruby/object:Gem::Dependency
73
69
  version_requirements: &id004 !ruby/object:Gem::Requirement
74
70
  none: false
75
71
  requirements:
@@ -80,26 +76,26 @@ dependencies:
80
76
  - 0
81
77
  version: "0"
82
78
  requirement: *id004
83
- - !ruby/object:Gem::Dependency
84
79
  prerelease: false
80
+ name: rcov
85
81
  type: :development
86
- name: shoulda
82
+ - !ruby/object:Gem::Dependency
87
83
  version_requirements: &id005 !ruby/object:Gem::Requirement
88
84
  none: false
89
85
  requirements:
90
86
  - - ~>
91
87
  - !ruby/object:Gem::Version
92
- hash: 33
88
+ hash: 35
93
89
  segments:
94
90
  - 2
95
- - 10
96
- - 3
97
- version: 2.10.3
91
+ - 11
92
+ - 0
93
+ version: 2.11.0
98
94
  requirement: *id005
99
- - !ruby/object:Gem::Dependency
100
95
  prerelease: false
96
+ name: shoulda
101
97
  type: :development
102
- name: ci_reporter
98
+ - !ruby/object:Gem::Dependency
103
99
  version_requirements: &id006 !ruby/object:Gem::Requirement
104
100
  none: false
105
101
  requirements:
@@ -112,10 +108,10 @@ dependencies:
112
108
  - 0
113
109
  version: 1.6.0
114
110
  requirement: *id006
115
- - !ruby/object:Gem::Dependency
116
111
  prerelease: false
112
+ name: ci_reporter
117
113
  type: :development
118
- name: rdiscount
114
+ - !ruby/object:Gem::Dependency
119
115
  version_requirements: &id007 !ruby/object:Gem::Requirement
120
116
  none: false
121
117
  requirements:
@@ -126,10 +122,10 @@ dependencies:
126
122
  - 0
127
123
  version: "0"
128
124
  requirement: *id007
129
- - !ruby/object:Gem::Dependency
130
125
  prerelease: false
126
+ name: rdiscount
131
127
  type: :development
132
- name: rdoc
128
+ - !ruby/object:Gem::Dependency
133
129
  version_requirements: &id008 !ruby/object:Gem::Requirement
134
130
  none: false
135
131
  requirements:
@@ -141,10 +137,10 @@ dependencies:
141
137
  - 3
142
138
  version: "3.3"
143
139
  requirement: *id008
144
- - !ruby/object:Gem::Dependency
145
140
  prerelease: false
141
+ name: rdoc
146
142
  type: :development
147
- name: logging
143
+ - !ruby/object:Gem::Dependency
148
144
  version_requirements: &id009 !ruby/object:Gem::Requirement
149
145
  none: false
150
146
  requirements:
@@ -155,6 +151,9 @@ dependencies:
155
151
  - 0
156
152
  version: "0"
157
153
  requirement: *id009
154
+ prerelease: false
155
+ name: logging
156
+ type: :development
158
157
  description: Use this gem to access New Relic application information via a REST api
159
158
  email: support@newrelic.com
160
159
  executables: []
@@ -162,11 +161,10 @@ executables: []
162
161
  extensions: []
163
162
 
164
163
  extra_rdoc_files:
165
- - CHANGELOG
164
+ - CHANGELOG.md
166
165
  - README.rdoc
167
166
  files:
168
- - .project
169
- - CHANGELOG
167
+ - CHANGELOG.md
170
168
  - Gemfile
171
169
  - Gemfile.lock
172
170
  - LICENSE.txt
@@ -175,10 +173,10 @@ files:
175
173
  - VERSION
176
174
  - lib/active_resource_associations.rb
177
175
  - lib/new_relic_api.rb
176
+ - lib/newrelic_api.rb
178
177
  - newrelic_api.gemspec
179
178
  - test/integration/newrelic_api_test.rb
180
179
  - test/test_helper.rb
181
- has_rdoc: true
182
180
  homepage: http://www.github.com/newrelic/newrelic_api
183
181
  licenses:
184
182
  - MIT
@@ -212,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
210
  requirements: []
213
211
 
214
212
  rubyforge_project:
215
- rubygems_version: 1.3.7
213
+ rubygems_version: 1.8.24
216
214
  signing_key:
217
215
  specification_version: 3
218
216
  summary: Documentation and helper code for the New Relic API
data/.project DELETED
@@ -1,17 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <projectDescription>
3
- <name>API Gem</name>
4
- <comment></comment>
5
- <projects>
6
- </projects>
7
- <buildSpec>
8
- <buildCommand>
9
- <name>org.rubypeople.rdt.core.rubybuilder</name>
10
- <arguments>
11
- </arguments>
12
- </buildCommand>
13
- </buildSpec>
14
- <natures>
15
- <nature>org.rubypeople.rdt.core.rubynature</nature>
16
- </natures>
17
- </projectDescription>
data/CHANGELOG DELETED
@@ -1,20 +0,0 @@
1
- 1.0.0
2
- - Initial versioning of the API
3
- - Added tests pointing at integration.newrelic.com
4
- 1.1.0
5
- - Remove support for license key authentication; using api_key
6
- 1.1.1
7
- - Fixes for Ruby 1.9.1 support
8
- 1.1.2
9
- - Update deployments to support an app id # as well as app name
10
- - Updated documentation
11
- 1.2.0
12
- - Added support for metric names and metric data API
13
- 1.2.1
14
- - Updated for new product names
15
- - Minor bugs and compatibility fixes
16
- 1.2.2
17
- - Add support for querying multiple applications in the data api
18
- - Support for proxies (thanks to Wei Feng)
19
- 1.2.3
20
- - Fix XML compatibility