Skip to content

Commit

Permalink
feat: log all the integration metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
sumandas0 committed Mar 5, 2024
1 parent 57e56f6 commit 37d1eee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class AbstractAuthClient {
private static final String BEARER = "Bearer ";
private static final int TIMEOUT_IN_SEC = 60;
private static final String INTEGRATION = "integration";
private static final String KEYCLOAK = "keycloak";
private static final String AUTH = "auth";

protected final AuthConfig authConfig;
protected final RetrofitKeycloakClient retrofitKeycloakClient;
Expand Down Expand Up @@ -84,10 +84,10 @@ public AbstractAuthClient(AuthConfig authConfig) {
Interceptor responseLoggingInterceptor = chain -> {
Request request = chain.request();
String rawPath = request.url().uri().getRawPath();
Timer.Sample timerSample = this.metricUtils.start(rawPath);
Timer.Sample timerSample = this.metricUtils.start(rawPath, false);
okhttp3.Response response = chain.proceed(request);
this.metricUtils.recordHttpTimer(timerSample, request.method(), rawPath, response.code(),
INTEGRATION, KEYCLOAK);
INTEGRATION, AUTH);
return response;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public Timer.Sample start(String uri) {
return matchCanonicalPattern(uri).isPresent() ? Timer.start(getMeterRegistry()) : null;
}

public Timer.Sample start(String uri, boolean checkCanonicalPattern) {
return checkCanonicalPattern ? start(uri) : Timer.start(getMeterRegistry());
}

public void recordHttpTimer(Timer.Sample sample, String method, String rawPath, int code, String... additionalTags) {
if (Objects.isNull(sample)) {
return;
Expand Down

0 comments on commit 37d1eee

Please sign in to comment.