-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Cherry-pick #8278 to 6.x: Allow TCP helper to support delimiters #8302
Conversation
|
||
length, err := conn.Read(buffer) | ||
go g.handle(conn) |
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.
In the original PR, this statement is wrapped in an if conn != nil
. Is that needed here too?
func (g *TcpServer) handle(conn net.Conn) { | ||
if conn == nil { | ||
return | ||
} |
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.
This if
block is not in the original PR. Any specific reason for the difference in the backport?
@ycombinator thanks for reviewing this! And sorry for the confusion, I did a follow up PR (#8295) to the original one with some extra details, this one backports both PRs, this is why you see these differences. In the follow up PR I modified the changelog entry to be more explicit on the use case it supports. I also removed the deferred function enclosing |
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.
LGTM.
Cherry-pick of PR #8278 to 6.x branch. Original message:
There are TCP payloads coming in from graphite carbon forwarders into metricbeat that have many metrics separated by '\n`. What happens is that only the first event is parsed and the rest are dropped.
This PR attempts to allow TCP helper to accept a delimiter character which can be used to split the bytes coming in to the socket and create events for each one of them.