[filebeat][streaming] - Added support for websocket keep_alive heartbeat, updated metrics & docs#44204
Conversation
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
|
@efd6, addressed all the suggestions. |
|
/test |
|
@efd6, I've resolved all the comments and put up a screen recording showing manual testing for this new feature along with a server restart. Sorry for the quality, res is 720p because of GitHub upload size limits. |
|
/test |
|
Can you put the test WS server code up somewhere so that we can use it for testing in future? |
|
@theletterf, resolved all the suggestions. |
|
@Mergifyio backport 8.19 9.0 |
✅ Backports have been createdDetails
|
…eat, updated metrics & docs (#44204) 1. Added support for websocket keep_alive config option and implemented keep_alive heartbeat logic in a separate go routine. 2. Added support for new metrics introduced with heartbeats. 3. Updated docs accordingly. 4. Added metrics test which was previously missing. (cherry picked from commit 73eed8b) # Conflicts: # x-pack/filebeat/docs/inputs/input-streaming.asciidoc # x-pack/filebeat/input/streaming/websocket.go
…eat, updated metrics & docs (#44204) 1. Added support for websocket keep_alive config option and implemented keep_alive heartbeat logic in a separate go routine. 2. Added support for new metrics introduced with heartbeats. 3. Updated docs accordingly. 4. Added metrics test which was previously missing. (cherry picked from commit 73eed8b) # Conflicts: # x-pack/filebeat/input/streaming/websocket.go
…ocket keep_alive heartbeat, updated metrics & docs (#45111) 1. Added support for websocket keep_alive config option and implemented keep_alive heartbeat logic in a separate go routine. 2. Added support for new metrics introduced with heartbeats. 3. Updated docs accordingly. 4. Added metrics test which was previously missing. (cherry picked from commit 73eed8b) --------- Co-authored-by: Shourie Ganguly <shourie.ganguly@elastic.co>
…socket keep_alive heartbeat, updated metrics & docs (#45110) 1. Added support for websocket keep_alive config option and implemented keep_alive heartbeat logic in a separate go routine. 2. Added support for new metrics introduced with heartbeats. 3. Updated docs accordingly. 4. Added metrics test which was previously missing. (cherry picked from commit 73eed8b) --------- Co-authored-by: Shourie Ganguly <shourie.ganguly@elastic.co>
Type of change
Proposed commit message
Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Disruptive User Impact
Note
I do not see an efficient way to test this with our current testing setup (still exploring this, thus PR still kept as draft). I believe we will have to rely on manual testing for this.
Go channels were not used because of complexity related to channel lifecycles and instead a cancellable context with a manual
cancel()call is used to avoid any channel related issues.Inbuilt test was not possible for this scenario due to current limitations of the test framework and testing philosophy, hence manual testing was performed with a custom websocket server, for which a screen recording is attached below along with respective filebeat config.
Author's Checklist
How to test this PR locally
Related issues
Use cases
Keeps low throughput WebSocket connections from idling out, which would otherwise result in frequent reconnects.
Screenshots
Screen Recording Of Manual Testing
filebeat config used:
Screen Recording
Test WS server is on the left, filebeat streaming input on the right:
ws_keepAlive_manual_test.mov
Test Server Gist
https://gist.github.com/ShourieG/322d38bdfc95cc7314e1729c3b892ae3
Logs
Manual Testing Debug Logs:
{ "log.level": "debug", "@timestamp": "2025-05-13T15:45:31.012+0530", "log.logger": "input.streaming", "log.origin": { "function": "github.com/elastic/beats/v7/x-pack/filebeat/input/streaming.(*keepAlive).heartBeat.func1", "file.name": "streaming/websocket.go", "file.line": 76 }, "message": "received pong message from websocket server", "service.name": "filebeat", "id": "6E095AFCCE4611A6", "input_source": "ws://localhost:443/ws", "input_url": "ws://localhost:443/ws", "pong_data": "SENT PONG FRAME", "ecs.version": "1.6.0" }