SUPPORT-9182: add extra logs 2

This commit is contained in:
gulnaz 2025-05-30 13:36:05 +03:00
parent e846562f0c
commit a9a5ac9a2f
2 changed files with 9 additions and 5 deletions

View file

@ -32,7 +32,8 @@ import ru.micord.ervu.util.NetworkUtils;
@Conditional(AuditEnabledCondition.class) @Conditional(AuditEnabledCondition.class)
public class BaseAuditService implements AuditService { public class BaseAuditService implements AuditService {
private static final Logger LOGGER = LoggerFactory.getLogger(BaseAuditService.class); private static final Logger LOGGER = LoggerFactory.getLogger(BaseAuditService.class);
private static final List<String> IP_HEADERS = Arrays.asList("X-Forwarded-For", "Proxy-Client-IP", "WL-Proxy-Client-IP", "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR"); private static final List<String> IP_HEADERS =
Arrays.asList("X-Forwarded-For", "Proxy-Client-IP", "WL-Proxy-Client-IP", "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR", "X-CLIENT-IP");
private final AuditKafkaPublisher auditPublisher; private final AuditKafkaPublisher auditPublisher;
@ -75,22 +76,22 @@ public class BaseAuditService implements AuditService {
String eventType) { String eventType) {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
String serverIp = NetworkUtils.getServerIp(); String serverIp = NetworkUtils.getServerIp();
LOGGER.info("Thread {} - server ip got in {} ms", Thread.currentThread().getId(), LOGGER.info("Thread {} - server ip {} got in {} ms", Thread.currentThread().getId(), serverIp,
System.currentTimeMillis() - startTime); System.currentTimeMillis() - startTime);
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
String clientIp = NetworkUtils.getClientIp(request); String clientIp = NetworkUtils.getClientIp(request);
LOGGER.info("Thread {} - client ip got in {} ms", Thread.currentThread().getId(), LOGGER.info("Thread {} - client ip {} got in {} ms", Thread.currentThread().getId(), clientIp,
System.currentTimeMillis() - startTime); System.currentTimeMillis() - startTime);
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
String serverHostName = NetworkUtils.getHostName(serverIp); String serverHostName = NetworkUtils.getHostName(serverIp);
LOGGER.info("Thread {} - server host name got in {} ms", Thread.currentThread().getId(), LOGGER.info("Thread {} - server host name {} got in {} ms", Thread.currentThread().getId(), serverHostName,
System.currentTimeMillis() - startTime); System.currentTimeMillis() - startTime);
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
String clientHostName = NetworkUtils.getHostName(clientIp); String clientHostName = NetworkUtils.getHostName(clientIp);
LOGGER.info("Thread {} - client host name got in {} ms", Thread.currentThread().getId(), LOGGER.info("Thread {} - client host name {} got in {} ms", Thread.currentThread().getId(), clientHostName,
System.currentTimeMillis() - startTime); System.currentTimeMillis() - startTime);
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();

View file

@ -290,7 +290,10 @@ public class EsiaAuthService {
); );
LOGGER.info("Thread {} - Process auth event: {} ms", Thread.currentThread().getId(), System.currentTimeMillis() - startSubReqTime); LOGGER.info("Thread {} - Process auth event: {} ms", Thread.currentThread().getId(), System.currentTimeMillis() - startSubReqTime);
} }
startSubReqTime = System.currentTimeMillis();
createTokenAndAddCookie(response, prnOid, ervuId, expiresIn); createTokenAndAddCookie(response, prnOid, ervuId, expiresIn);
LOGGER.info("Thread {} - Creating token and add cookie: {} ms", Thread.currentThread().getId(), System.currentTimeMillis() - startSubReqTime);
LOGGER.info("Thread {} - Request time: {} ms", Thread.currentThread().getId(), System.currentTimeMillis() - startReqTime); LOGGER.info("Thread {} - Request time: {} ms", Thread.currentThread().getId(), System.currentTimeMillis() - startReqTime);
} }
} }