-
Notifications
You must be signed in to change notification settings - Fork 129
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
fix (dot/telemetry): refactor telemetry to reduce CPU usage #1597
Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5a7d108
start new telemetry with channels
edwardmack 3d2e5ce
remove old telemetry code
edwardmack e09a762
add tests
edwardmack 64f9a54
Merge branch 'development' into ed/tel_channelRefactor
edwardmack 8791a42
Merge branch 'development' into ed/tel_channelRefactor
edwardmack 94b555c
lint
edwardmack a8bbce2
go fmt
edwardmack a2c3e01
fix anti-pattern returning unexported types
edwardmack 416b241
Merge branch 'development' into ed/tel_channelRefactor
edwardmack 5b0e29c
Merge branch 'development' into ed/tel_channelRefactor
edwardmack 2389682
added context, send websocket messages is goroutine (broken)
edwardmack 86841f7
Merge branch 'development' into ed/tel_channelRefactor
edwardmack 4798c14
move mutex to handler struct
edwardmack 4a2d693
Merge branch 'development' into ed/tel_channelRefactor
edwardmack 5d84332
embed mutex inside Handler
edwardmack f20eaeb
clean-up formatting to one NewKeyValue per line
edwardmack 28a5ef8
go fmt
edwardmack 9e15a35
remove empty body anti-pattern
edwardmack 14f67ac
go fmt
edwardmack 8f9d4f1
add test for concurrent connections
edwardmack e5690ed
remove context from Handler
edwardmack 53d8278
move mutex to telemetryConnection struct, make
edwardmack cdf1f3d
add logging
edwardmack 83c05c0
add timeout and error to SendMessage, fix typos, logging
edwardmack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the test. This helped me to debug the issue.
You can take a lock at the connection level which is optimized than taking the lock at the handler level because you can send multiple messages concurrently to different connections.
This issue is
connection
inHandler.connections
is value and not pointer. Hence it creates multiple instances of lock for the same connection.Add lock at the connection level but change
Handler.connections
to a pointer.Also, I think users should get notified in logs if they are unable to write messages to the telemetry server. So that they can take action accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for debugging this, it makes sense now. I've updated to fix it, and added logging to catch any error and warn the user.