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 Notifications for Log Viewer #2502

Merged
merged 8 commits into from
Dec 5, 2023

Conversation

andrewbaldwin44
Copy link
Collaborator

@andrewbaldwin44 andrewbaldwin44 commented Dec 4, 2023

Proposal

  • Add a generic notification hook that can subscribe to any data changes. The hook will register that a notification should be shown so long as the page containing the data is not currently being viewed.
  • Refactor the log viewer component to use the notification hook
  • Add tests for the log viewer and notification hooks

Recording 2023-12-04 at 13 46 33

The locust file used for testing adds a new log every 5 seconds:

class ExampleTest(TaskSet):
    @task
    def get_stuff(self):
        self.client.get("/")
        logger.warning("The --autostart argument is implied by --headless, no need to set both.")

class Example(HttpUser):
    wait_time = constant(5)
    tasks = [ExampleTest]
    host = "http://0.0.0.0:5000"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Moved, not deleted)

@cyberw
Copy link
Collaborator

cyberw commented Dec 5, 2023

never mind, i'm stupid :)

@cyberw
Copy link
Collaborator

cyberw commented Dec 5, 2023

Can we make the notification icon only appear on WARNING/ERROR/CRITICAL log levels? Every test is going to log some things on INFO level, no need to notify people about that :)

@andrewbaldwin44
Copy link
Collaborator Author

Let me look into that, I'm trying to keep the logic as 'self contained' as I can, so if we would like to have notifications for other tabs in the future, we can

@cyberw
Copy link
Collaborator

cyberw commented Dec 5, 2023

Perfect!

@cyberw cyberw merged commit 8086272 into locustio:master Dec 5, 2023
15 checks passed
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

Successfully merging this pull request may close these issues.

2 participants