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

refactor: simplify Reporter interface #169

Merged
merged 1 commit into from
Oct 26, 2023
Merged

Conversation

LukeWinikates
Copy link
Contributor

@LukeWinikates LukeWinikates commented Oct 12, 2023

This refactor simplifies the Reporter interface by pushing a conditional from the caller into the Report method and eliminating ReportEvent from the interface.

  • simplifies code at the call site
  • makes the interface smaller
  • applies Tell, Don't Ask

Copy link
Contributor

@jbooherl jbooherl left a comment

Choose a reason for hiding this comment

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

LGTM

internal/reporter.go Outdated Show resolved Hide resolved
@LukeWinikates
Copy link
Contributor Author

LukeWinikates commented Oct 25, 2023

  • verify that the behavior change for the event sender doesn't pose any problems
    - [ ] Wavefront API should be able to handle sending gzipped events
    - [ ] Wavefront proxy should be able to handle gzipped event lines

@LukeWinikates
Copy link
Contributor Author

Just wrote some additional tests, sending an event directly to Wavefront and sending an event via my local Wavefront proxy.

Neither approach actually supports gzip - the proxy rejects it like this:

Proxy response to gzipped payload

2023-10-26 13:39:35,171 INFO  [AbstractReportableEntityHandler:reject] [2878] blocked input: [WF-300 Cannot parse metric: "�rp-K�+Q04��065�47543��LL!<������<�T�R%����[��|���BIb��Rqrj^bQf��BJfQjr�ny�nI~vj� ��8�Cb source="localhost""; remote: 0:0:0:0:0:0:0:1 [2878]; reason: "Invalid value: ��8�Cb"]

WF API response to gzipped JSON

{"status":{"result":"ERROR","message":"Illegal character ((CTRL-CHAR, code 31)): only regular white space (\\r, \\n, \\t) is allowed between tokens\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 2]","code":400}}

Without gzip, both work fine - so I will remove the gzip code path for events in this PR.

 - add integration test for sending events
 - add live tests
@LukeWinikates
Copy link
Contributor Author

@jbooherl @suprajanarasimhan made a couple more changes here. Still basically the same change, but I removed the line that sets the gzip header, and I added a bunch of tests. I'll probably merge this tomorrow.

@LukeWinikates LukeWinikates merged commit 2c0b8db into main Oct 26, 2023
3 checks passed
@LukeWinikates LukeWinikates deleted the reporter-refactor branch October 26, 2023 22:15
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.

2 participants