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

Allow TCP helper to support delimiters #8278

Merged
merged 2 commits into from
Sep 12, 2018

Conversation

vjsamuel
Copy link
Contributor

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.

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

}
}

func (t *TcpConfig) Validate() error {

Choose a reason for hiding this comment

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

exported method TcpConfig.Validate should have comment or be unexported

@vjsamuel vjsamuel force-pushed the tcp_helper_delimiter branch from e4af891 to f1f1d29 Compare September 10, 2018 22:37
@@ -43,6 +43,8 @@ type client struct {
timeout time.Duration
}

type ClientFactory func() *client

Choose a reason for hiding this comment

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

exported type ClientFactory should have comment or be unexported

@vjsamuel vjsamuel force-pushed the tcp_helper_delimiter branch from f1f1d29 to 8463bff Compare September 10, 2018 23:39

// Close connection when this function ends
defer func() {
if conn != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Can conn be nil here? I'd rather return immediately if that is the case.

metricbeat/helper/server/tcp/tcp.go Show resolved Hide resolved
@jsoriano jsoriano merged commit eeb1d3b into elastic:master Sep 12, 2018
jsoriano added a commit to jsoriano/beats that referenced this pull request Sep 12, 2018
@jsoriano jsoriano mentioned this pull request Sep 12, 2018
@vjsamuel vjsamuel deleted the tcp_helper_delimiter branch September 12, 2018 18:31
@vjsamuel
Copy link
Contributor Author

@jsoriano thank you for the quick review and merge

@jsoriano
Copy link
Member

@vjsamuel I have opened a small PR with some follow up details #8295

jsoriano added a commit that referenced this pull request Sep 13, 2018
jsoriano pushed a commit to jsoriano/beats that referenced this pull request Sep 13, 2018
jsoriano added a commit to jsoriano/beats that referenced this pull request Sep 13, 2018
jsoriano added a commit that referenced this pull request Sep 13, 2018
Allow TCP helper to support delimiters and graphite module to accept multiple metrics in a single payload. (#8278)

(cherry picked from commits eeb1d3b and ff566e7)

Co-authored-by: Vijay Samuel <vjsamuel1990@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants