Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(newrelic): Display deploy information from multiple apps #472

Closed
wants to merge 2 commits into from

Conversation

ChrisDBrown
Copy link
Contributor

Closes #471

There's a breaking change here in the config options - applicationID becomes applicationIDs and expects an array instead of int.

Docs update for the changes here: wtfutil/wtfdocs#38

As mentioned on the original issue, I'm pretty green at golang so feedback is very welcome!

Copy link
Collaborator

@Seanstoppable Seanstoppable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good first pass! Reviewing the code, I think there are some performance issues that arise from migrating from the widget being designed with one in mind to supporting multiple instances. Minimally, I think the Refresh one needs addressing, and we can refactor some of the other parts iteratively.

import "github.com/gdamore/tcell"

func (widget *Widget) initializeKeyboardControls() {
widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help window")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you take a look at the JIRA module and add appropriate keyboard commands? r/j/k would be appreciated for consistency.

deployCount: ymlConfig.UInt("deployCount", 5),
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_NEW_RELIC_API_KEY")),
deployCount: ymlConfig.UInt("deployCount", 5),
applicationIDs: ymlConfig.UList("applicationIDs"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could keep applicationID for a non-breaking change. Either by appending it to applicationIDs, or doing something like the arrayifyProjects in the jira settings file

if appErr == nil {
appName = app.Name
for _, id := range wtf.ToInts(widget.settings.applicationIDs) {
widget.Clients = append(widget.Clients, NewClient(widget.settings.apiKey, id))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will create a new client that is calling the service each time, and this is probably not quite what you want. Say you had 3 applications, on the first refresh there would be 3, second would be 6, third would be 9..... eventually this will eat up a lot of resources.
It might make more sense to have the client accept applicationId as a parameter, and use that to iterate through requests and store the results in some struct, effectively caching the results. Otherwise, every time you change a page you will ALSO be making a web request to the newrelic API to get data, resulting in slower transitions. Minimally, I would create one set of clients up front, and Refresh will just call the display method

@senorprogrammer
Copy link
Collaborator

@ChrisDBrown If there's no feedback from you by Aug 4 on the comments in this PR I'll assume it's unmaintained and will close it out as such.

@Seanstoppable
Copy link
Collaborator

I'm happy to refactor some of this to address my comments, either as part of this PR, or opening a new one. This IS most of the way done it seems. Though I don't have a new relic account to test

@senorprogrammer
Copy link
Collaborator

Added via #607

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Allow multiple applications to be monitored in NewRelic
3 participants