From 9417591af3118fad71e40352099567c3d1e46e11 Mon Sep 17 00:00:00 2001 From: gsd Date: Mon, 11 Dec 2023 20:32:35 +0300 Subject: [PATCH] collect statistic v1 fix --- .../java/app/annotations/impl/CollectStatisticAspect.java | 4 +--- src/main/java/app/entities/db/CollectableStatistic.java | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/app/annotations/impl/CollectStatisticAspect.java b/src/main/java/app/annotations/impl/CollectStatisticAspect.java index 24b9d09..dbbd01d 100644 --- a/src/main/java/app/annotations/impl/CollectStatisticAspect.java +++ b/src/main/java/app/annotations/impl/CollectStatisticAspect.java @@ -34,8 +34,6 @@ public class CollectStatisticAspect { @Before("@annotation(app.annotations.interfaces.CollectStatistic)") public void before() { - CollectableStatistic st = new CollectableStatistic(request); - collectStatisticService.add(st); - logger.info(st.toString()); + collectStatisticService.add(new CollectableStatistic(request)); } } diff --git a/src/main/java/app/entities/db/CollectableStatistic.java b/src/main/java/app/entities/db/CollectableStatistic.java index 6e3de3c..f556bc8 100644 --- a/src/main/java/app/entities/db/CollectableStatistic.java +++ b/src/main/java/app/entities/db/CollectableStatistic.java @@ -24,6 +24,7 @@ public class CollectableStatistic { public CollectableStatistic(HttpServletRequest request) { this.client_ip = request.getHeader("X-Forwarded-For"); + if (this.client_ip != null) this.client_ip = this.client_ip.split(",")[0]; this.method = request.getMethod(); this.path = request.getRequestURI(); this.query = request.getQueryString();