Skip to content

nsqadmin: refactoring - #323

Merged
jehiah merged 18 commits into
nsqio:masterfrom
mreiferson:nsqadmin_importable_323
Aug 7, 2015
Merged

nsqadmin: refactoring#323
jehiah merged 18 commits into
nsqio:masterfrom
mreiferson:nsqadmin_importable_323

Conversation

@mreiferson

Copy link
Copy Markdown
Member

nsqadmin is a Go web app, which has some tradeoffs. It's great because it's dead simple to deploy. It's terrible because it's a PITA writing Go based web apps.

I think an ideal middle ground is:

  1. nsqadmin becomes a JSON API with convenience endpoints to query the cluster and aggregate data
  2. nsqadmin UI is a client-side app
  3. all the static assets for (2) are bundled into the binary so it's still easy to deploy (this is already the case, just stating the obvious)

Simultaneously, it could use a facelift, but this refactoring alone makes things much easier to extend and for others to contribute.

cc @visionmedia

@mreiferson

Copy link
Copy Markdown
Member Author

ping #322

@michaelhood

Copy link
Copy Markdown
Contributor

really like the client side UI approach. will be exciting to see what people create on it.

@tj

tj commented Apr 10, 2014

Copy link
Copy Markdown
Contributor

@mreiferson the "messages" count includes messages in-flight right? would you be interested in changing that to only messages that have been FIN'd? or maybe adding another

@mreiferson

Copy link
Copy Markdown
Member Author

@visionmedia there should be a separate counter for just FIN message count, the "regular" message count is specifically the # of PUB messages to that nsqd

@mreiferson

Copy link
Copy Markdown
Member Author

edit: s/should be/is

@mreiferson

Copy link
Copy Markdown
Member Author

edit again: I'm crazy, there isn't...

@mreiferson

Copy link
Copy Markdown
Member Author

I suppose it is derivable as message_count - in_flight_count (and optionally subtracting deferred_count and requeued_count if you wanted to exclude retried duplicates and count "unique" FIN)

@mreiferson

Copy link
Copy Markdown
Member Author

@visionmedia you starting to work on this?

@tj

tj commented Apr 10, 2014

Copy link
Copy Markdown
Contributor

nope just debugging some prod stuff ATM

@pkieltyka

Copy link
Copy Markdown

Great idea, what about having the admin endpoints on nsqd itself? .. and that way the client-side admin could be just some static html/js files, in the index.html just specify a jsonp endpoint to an nsqlookupd and done.

@mreiferson

Copy link
Copy Markdown
Member Author

@pkieltyka that's a little more difficult, in short, because that means all of the daemons are exposed to the internet. Technically nsqd and nsqlookupd already do have all the endpoints they need. nsqadmin really just aggregates and coordinates requests.

I think it still makes sense for nsqadmin to serve that role behind the client-side application (and to serve the initial static asset payload).

@pkieltyka

Copy link
Copy Markdown

That makes sense

@mreiferson
mreiferson force-pushed the nsqadmin_importable_323 branch 2 times, most recently from 03d926a to 7255221 Compare September 9, 2014 19:41
@mreiferson
mreiferson force-pushed the nsqadmin_importable_323 branch from e500795 to 6e9af9f Compare September 15, 2014 15:29
@allgeek

allgeek commented Oct 27, 2014

Copy link
Copy Markdown

Is there a timeline for getting this reviewed & landed in master? I'm looking into submitting a pull request for #347, and obviously there are a number of nsqadmin changes involved there. Is there something a new contributor could possibly help with here? (I noticed a Travis build failure on these commits, but haven't dug into it yet - don't want to step on any toes or duplicate efforts)

@mreiferson

Copy link
Copy Markdown
Member Author

Hi @allgeek - great to hear that you're interested in contributing, thanks!

I just need to finish up here, so this is on me. I've been distracted the past few weeks 😁

If you want to dig into this PR via code review, by all means that would be helpful - this way we're on the same page with the direction I'm taking things.

@mreiferson

Copy link
Copy Markdown
Member Author

I just remembered - if you are interested in helping out with this PR, I could use some help with the client side changes referenced in the OP.

@allgeek

allgeek commented Oct 28, 2014

Copy link
Copy Markdown

I'll try to catch you in the IRC channel at some point, although I've got meetings most of the day. Is there a particular JS framework or approach you had wanted to take with the new admin client page? I see the current site just uses jQuery and Bootstrap...

Comment thread nsqd/nsqd_test.go Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

seems like we could use a little helper for this dance we're doing here a thousand times?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

haha clearly i was just in brute force make-it-work mode. fixed

@mreiferson

Copy link
Copy Markdown
Member Author

cool, LGTM - let's land this ✈️

Want to try to squash 091eabc on?

@jehiah

jehiah commented Aug 6, 2015

Copy link
Copy Markdown
Member

Close. two things i found in validation

  1. Bugs getting per-nsqd rate on the topics page (this should be easy; i think it's from variable renames)
  2. some bugs on the Counter page (it's not working correctly for me). Not sure what's happening there yet.

@jehiah

jehiah commented Aug 6, 2015

Copy link
Copy Markdown
Member

I spoke too soon. A few more items:

  • It seems the default timeframe for graphite charts is defaulting to 'off' I expect that to default to 2h when it's not set via a cookie.
  • The 'attributes' section which should display TLS and auth state isn't displaying TLS details, or auth state. (see image below)

screen shot 2015-08-06 at 12 04 20 pm

@mreiferson

Copy link
Copy Markdown
Member Author

It seems the default timeframe for graphite charts is defaulting to 'off' I expect that to default to 2h when it's not set via a cookie.

I think it's now in local storage, should be easy to default it to 2h

@mreiferson

Copy link
Copy Markdown
Member Author

some bugs on the Counter page (it's not working correctly for me). Not sure what's happening there yet.

I didn't translate the JS 1:1 here, it's just broken or?

@jehiah

jehiah commented Aug 6, 2015

Copy link
Copy Markdown
Member

For the counter page, i'm getting Zero's back from the /api/counter endpoint, but also the graphite URLS have unexpected &amp instead of just &.

@jehiah

jehiah commented Aug 6, 2015

Copy link
Copy Markdown
Member

I think i fixed all the previously mentioned bugs (please take a look before i squash those); glyphicon fonts are not being embedded properly and i think that's the only outstanding thing left.

@mreiferson

Copy link
Copy Markdown
Member Author

For the counter page, i'm getting Zero's back from the /api/counter endpoint, but also the graphite URLS have unexpected &amp instead of just &.

Did you figure this out?

@jehiah

jehiah commented Aug 7, 2015

Copy link
Copy Markdown
Member

For the counter page, i'm getting Zero's back from the /api/counter endpoint, but also the graphite URLS have unexpected &amp instead of just &.

Did you figure this out?

Yes, it was broken handling of message_count also affecting the Message Count columns (i just didn't notice on my dev instance that it was always Zero). Fixed by f9cdd4f

@mreiferson

Copy link
Copy Markdown
Member Author

cool 🔨

@jehiah

jehiah commented Aug 7, 2015

Copy link
Copy Markdown
Member

@mreiferson font issues addressed; take a look at last two commits?

@mreiferson

Copy link
Copy Markdown
Member Author

@jehiah don't you think the console.log might be useful when people inevitably encounter bugs?

@mreiferson

Copy link
Copy Markdown
Member Author

also, do we need another HTTP route for the same handler? Is it because bootstrap expects them at that URL?

@jehiah

jehiah commented Aug 7, 2015

Copy link
Copy Markdown
Member

yeah, bootstrap requests them as fonts/.... and that felt like the easiest path to resolving since the gulp step currently flattens directories. I'd rather one line of Go to more gulp =)

I have "no console.log in production" burned into my brain since it's not present in all browsers and thus causes JS errors (Thanks IE 9!)

@mreiferson

Copy link
Copy Markdown
Member Author

very well, squash time?

@mreiferson

Copy link
Copy Markdown
Member Author

😱

@klucar

klucar commented Feb 5, 2016

Copy link
Copy Markdown

Has anyone started work on refactoring the UI for #443? We get i/o timeout errors when nsq is under heavy load. I'd like to get rid of this timeout, make it configurable or ?

I have experience with doing ReactJS interfaces and this is kind of a perfect use-case for it. If nobody is already working this, I'll give it a go.

@mreiferson

Copy link
Copy Markdown
Member Author

@klucar we made a bunch of improvements recently in #701 that should significantly improve this situation, if you're interested in deploying an alpha

@klucar

klucar commented Feb 5, 2016

Copy link
Copy Markdown

we're just evaluating if NSQ can work/scale for us, so I'll gladly give an alpha a shot :)

@klucar

klucar commented Feb 8, 2016

Copy link
Copy Markdown

@mreiferson any idea when a new release will be cut?

@mreiferson

Copy link
Copy Markdown
Member Author

@klucar I've been lazy, we should get one out (I've been running it in production without issue for a few weeks)

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants