Skip to content

Commit

Permalink
Merge pull request #2874 from atlanhq/intg-metrics
Browse files Browse the repository at this point in the history
feat: add integration metrics for all
  • Loading branch information
sumandas0 authored Mar 5, 2024
2 parents 2ae67ef + 37d1eee commit 7231338
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 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
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
Expand Down Expand Up @@ -388,8 +387,7 @@ public AtlasSearchResult searchWithParameters(SearchParameters parameters) throw
@Path("indexsearch")
@POST
@Timed
public AtlasSearchResult indexSearch(@Context HttpServletRequest servletRequest, IndexSearchParams parameters,
@Context HttpServletResponse response) throws AtlasBaseException {
public AtlasSearchResult indexSearch(@Context HttpServletRequest servletRequest, IndexSearchParams parameters) throws AtlasBaseException {
AtlasPerfTracer perf = null;
long startTime = System.currentTimeMillis();

Expand Down

0 comments on commit 7231338

Please sign in to comment.