Altalogy / tari

The Tari protocol
https://tari.com
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

[ExpertView] Logs #11

Open tarnas14 opened 2 years ago

tarnas14 commented 2 years ago

we should show tari logs from tari processes the logs are available in different paths based on OS:

logs taken from these files should be rendered with grafana then we embed grafana on the logs page, maybe with some additional styling to be closer in the color scheme to figma

for more info see the discussion in #206

tarnas14 commented 2 years ago

internal discussion:

1. image what are the "type" and "localisation" filters for logs? other dropdowns are explained in figma

2. image do I understand correctly that "current session" means current launchpad session and we need to include logs from all containers that were ever started during that session? answer: "current session" is the time since launchpad application was started

3. there is an "all history" option in logs period option, but settings have something like: image what should happen when we reach 50MB ? should we remove oldest logs? how do we make the decision which logs to remove? answer: if max file size is reached, logs should be deleted day by day, starting from the oldest

tarnas14 commented 2 years ago

update - have done some research on the logs implementation I'm creating an issue for a loki-oriented spike, will see how hard it is to set it up for our docker-compose, will give it one day

implementation proposals

assume that logs data is 'sever state' and make it queryable and cache'able on frontend we can use something like react-query to assign cache keys to specific container types etc then you can add logic to invalidate specific cache keys on log events as they come from the server to achieve "tail"

frontend-oriented approach

make launchpad responsible for persisting logs save each log on callback to a sqlite database (we can use this tauri plugin) or an indexeddb if there are performance issues, we can save logs to db through a dedicated web worker

backend-oriented approaches

same as above

save the logs on backend into a SQLite db, which frontend could query directly (db as a point of integration, but this is not the worst in this case, I think)

Loki

use Grafana Loki to collect and query data:

  1. add promtail and set up to collect logs and push them to loki
  2. set up loki, assign labels etc
  3. add a thin API in the tauri backend to use LogCLI to run LogQL against logCLI from frontend