-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from ContaAzul/add-app-summary
Collect application summary data
- Loading branch information
Showing
4 changed files
with
86 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package newrelic | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
// Application represents a New Relic application. | ||
type Application struct { | ||
ID int64 `json:"id"` | ||
HealthStatus string `json:"health_status"` | ||
ApplicationSummary ApplicationSummary `json:"application_summary"` | ||
} | ||
|
||
type applicationResponse struct { | ||
Application Application `json:"application"` | ||
} | ||
|
||
// ShowApplication returns a single Application, identified by ID. The time range for | ||
// summary data is the last 3-4 minutes. | ||
func (c *Client) ShowApplication(applicationID int64) (Application, error) { | ||
var app Application | ||
path := fmt.Sprintf("v2/applications/%d.json", applicationID) | ||
req, err := c.newRequest("GET", path) | ||
if err != nil { | ||
return app, err | ||
} | ||
|
||
var response applicationResponse | ||
_, err = c.do(req, &response) | ||
return response.Application, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package newrelic | ||
|
||
// ApplicationSummary represents a rolling three-to-four-minute | ||
// average for application key values | ||
type ApplicationSummary struct { | ||
InstanceCount int `json:"instance_count"` | ||
ResponseTime float64 `json:"response_time"` | ||
Throughput float64 `json:"throughput"` | ||
ErrorRate float64 `json:"error_rate"` | ||
ApdexScore float64 `json:"apdex_score"` | ||
} |