Skip to content

Web UI needs a way to find out which server it's connected to #2979

Closed

Description

@timmaxw

The web UI needs a way to find out which server it is connected to. Here are some options:

  • Bring back /ajax/me
  • Infer which server we're connected to by looking at IP addresses and ports (which would be provided in rethinkdb.server_status)
  • Add a method or field on the ReQL connection object
  • Put it in a pseudo-table somewhere

Activity

  1. added this to the milestone on Aug 28, 2014
  2. Tryneus commented on Aug 28, 2014

    @Tryneus
    Member

    Bring back /ajax/me

    This would be weird if it's the only thing provided on /ajax.

    Infer which server we're connected to by looking at IP addresses and ports (which would be provided in rethinkdb.server_status)

    This would be extremely tricky or unreliable due to strange network setups.

    What if we just made the current server be the first returned object in server_status?

  3. timmaxw commented on Aug 28, 2014

    @timmaxw
    MemberAuthor

    What if we just made the current server be the first returned object in server_status?

    That seems fragile.

    I think that the most elegant ideal long-term solution is to make it a method or field on the ReQL connection object. If we don't want to go to the trouble of implementing that for this release, I think that /ajax/me would make a good stop-gap measure.

  4. coffeemug commented on Aug 28, 2014

    @coffeemug
    Contributor
    • Bring back /ajax/me
    • Infer which server we're connected to by looking at IP addresses and ports (which would be provided in rethinkdb.server_status)
    • Put it in a pseudo-table somewhere
    • Make the current server be the first returned object in server_status?

    I don't like any of these options. I think we can do better.

    • Add a method or field on the ReQL connection object

    I think this would work great. The server would send its UUID to the connection during the handshake. Then the user could say conn.server() and get back that UUID. They could then query the server pseudotable to learn which server they're on, its status, etc. 👍

  5. coffeemug commented on Aug 28, 2014

    @coffeemug
    Contributor

    Another option is r.whoami(), but I like that less than conn.server().

  6. timmaxw commented on Aug 28, 2014

    @timmaxw
    MemberAuthor
    • I would call it conn.server_uuid() to make it clear it returns a UUID. We might eventually implement something called conn.server() which returns a name.
    • If we're connected to a proxy, it won't have a machine ID (I think). I guess we could return the string "proxy".
    • Will this interact badly with connection pooling?
  7. neumino commented on Aug 29, 2014

    @neumino
    Member

    If conn.server() could return all the information of the server it would be nicer. That would prevent me from doing two HTTP queries just to get the name of the server.

  8. coffeemug commented on Aug 29, 2014

    @coffeemug
    Contributor

    A few things:

    • @neumino -- you wouldn't have to make two calls. The server's uuid would be transmitted to the driver during the connection handshake, and would be stored on the connection for its full lifetime. You'd then only have to query the cluster for the information on the machine. We can't return full machine info and cache it on the connection because server information might change, so it's necessary to do a call any time you want up-to-date information anyway.
    • I think we should call the command conn.server_id(), not server_uuid. Also, we should rename uuid to id in all system tables. It's easier to type, people already understand the notion of ids, and the name is strictly better from the UX perspective.
    • The whole proxy thing was a bad idea and we should remove it entirely. It's poorly documented (if at all), and most users don't know about it. I'd be surprised if there were more than a few people using it at all. It's a clunky idea and a bad design that will be replaced with Explore a connection pool API in client drivers #281, so we should just drop this functionality and not worry about it.
  9. neumino commented on Aug 30, 2014

    @neumino
    Member
    • Sending the server id everytime we open a connection seems like a bad idea. It's extra traffic for something not useful in 99% of the cases
    • Having id instead of uuid would make things easier to integrate with Backbone (web ui stuff)
    • Why don't we just have conn.server() that returns the name of the server? Isn't conn.server something only for the web ui? We can return {id: ..., name: ...} if we expect people from using it.
  10. coffeemug commented on Sep 3, 2014

    @coffeemug
    Contributor

    Sending the server id everytime we open a connection seems like a bad idea.

    That sounds reasonable, though it's debatable if this would actually cause any performance issues. The difference between sending 1 byte and 16 bytes is possibly negligible.

    Why don't we just have conn.server() that returns the name of the server?

    It's a little weird to do it on a connection because we don't have any other cases where you get information from the server that way (in all other cases, you call a reql command via .run()). This might be different because it's a unique case. Marking this as reql proposal -- I think this issue is worth discussing as one because it will set a precedent for other similar commands/methods in the future.

  11. Tryneus commented on Oct 22, 2014

    @Tryneus
    Member

    For the sake of getting the release out the door quickly, we should probably do whatever's easiest, which is either leaving /ajax/me the way it is, or adding an undocumented field in a hidden pseudo-table somewhere.

  12. danielmewes commented on Oct 22, 2014

    @danielmewes
    Member

    Out of those two I like the /ajax/me approach better. The reason is that it's weird if a pseudo-table contains different data depending on which node you're connecting from.
    Also it sounds like it would be very easy to do (since already had it).

  13. danielmewes commented on Oct 28, 2014

    @danielmewes
    Member

    Let's bring back /ajax/me for the first version. It's mostly a web UI specific piece of information, that you don't generally need for administration.
    We can find a more general solution later.

  14. deontologician commented on Oct 31, 2014

    @deontologician
    Contributor

    ping @danielmewes @Tryneus is this an easy change to put back?

  15. 2 remaining items

  16. timmaxw commented on Nov 1, 2014

    @timmaxw
    MemberAuthor

    Merged into reql_admin in 8af94e9.

  17. deontologician commented on Nov 17, 2014

    @deontologician
    Contributor

    Currently ajax/me is returning the uuid, could we get the server name instead?

  18. danielmewes commented on Nov 17, 2014

    @danielmewes
    Member

    Could you read the server name from server_status?

  19. deontologician commented on Nov 18, 2014

    @deontologician
    Contributor

    I can, but it requires making a second request. The point of this call is for the webui, so it makes sense to just have it in the format the webui requires. If it's difficult though I can work around it

  20. timmaxw commented on Nov 18, 2014

    @timmaxw
    MemberAuthor

    Do you just need the server name, or do you need both? It seems like if the web UI wanted to e.g. show a link to the server page for the specific connected server, then it would need the UUID.

  21. danielmewes commented on Nov 18, 2014

    @danielmewes
    Member

    How about we make it return a document

    {
      uuid:
      name:
    }
    
  22. Tryneus commented on Nov 18, 2014

    @Tryneus
    Member

    To be honest, it'll need to make the second request regularly, anyway - the server's name can change at any time. Probably best to batch it in with the stats requests, though.

  23. deontologician commented on Nov 19, 2014

    @deontologician
    Contributor

    OK, I'm going to just do the second request in the huge batch that happens every 5 seconds.

  24. modified the milestones: , 1.16 on Jan 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions