nerves-hub / nerves_hub_link

Connect devices to NervesHub via a Phoenix channel
https://hex.pm/packages/nerves_hub_link
Apache License 2.0
36 stars 18 forks source link

Health checks #201

Closed lawik closed 3 days ago

lawik commented 4 months ago

@amclain @joshk This is my thinking on how to structure things.

Essentially you get an opinionated default report for much of what NervesMOTD does and such (not fully built out but sketched in code).

You can add custom metrics, metadata and such with minimal config changes.

Or you can write a custom report by implementing a behaviour and one line of config.

This should encode to JSON. I'm not convering scheduling here, I'm not talking storage, querying or anything.

The peripherals field probably requires most explanation but is also the one with the most structure and I'm happy for input on that. The idea is that you can do health checks on sensors, cameras, hardware, indicate what bus they are on and so on. The default would probably just have network info?

lawik commented 4 months ago

I think the next bit of code needed is in Socket which would reply to this information when asked for it.

I've added this stuff now. I think this implementation is "complete" for now. If completely untested :D I could add the other end too unless you feel extra keen @joshk

lawik commented 4 months ago

We should add tests. This is still a draft :)

joshk commented 3 months ago

I think we might want to bump https://github.com/nerves-hub/nerves_hub_link/blob/main/lib/nerves_hub_link/configurator.ex#L6 when this is merged in, and we can use this information in hub to decide to display information or a message to upgrade.

lawik commented 3 months ago

I think we might want to bump https://github.com/nerves-hub/nerves_hub_link/blob/main/lib/nerves_hub_link/configurator.ex#L6 when this is merged in, and we can use this information in hub to decide to display information or a message to upgrade.

But I think we've just added stuff? Or did we change any of the API surface already in use?

joshk commented 3 months ago

we added support for requesting health data. by matching this to the api version we can display in the UI that Link needs to be updated for this information to become available.