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

Add logging of stream variables #468

Open
capital-G opened this issue Jun 21, 2023 · 4 comments
Open

Add logging of stream variables #468

capital-G opened this issue Jun 21, 2023 · 4 comments
Assignees
Milestone

Comments

@capital-G
Copy link
Member

Maybe createa flag for a Graph. This does not need to be stored in the database but maybe in a file?

          Lets create a script which logs all GPS variables

Originally posted by @capital-G in #6 (comment)

@capital-G capital-G self-assigned this Jun 21, 2023
@capital-G capital-G added this to the MLB 4 milestone Jun 21, 2023
@capital-G
Copy link
Member Author

If the variable is forwarded to SC it is possible to log them like this :)

docker compose logs -f -t -n 10 sound > gps.log

@capital-G
Copy link
Member Author

It would be cool to show the logs in general in some kind within the editor.
Maybe it is possible to store all logs and past-variables in redis? :o

@capital-G capital-G mentioned this issue Jul 12, 2023
5 tasks
@capital-G
Copy link
Member Author

Maybe it is possible to add a watcher to our sclogs which pumps them into our database.
If we add a Stream enter- and exit datetime it is possible to filter the logs.
Via a subscription / redis push it would be possible to update also the logs while they are happening.

@capital-G
Copy link
Member Author

This is way harder than I thought it would be. Currently there are two problems

a) If the log is yield in an async context it is not possible to push it into the database as the db connection requires a sync environment. Wrapping this requires a yield which is only available in an async function, but the default handler only has a sync interface
b) Currently I use logging.Filter to add a state to a logger - but this logger is not shared with other loggers, but this is mandatory as we want to set the state for a given context. (although I thought using the root logger would solve this?)

There is a blog entry https://rob-blackbourn.medium.com/how-to-use-python-logging-queuehandler-with-dictconfig-1e8b1284e27a which describes how to setup django using a Queue Handler

Also taking a look at the sentry sdk could be interesting as they sufffer from the same problem? I found https://github.com/getsentry/sentry-python/blob/026d6090247547637d4c607b95308b6271ab9dfc/sentry_sdk/integrations/django/asgi.py#L25-L42 but I still don't understand it fully.

I think the best would be to setup a small test project to figure this out in an easy way.

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

1 participant