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

Interconnection with sinx stats aggregator #58

Open
Arteneko opened this issue Dec 24, 2019 · 11 comments
Open

Interconnection with sinx stats aggregator #58

Arteneko opened this issue Dec 24, 2019 · 11 comments

Comments

@Arteneko
Copy link

I built sinx a while ago, to simplify scheduled stats collection.

It's backed by a redis storage and a pretty simple UX, and I wanted to know your thoughts about providing a plugin to extract data from sinx right away.

@shdown
Copy link
Owner

shdown commented Dec 24, 2019

Yes, that would be a nice example for out-of-tree plugin.

Sorry if I missed something, but how is that different from, well, querying redis directly (using, say, this library)?

Or do you want it to interact with sinx via the HTTP API? If so, we already have an example of such a widget.

@Arteneko
Copy link
Author

Arteneko commented Dec 24, 2019 via email

@shdown
Copy link
Owner

shdown commented Dec 24, 2019

OK, so do you have a command to get the prefix? Are there any other configuration variables that need to be read?

@Arteneko
Copy link
Author

Arteneko commented Dec 24, 2019 via email

@shdown
Copy link
Owner

shdown commented Dec 24, 2019

Okay, so we can just parse the config file(s) using lua-toml, and then query redis using redis-lua.

You can implement this yourself if you want, or wait until I do it.

@Arteneko
Copy link
Author

Arteneko commented Dec 24, 2019 via email

@shdown
Copy link
Owner

shdown commented Dec 24, 2019

Yeah, that would be nice.

@Arteneko
Copy link
Author

I have some issue with directly interacting with Redis, especially in the case in which the sinx instance is remote (I have this case).

I'm thinking of two things:

  • using io.popen to execute the CLI-based sinx or a curl to tap the sinx-http daemon
  • using a lua http library (dependency, not nice) to call the sinx-http daemon

How does this library handle lua dependencies on modules?
Is it up to the user to handle that?

@shdown
Copy link
Owner

shdown commented Feb 17, 2020

How does this library handle lua dependencies on modules?

luastatus is no library; rather, it is a platform.

Is it up to the user to handle that?

It’s up to Lua to handle that:

Lua uses the package library to manage modules.

package.path (for modules written in Lua) and package.cpath (for modules written in C) are the places where Lua looks for modules. They are semicolon-separated lists, and each entry can have a ? in it that's replaced with the module name.

luastatus just does not interfere with this, nor should it.

As for popen vs. lua http library, I would go for the http library — it’s quite easy to install it via luarocks.

Take a look at the following btc-price widget example: https://github.com/shdown/luastatus/blob/master/examples/i3/btc-price.lua

And at the imap plugin: https://github.com/shdown/luastatus/blob/master/plugins/imap/imap.lua

@Arteneko
Copy link
Author

Thanks for the info about libraries, I'm still not familiar with the lua tool environment, but trying to learn.

As a side-note, using luastatus right now on my work laptop, it integrates nicely with i3!

@shdown
Copy link
Owner

shdown commented Feb 17, 2020

As a side-note, using luastatus right now on my work laptop, it integrates nicely with i3!

Hearing such things is the ultimate reason to do open-source development :)

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