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

[Merged by Bors] - Logging via the HTTP API #4074

Closed
wants to merge 26 commits into from

Conversation

AgeManning
Copy link
Member

This PR adds the ability to read the Lighthouse logs from the HTTP API for both the BN and the VC.

This is done in such a way to as minimize any kind of performance hit by adding this feature.

The current design creates a tokio broadcast channel and mixes is into a form of slog drain that combines with our main global logger drain, only if the http api is enabled.

The drain gets the logs, checks the log level and drops them if they are below INFO. If they are INFO or higher, it sends them via a broadcast channel only if there are users subscribed to the HTTP API channel. If not, it drops the logs.

If there are more than one subscriber, the channel clones the log records and converts them to json in their independent HTTP API tasks.

@AgeManning AgeManning added ready-for-review The code is ready for review v4.0.0 Mainnet Capella release expected late March 2023 labels Mar 13, 2023
@paulhauner paulhauner self-assigned this Mar 14, 2023
@paulhauner
Copy link
Member

It looks like this one didn't make it, sorry Age :(

@paulhauner paulhauner added v4.1.0 Post-Capella minor release and removed v4.0.0 Mainnet Capella release expected late March 2023 labels Mar 21, 2023
Copy link

@makru86 makru86 left a comment

Choose a reason for hiding this comment

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

not sure if I am right or not.

@AgeManning
Copy link
Member Author

@atokama - Thanks for the review. I'll change it to be consistent :).

@paulhauner paulhauner added v4.2.0 Q2 2023 and removed v4.1.0 Post-Capella minor release labels Apr 13, 2023
@AgeManning AgeManning added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels May 17, 2023
Copy link
Member

@paulhauner paulhauner left a comment

Choose a reason for hiding this comment

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

Nice!

@paulhauner paulhauner added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels May 17, 2023
@paulhauner
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request May 17, 2023
This PR adds the ability to read the Lighthouse logs from the HTTP API for both the BN and the VC. 

This is done in such a way to as minimize any kind of performance hit by adding this feature.

The current design creates a tokio broadcast channel and mixes is into a form of slog drain that combines with our main global logger drain, only if the http api is enabled. 

The drain gets the logs, checks the log level and drops them if they are below INFO. If they are INFO or higher, it sends them via a broadcast channel only if there are users subscribed to the HTTP API channel. If not, it drops the logs. 

If there are more than one subscriber, the channel clones the log records and converts them to json in their independent HTTP API tasks. 

Co-authored-by: Michael Sproul <micsproul@gmail.com>
@bors
Copy link

bors bot commented May 17, 2023

Timed out.

@michaelsproul
Copy link
Member

bors retry

bors bot pushed a commit that referenced this pull request May 17, 2023
This PR adds the ability to read the Lighthouse logs from the HTTP API for both the BN and the VC. 

This is done in such a way to as minimize any kind of performance hit by adding this feature.

The current design creates a tokio broadcast channel and mixes is into a form of slog drain that combines with our main global logger drain, only if the http api is enabled. 

The drain gets the logs, checks the log level and drops them if they are below INFO. If they are INFO or higher, it sends them via a broadcast channel only if there are users subscribed to the HTTP API channel. If not, it drops the logs. 

If there are more than one subscriber, the channel clones the log records and converts them to json in their independent HTTP API tasks. 

Co-authored-by: Michael Sproul <micsproul@gmail.com>
@bors
Copy link

bors bot commented May 17, 2023

Timed out.

@paulhauner
Copy link
Member

It seems like the eth1-simulator-ubuntu is consistently timing out: https://github.com/sigp/lighthouse/actions/runs/5003142484/jobs/8964003366

I haven't looked into it so I'm not sure why.

@paulhauner paulhauner added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-merge This PR is ready to merge. labels May 18, 2023
paulhauner added a commit that referenced this pull request May 19, 2023
Squashed commit of the following:

commit 16771dc
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 17 15:27:47 2023 +1000

    fmt

commit 1deeafe
Merge: 9f5ca3d b29bb2e
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 17 15:26:13 2023 +1000

    Merge latest unstable

commit 9f5ca3d
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 17 15:24:06 2023 +1000

    Enable SSE logs only on GUI flag and misc reviewers comments

commit 5eeca70
Merge: 3efdbe2 d64be0d
Author: Age Manning <Age@AgeManning.com>
Date:   Tue May 9 10:08:05 2023 +1000

    Merge latest unstable

commit 3efdbe2
Author: Age Manning <Age@AgeManning.com>
Date:   Mon May 8 17:13:12 2023 +1000

    fmt

commit 202aad8
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 3 16:30:19 2023 +1000

    Remove api token requirement for sse logs

commit 5411d5a
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 3 15:57:59 2023 +1000

    Remove double json encoding

commit 29fb985
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 3 14:32:31 2023 +1000

    fmt

commit 3e10b26
Merge: 37ec9b7 826e748
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 3 14:30:41 2023 +1000

    Merge latest unstable

commit 37ec9b7
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 14 16:25:45 2023 +1100

    Revert old clippy change

commit b3d0167
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 14 14:45:31 2023 +1100

    Appease clippy

commit 1df3191
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 14 14:08:28 2023 +1100

    Fix tests

commit fc7645e
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 14 13:43:52 2023 +1100

    Fix logging tests via tokio upgrade

commit 4988a15
Merge: 6cf9338 90cef1d
Author: Age Manning <Age@AgeManning.com>
Date:   Mon Mar 13 15:47:26 2023 +1100

    Merge latest unstable

commit 6cf9338
Merge: 5deabe0 3ad77fb
Author: Age Manning <Age@AgeManning.com>
Date:   Mon Mar 13 15:39:51 2023 +1100

    Merge latest unstable

commit 5deabe0
Author: Age Manning <Age@AgeManning.com>
Date:   Mon Mar 13 15:39:45 2023 +1100

    fmt

commit 5f24f65
Author: Age Manning <Age@AgeManning.com>
Date:   Mon Mar 13 15:38:36 2023 +1100

    A working version

commit 4da3351
Author: Age Manning <Age@AgeManning.com>
Date:   Thu Mar 9 13:44:22 2023 +1100

    Tokio broadcast version

commit e34aab2
Merge: cd6edbc 9d821ce
Author: Age Manning <Age@AgeManning.com>
Date:   Thu Mar 9 13:17:38 2023 +1100

    Merge pull request #3 from michaelsproul/sse-logs

    Workaround format_args! with closure

commit 9d821ce
Author: Michael Sproul <micsproul@gmail.com>
Date:   Thu Mar 9 11:57:51 2023 +1100

    Workaround format_args! with closure

commit cd6edbc
Author: Age Manning <Age@AgeManning.com>
Date:   Thu Mar 9 11:18:02 2023 +1100

    Getting closer

commit e9eb455
Author: Age Manning <Age@AgeManning.com>
Date:   Wed Mar 8 16:38:58 2023 +1100

    Crossbeam version

commit b688cfb
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 7 14:56:17 2023 +1100

    More temp commits

commit 228b930
Merge: 035ca37 17d9a62
Author: Age Manning <Age@AgeManning.com>
Date:   Wed Mar 1 13:05:45 2023 +1100

    Merge latest unstable

commit 035ca37
Author: Age Manning <Age@AgeManning.com>
Date:   Wed Feb 8 20:24:39 2023 +1100

    Temp progress
paulhauner added a commit that referenced this pull request May 20, 2023
Squashed commit of the following:

commit 16771dc
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 17 15:27:47 2023 +1000

    fmt

commit 1deeafe
Merge: 9f5ca3d b29bb2e
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 17 15:26:13 2023 +1000

    Merge latest unstable

commit 9f5ca3d
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 17 15:24:06 2023 +1000

    Enable SSE logs only on GUI flag and misc reviewers comments

commit 5eeca70
Merge: 3efdbe2 d64be0d
Author: Age Manning <Age@AgeManning.com>
Date:   Tue May 9 10:08:05 2023 +1000

    Merge latest unstable

commit 3efdbe2
Author: Age Manning <Age@AgeManning.com>
Date:   Mon May 8 17:13:12 2023 +1000

    fmt

commit 202aad8
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 3 16:30:19 2023 +1000

    Remove api token requirement for sse logs

commit 5411d5a
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 3 15:57:59 2023 +1000

    Remove double json encoding

commit 29fb985
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 3 14:32:31 2023 +1000

    fmt

commit 3e10b26
Merge: 37ec9b7 826e748
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 3 14:30:41 2023 +1000

    Merge latest unstable

commit 37ec9b7
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 14 16:25:45 2023 +1100

    Revert old clippy change

commit b3d0167
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 14 14:45:31 2023 +1100

    Appease clippy

commit 1df3191
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 14 14:08:28 2023 +1100

    Fix tests

commit fc7645e
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 14 13:43:52 2023 +1100

    Fix logging tests via tokio upgrade

commit 4988a15
Merge: 6cf9338 90cef1d
Author: Age Manning <Age@AgeManning.com>
Date:   Mon Mar 13 15:47:26 2023 +1100

    Merge latest unstable

commit 6cf9338
Merge: 5deabe0 3ad77fb
Author: Age Manning <Age@AgeManning.com>
Date:   Mon Mar 13 15:39:51 2023 +1100

    Merge latest unstable

commit 5deabe0
Author: Age Manning <Age@AgeManning.com>
Date:   Mon Mar 13 15:39:45 2023 +1100

    fmt

commit 5f24f65
Author: Age Manning <Age@AgeManning.com>
Date:   Mon Mar 13 15:38:36 2023 +1100

    A working version

commit 4da3351
Author: Age Manning <Age@AgeManning.com>
Date:   Thu Mar 9 13:44:22 2023 +1100

    Tokio broadcast version

commit e34aab2
Merge: cd6edbc 9d821ce
Author: Age Manning <Age@AgeManning.com>
Date:   Thu Mar 9 13:17:38 2023 +1100

    Merge pull request #3 from michaelsproul/sse-logs

    Workaround format_args! with closure

commit 9d821ce
Author: Michael Sproul <micsproul@gmail.com>
Date:   Thu Mar 9 11:57:51 2023 +1100

    Workaround format_args! with closure

commit cd6edbc
Author: Age Manning <Age@AgeManning.com>
Date:   Thu Mar 9 11:18:02 2023 +1100

    Getting closer

commit e9eb455
Author: Age Manning <Age@AgeManning.com>
Date:   Wed Mar 8 16:38:58 2023 +1100

    Crossbeam version

commit b688cfb
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 7 14:56:17 2023 +1100

    More temp commits

commit 228b930
Merge: 035ca37 17d9a62
Author: Age Manning <Age@AgeManning.com>
Date:   Wed Mar 1 13:05:45 2023 +1100

    Merge latest unstable

commit 035ca37
Author: Age Manning <Age@AgeManning.com>
Date:   Wed Feb 8 20:24:39 2023 +1100

    Temp progress
paulhauner added a commit that referenced this pull request May 22, 2023
Squashed commit of the following:

commit 16771dc
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 17 15:27:47 2023 +1000

    fmt

commit 1deeafe
Merge: 9f5ca3d b29bb2e
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 17 15:26:13 2023 +1000

    Merge latest unstable

commit 9f5ca3d
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 17 15:24:06 2023 +1000

    Enable SSE logs only on GUI flag and misc reviewers comments

commit 5eeca70
Merge: 3efdbe2 d64be0d
Author: Age Manning <Age@AgeManning.com>
Date:   Tue May 9 10:08:05 2023 +1000

    Merge latest unstable

commit 3efdbe2
Author: Age Manning <Age@AgeManning.com>
Date:   Mon May 8 17:13:12 2023 +1000

    fmt

commit 202aad8
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 3 16:30:19 2023 +1000

    Remove api token requirement for sse logs

commit 5411d5a
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 3 15:57:59 2023 +1000

    Remove double json encoding

commit 29fb985
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 3 14:32:31 2023 +1000

    fmt

commit 3e10b26
Merge: 37ec9b7 826e748
Author: Age Manning <Age@AgeManning.com>
Date:   Wed May 3 14:30:41 2023 +1000

    Merge latest unstable

commit 37ec9b7
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 14 16:25:45 2023 +1100

    Revert old clippy change

commit b3d0167
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 14 14:45:31 2023 +1100

    Appease clippy

commit 1df3191
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 14 14:08:28 2023 +1100

    Fix tests

commit fc7645e
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 14 13:43:52 2023 +1100

    Fix logging tests via tokio upgrade

commit 4988a15
Merge: 6cf9338 90cef1d
Author: Age Manning <Age@AgeManning.com>
Date:   Mon Mar 13 15:47:26 2023 +1100

    Merge latest unstable

commit 6cf9338
Merge: 5deabe0 3ad77fb
Author: Age Manning <Age@AgeManning.com>
Date:   Mon Mar 13 15:39:51 2023 +1100

    Merge latest unstable

commit 5deabe0
Author: Age Manning <Age@AgeManning.com>
Date:   Mon Mar 13 15:39:45 2023 +1100

    fmt

commit 5f24f65
Author: Age Manning <Age@AgeManning.com>
Date:   Mon Mar 13 15:38:36 2023 +1100

    A working version

commit 4da3351
Author: Age Manning <Age@AgeManning.com>
Date:   Thu Mar 9 13:44:22 2023 +1100

    Tokio broadcast version

commit e34aab2
Merge: cd6edbc 9d821ce
Author: Age Manning <Age@AgeManning.com>
Date:   Thu Mar 9 13:17:38 2023 +1100

    Merge pull request #3 from michaelsproul/sse-logs

    Workaround format_args! with closure

commit 9d821ce
Author: Michael Sproul <micsproul@gmail.com>
Date:   Thu Mar 9 11:57:51 2023 +1100

    Workaround format_args! with closure

commit cd6edbc
Author: Age Manning <Age@AgeManning.com>
Date:   Thu Mar 9 11:18:02 2023 +1100

    Getting closer

commit e9eb455
Author: Age Manning <Age@AgeManning.com>
Date:   Wed Mar 8 16:38:58 2023 +1100

    Crossbeam version

commit b688cfb
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Mar 7 14:56:17 2023 +1100

    More temp commits

commit 228b930
Merge: 035ca37 17d9a62
Author: Age Manning <Age@AgeManning.com>
Date:   Wed Mar 1 13:05:45 2023 +1100

    Merge latest unstable

commit 035ca37
Author: Age Manning <Age@AgeManning.com>
Date:   Wed Feb 8 20:24:39 2023 +1100

    Temp progress
@paulhauner
Copy link
Member

eth1-simulator-ubuntu passed 🎉

bors r+

bors bot pushed a commit that referenced this pull request May 22, 2023
This PR adds the ability to read the Lighthouse logs from the HTTP API for both the BN and the VC. 

This is done in such a way to as minimize any kind of performance hit by adding this feature.

The current design creates a tokio broadcast channel and mixes is into a form of slog drain that combines with our main global logger drain, only if the http api is enabled. 

The drain gets the logs, checks the log level and drops them if they are below INFO. If they are INFO or higher, it sends them via a broadcast channel only if there are users subscribed to the HTTP API channel. If not, it drops the logs. 

If there are more than one subscriber, the channel clones the log records and converts them to json in their independent HTTP API tasks. 

Co-authored-by: Michael Sproul <micsproul@gmail.com>
@bors
Copy link

bors bot commented May 22, 2023

Pull request successfully merged into unstable.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title Logging via the HTTP API [Merged by Bors] - Logging via the HTTP API May 22, 2023
@bors bors bot closed this May 22, 2023
ghost pushed a commit to oone-world/lighthouse that referenced this pull request Jul 13, 2023
This PR adds the ability to read the Lighthouse logs from the HTTP API for both the BN and the VC. 

This is done in such a way to as minimize any kind of performance hit by adding this feature.

The current design creates a tokio broadcast channel and mixes is into a form of slog drain that combines with our main global logger drain, only if the http api is enabled. 

The drain gets the logs, checks the log level and drops them if they are below INFO. If they are INFO or higher, it sends them via a broadcast channel only if there are users subscribed to the HTTP API channel. If not, it drops the logs. 

If there are more than one subscriber, the channel clones the log records and converts them to json in their independent HTTP API tasks. 

Co-authored-by: Michael Sproul <micsproul@gmail.com>
Woodpile37 pushed a commit to Woodpile37/lighthouse that referenced this pull request Jan 6, 2024
This PR adds the ability to read the Lighthouse logs from the HTTP API for both the BN and the VC.

This is done in such a way to as minimize any kind of performance hit by adding this feature.

The current design creates a tokio broadcast channel and mixes is into a form of slog drain that combines with our main global logger drain, only if the http api is enabled.

The drain gets the logs, checks the log level and drops them if they are below INFO. If they are INFO or higher, it sends them via a broadcast channel only if there are users subscribed to the HTTP API channel. If not, it drops the logs.

If there are more than one subscriber, the channel clones the log records and converts them to json in their independent HTTP API tasks.

Co-authored-by: Michael Sproul <micsproul@gmail.com>
Woodpile37 pushed a commit to Woodpile37/lighthouse that referenced this pull request Jan 6, 2024
This PR adds the ability to read the Lighthouse logs from the HTTP API for both the BN and the VC.

This is done in such a way to as minimize any kind of performance hit by adding this feature.

The current design creates a tokio broadcast channel and mixes is into a form of slog drain that combines with our main global logger drain, only if the http api is enabled.

The drain gets the logs, checks the log level and drops them if they are below INFO. If they are INFO or higher, it sends them via a broadcast channel only if there are users subscribed to the HTTP API channel. If not, it drops the logs.

If there are more than one subscriber, the channel clones the log records and converts them to json in their independent HTTP API tasks.

Co-authored-by: Michael Sproul <micsproul@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v4.2.0 Q2 2023 waiting-on-author The reviewer has suggested changes and awaits thier implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants