You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Web UI needs a way to find out which server it's connected to #2979
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.
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. 👍
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".
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.
@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.
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.
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.
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.
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).
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.
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
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.
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.
Activity
Tryneus commentedon Aug 28, 2014
This would be weird if it's the only thing provided on
/ajax.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?timmaxw commentedon Aug 28, 2014
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/mewould make a good stop-gap measure.coffeemug commentedon Aug 28, 2014
I don't like any of these options. I think we can do better.
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. 👍coffeemug commentedon Aug 28, 2014
Another option is
r.whoami(), but I like that less thanconn.server().timmaxw commentedon Aug 28, 2014
conn.server_uuid()to make it clear it returns a UUID. We might eventually implement something calledconn.server()which returns a name."proxy".neumino commentedon Aug 29, 2014
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.coffeemug commentedon Aug 29, 2014
A few things:
conn.server_id(), notserver_uuid. Also, we should renameuuidtoidin 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.neumino commentedon Aug 30, 2014
idinstead ofuuidwould make things easier to integrate with Backbone (web ui stuff)conn.server()that returns the name of the server? Isn'tconn.serversomething only for the web ui? We can return{id: ..., name: ...}if we expect people from using it.coffeemug commentedon Sep 3, 2014
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.
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.Tryneus commentedon Oct 22, 2014
For the sake of getting the release out the door quickly, we should probably do whatever's easiest, which is either leaving
/ajax/methe way it is, or adding an undocumented field in a hidden pseudo-table somewhere.danielmewes commentedon Oct 22, 2014
Out of those two I like the
/ajax/meapproach 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).
danielmewes commentedon Oct 28, 2014
Let's bring back
/ajax/mefor 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.
deontologician commentedon Oct 31, 2014
ping @danielmewes @Tryneus is this an easy change to put back?
2 remaining items
timmaxw commentedon Nov 1, 2014
Merged into
reql_adminin 8af94e9.deontologician commentedon Nov 17, 2014
Currently ajax/me is returning the uuid, could we get the server name instead?
danielmewes commentedon Nov 17, 2014
Could you read the server name from
server_status?deontologician commentedon Nov 18, 2014
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
timmaxw commentedon Nov 18, 2014
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.
danielmewes commentedon Nov 18, 2014
How about we make it return a document
Tryneus commentedon Nov 18, 2014
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.
deontologician commentedon Nov 19, 2014
OK, I'm going to just do the second request in the huge batch that happens every 5 seconds.