forked from allegro/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve allegro#1738 | Add jetty http client request processing time …
…metrics
- Loading branch information
1 parent
4e9f8c7
commit 3f777ff
Showing
10 changed files
with
124 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...in/java/pl/allegro/tech/hermes/consumers/consumer/sender/http/JettyHttpClientMetrics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package pl.allegro.tech.hermes.consumers.consumer.sender.http; | ||
|
||
import org.eclipse.jetty.client.api.Request; | ||
import pl.allegro.tech.hermes.metrics.HermesTimer; | ||
|
||
public class JettyHttpClientMetrics implements Request.Listener { | ||
|
||
private final HermesTimer requestQueueWaitingTimer; | ||
private final HermesTimer requestProcessingTimer; | ||
|
||
public JettyHttpClientMetrics(HermesTimer requestQueueWaitingTimer, HermesTimer requestProcessingTimer) { | ||
this.requestQueueWaitingTimer = requestQueueWaitingTimer; | ||
this.requestProcessingTimer = requestProcessingTimer; | ||
} | ||
|
||
@Override | ||
public void onQueued(Request request) { | ||
var timer = requestQueueWaitingTimer.time(); | ||
|
||
request.onRequestBegin(onBeginRequest -> timer.close()); | ||
} | ||
|
||
@Override | ||
public void onBegin(Request request) { | ||
var timer = requestProcessingTimer.time(); | ||
|
||
request.onComplete(result -> timer.close()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters