Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Add event monitoring #306

Merged
merged 8 commits into from
Feb 16, 2018
Merged

Add event monitoring #306

merged 8 commits into from
Feb 16, 2018

Conversation

yfouquet
Copy link
Collaborator

@yfouquet yfouquet commented Feb 7, 2018

Monitor http request and cache events:

  • http requests failure, success or invalid response
  • cache start/stop
  • cache polling request (success/failure) with/without notification

Users will be able to implement methods of the callback (only those interesting them) to add custom monitoring (logs, metrics, ...).

The handler will call the callback methods asynchronously to not reduce performance of the API.
As the callback methods have default behavior, user may only implement the event they want.
Ask for event callback in Consul creation (optional).
Create event handler in Consul and inject it in each client (using base client).
Http class becomes stateful (storing the event handler).
Call the handler for each HTTP request with client name, method and query string.

EventClient was not fully using Http, so use it (with wrappers when needed).
There is too much duplicated code here, clean it.
Test all methods Sync and Async for:
 - result because of the refactoring
 - events

Also test consulResponse method.
Monitor cache stop/start, polling success/error.
@@ -0,0 +1,306 @@
package com.orbitz.consul.util;
Copy link

Choose a reason for hiding this comment

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

OPT: break lines between Arrange/Act/Assert sections in tests when they are more than a couple of lines

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.
Please tell me if it meets your expectations.

Copy link

Choose a reason for hiding this comment

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

👌

Following review of @zonkooo, splitting the Arrange/Act/Assert sections would enhance readability.
@@ -0,0 +1,306 @@
package com.orbitz.consul.util;
Copy link

Choose a reason for hiding this comment

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

👌

Copy link
Collaborator

@adericbourg adericbourg left a comment

Choose a reason for hiding this comment

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

Too big to review efficiently. LGTM overall.

@yfouquet yfouquet merged commit d4ce989 into rickfast:master Feb 16, 2018
@yfouquet yfouquet deleted the monitoring branch April 13, 2018 21:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants