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

Feature suggestions for 2.x #16

Open
jtommi opened this issue Feb 18, 2021 · 3 comments
Open

Feature suggestions for 2.x #16

jtommi opened this issue Feb 18, 2021 · 3 comments

Comments

@jtommi
Copy link

jtommi commented Feb 18, 2021

I had some features in mind and wanted to get your take on which are interesting and what's the level of complexity to implement them.

Send panel options in the body

It would be nice to add the panel options in the body, e.g. {'heartbeat_activated': true, 'heartbeat_interval': 60}, etc
That would allow to easily spot sessions that were closed, especially with Heartbeat always activated.

Add 'in_focus' field in the heartbeat payload when 'Heartbeat always' is activated

I don't know how doable this is. The idea is to be able to know when the window is out of focus

Add the session start time in every payload

First I thought that the heartbeat paylaods shouldn't contain the objects user, host and dashboard, since they shouldn't change within a session.
Then I started my listener a bit to late, it did miss the start payload and the subsequent heartbeat payload through an exception on my listener because it couldn't find the UUID in the DB.
So I'd leave the complete payload in each type so that basically any heartbeat can also be a start in case the listener missed it.
But in that case it would be great to have the session start time in every payload.

Add a refresh payload

In addition to the heartbeat, also send a payload of {"type": "refresh"} each time the dashboard refreshes the panels
I'm not sure what would be the added value though compared to the heartbeat.

@MacroPower
Copy link
Owner

Send panel options in the body

This is very doable and I believe I actually had panel options being forwarded in the past, but removed them because I didn't have any need for them in my own listener implementations. But I could see how they might be useful for you, so I will try to get this added back in.

Add 'in_focus' field in the heartbeat payload when 'Heartbeat always' is activated

Great idea, I think this should be possible using the exact same method currently used to detect whether or not the window is in focus. We'll just have to check it regardless of the options and include the result in the payload.

Add the session start time in every payload

In my implementations I have just treated the heartbeat as the start time if the UUID doesn't exist yet. But I can see how this might be useful for accuracy. I'll give this feature some thought and maybe play around with a few implementations and see if I can find something that makes sense here.

Add a refresh payload

I will give this some thought, I had considered in the past that this would be helpful, but haven't decided on how it would be best implemented.

Thanks as always for your contributions @jtommi 🙂

@MacroPower
Copy link
Owner

@jtommi An update for you (sorry this took an entire month lol).

Per the two referenced commits, I've added options and also a hasFocus field to the payload body. hasFocus always exists (because having a consistent schema is pretty important) but if you have Heartbeat always set to false, it will (almost) always be true.

For the session start time, I actually already had this, it's called timeOrigin. I just forgot about it. timeOrigin is the time that the user loaded the dashboard, so it's actually even more accurate than the time of the start event.

I looked at adding a refresh event, but I couldn't figure out how to actually trigger anything when a refresh happens. It seems like this should be possible so I'll leave this issue open. I'll take another look sometime, maybe between now and then someone will give a suggestion.

@jtommi
Copy link
Author

jtommi commented May 20, 2021

Somehow I missed that you published v2. That's great, we'll be putting that in production shortly.
Thanks for the mention in the README

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

No branches or pull requests

2 participants