@@ -88,8 +88,7 @@ protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull Ht
8888
8989 try {
9090 // Register consumer and get consumer identifier
91- final Consumer consumer = ConsumerRegistry
92- .consumerFromObject (request .getAttribute ("apitallyConsumer" ));
91+ final Consumer consumer = ConsumerRegistry .consumerFromObject (request .getAttribute ("apitallyConsumer" ));
9392 client .consumerRegistry .addOrUpdateConsumer (consumer );
9493 final String consumerIdentifier = consumer != null ? consumer .getIdentifier () : "" ;
9594
@@ -99,14 +98,11 @@ protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull Ht
9998 : cachingRequest != null ? requestBody .length : -1 ;
10099 final long responseContentLength = getResponseContentLength (response );
101100 final long responseSize = responseContentLength >= 0 ? responseContentLength
102- : (cachingResponse != null ? responseBody .length
103- : countingResponse != null
104- ? countingResponse .getByteCount ()
105- : -1 );
106- client .requestCounter
107- .addRequest (consumerIdentifier , request .getMethod (), path , response .getStatus (),
108- responseTimeInMillis ,
109- requestSize , responseSize );
101+ : cachingResponse != null ? responseBody .length
102+ : countingResponse != null ? countingResponse .getByteCount () : -1 ;
103+ client .requestCounter .addRequest (
104+ consumerIdentifier , request .getMethod (), path , response .getStatus (), responseTimeInMillis ,
105+ requestSize , responseSize );
110106
111107 // Log request
112108 if (client .requestLogger .isEnabled ()) {
@@ -120,8 +116,7 @@ protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull Ht
120116 .toArray (Header []::new );
121117
122118 client .requestLogger .logRequest (
123- new Request (startTime / 1000.0 , consumerIdentifier , request .getMethod (),
124- path ,
119+ new Request (startTime / 1000.0 , consumerIdentifier , request .getMethod (), path ,
125120 request .getRequestURL ().toString (), requestHeaders , requestSize , requestBody ),
126121 new Response (response .getStatus (), responseTimeInMillis / 1000.0 , responseHeaders ,
127122 responseSize , responseBody ));
@@ -132,16 +127,17 @@ protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull Ht
132127 Object capturedException = request .getAttribute ("apitallyCapturedException" );
133128 if (capturedException instanceof ConstraintViolationException e ) {
134129 for (ConstraintViolation <?> violation : e .getConstraintViolations ()) {
135- client .validationErrorCounter .addValidationError (consumerIdentifier , request .getMethod (),
136- path , violation .getPropertyPath ().toString (), violation .getMessage (),
130+ client .validationErrorCounter .addValidationError (
131+ consumerIdentifier , request .getMethod (), path ,
132+ violation .getPropertyPath ().toString (), violation .getMessage (),
137133 violation .getConstraintDescriptor ().getAnnotation ().annotationType ()
138134 .getSimpleName ());
139135 }
140136 } else if (capturedException instanceof MethodArgumentNotValidException e ) {
141137 for (FieldError error : e .getBindingResult ().getFieldErrors ()) {
142- client .validationErrorCounter .addValidationError (consumerIdentifier , request . getMethod (),
143- path , error . getObjectName () + "." + error . getField () ,
144- error .getDefaultMessage (),
138+ client .validationErrorCounter .addValidationError (
139+ consumerIdentifier , request . getMethod (), path ,
140+ error .getObjectName () + "." + error . getField (), error . getDefaultMessage (),
145141 error .getCode ());
146142 }
147143 }
@@ -154,8 +150,8 @@ protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull Ht
154150 exception = (Exception ) capturedException ;
155151 }
156152 if (exception != null ) {
157- client .serverErrorCounter .addServerError (consumerIdentifier , request . getMethod (), path ,
158- exception );
153+ client .serverErrorCounter .addServerError (
154+ consumerIdentifier , request . getMethod (), path , exception );
159155 }
160156 }
161157 } catch (Exception e ) {
0 commit comments