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

:Issue 234: Split into reusable packages. #298

Merged
merged 13 commits into from
Apr 17, 2020

Conversation

davidsonff
Copy link
Contributor

Signed-off-by: Frank Davidson frank_davidson@manulife.com

Hi,

I tried to deal with Issue #234. I don't have access to a StatsD server or anything (I'm actually working towards fixing the similar Graphite Exporter problem).

This passed all the tests. Let me know if there are things to fix here.

Thank you for all your hard work!

Frank

@SuperQ
Copy link
Member

SuperQ commented Mar 13, 2020

It looks like you're using an editor or environment that is re-formatting all files with DOS carriage-return. Please update your environment settings and revert those changes.

@davidsonff davidsonff closed this Mar 16, 2020
@davidsonff
Copy link
Contributor Author

Just tried to fix the line endings.

@davidsonff davidsonff reopened this Mar 16, 2020
Copy link
Contributor

@matthiasr matthiasr left a comment

Choose a reason for hiding this comment

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

I think you're our first Windows contributor in this repository 😄 sorry for all the things we are not handling properly in that case. Could you also rebase out the statsd_exporter.exe and gitignore it?

event_test.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
pkg/event/event.go~ Outdated Show resolved Hide resolved
@matthiasr
Copy link
Contributor

Thank you so much for tackling this!

The ~ files are making the diff tricky, I'm going to do another review pass when those are out. Could you also take a look at the failing tests?

@davidsonff davidsonff force-pushed the issue-234 branch 2 times, most recently from 1a64e71 to bb3927b Compare March 17, 2020 19:53
Copy link
Contributor

@matthiasr matthiasr left a comment

Choose a reason for hiding this comment

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

Thank you for fixing the newlines! I'm quite happy with this already, only a few more comments on code organization.

The more I see them the more I think passing all the metrics individually is not viable. Let's make them fields on the relevant structs. I am wondering if there is a nice way to reduce the boilerplate for the caller without making packages mess with global state …

pkg/util/util.go Outdated Show resolved Hide resolved
exporter_test.go Outdated Show resolved Hide resolved
@davidsonff
Copy link
Contributor Author

Working on all of this. Might take a bit of time... Busy!

@matthiasr
Copy link
Contributor

awesome, thank you for checking in!

@davidsonff davidsonff force-pushed the issue-234 branch 6 times, most recently from e43b0c3 to 4cf5455 Compare April 8, 2020 19:22
aykutfarsak and others added 11 commits April 8, 2020 15:29
Signed-off-by: Aykut Farsak <aykutfarsak@gmail.com>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
Signed-off-by: Frank Davidson <frank_davidson@manulife.com>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
@davidsonff davidsonff force-pushed the issue-234 branch 2 times, most recently from b51efcb to dc6ba49 Compare April 8, 2020 19:35
@davidsonff davidsonff force-pushed the issue-234 branch 2 times, most recently from 42f236c to 72c05d2 Compare April 8, 2020 19:51
@davidsonff
Copy link
Contributor Author

I don't seem to be able to get the DCO check to work. Not sure what the issue is.

@matthiasr
Copy link
Contributor

I think it is taking issue with your author line:

commit 72c05d2e06e555b3011739d7416ce1bf9d92b2a8 (HEAD -> issue-234)
Author: = <=>
Date:   Wed Apr 8 14:59:19 2020 -0400

    Updated structs and tests.

    Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
    Signed-off-by: Frank Davidson <ffdavidson@gmail.com>

something seems to be off with your gitconfig.

@matthiasr
Copy link
Contributor

Looks good! I want to merge this as is. We may iterate on the interfaces later; I'm not super happy with the amount of boilerplate around the metrics but also don't have a solution yet.

When fixing the DCO, could you also squash all the commits into one so we don't end up with the .exe in the history?

squash! Updated structs and tests.

Updated structs and tests.

Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
Signed-off-by: Frank Davidson <frank_davidson@manulife.com>
Copy link
Contributor

@matthiasr matthiasr left a comment

Choose a reason for hiding this comment

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

Great job! I did some superficial acceptance testing and found that the unixgram listener crashes the program, but otherwise it seems to be working just as before. Once you add the listener.StatsDUnixgramListener initialization it is ready to merge.

main.go Outdated Show resolved Hide resolved
Signed-off-by: Frank Davidson <frank_davidson@manulife.com>
@matthiasr
Copy link
Contributor

Thank you so much for getting this done!

@matthiasr matthiasr merged commit 1f3adf6 into prometheus:master Apr 17, 2020
matthiasr pushed a commit that referenced this pull request Apr 17, 2020
this deserves a call-out to surface any issues.

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
@davidsonff
Copy link
Contributor Author

@matthiasr I think maybe I should pass line.LineToEvents() as a function value into the listener package, i.e., pass the LineToEvent function as an argument into listener.HandleConn() for use by event.EventHandler()? I don't think I can replace it as is now in the Graphite Exporter? What do you think? That would make LineToEvents pretty swappable for different use cases?

@matthiasr
Copy link
Contributor

That's a good idea, but does the listener have to know about events at all? I think we can disentangle the listener, event parsing, and collector even further. The listener package could only deal in "packages" (single lines or bundles of lines?), sending them through a channel to a parser goroutine (possibly multiple).

The chain would roughly be listener -> (statsd / graphite / influxdb / ???) parser -> event queue -> collector.

We already have a well defined interface from the parser to the event queue. What would be the best way to hand unparsed input to the parser? byte slices or strings? Single lines only, or whole packets? what would "a whole packet" mean in the context of TCP though?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants