From 1e42cd2ddf9d124b992a35ceab0aa7f67931fba9 Mon Sep 17 00:00:00 2001 From: freddyDOTCMS Date: Mon, 6 Jan 2025 11:28:31 -0600 Subject: [PATCH] #31022 Setting conHost in the PageCollector --- .../com/dotcms/analytics/track/collectors/PagesCollector.java | 3 +++ .../dotcms/analytics/track/collectors/PagesCollectorTest.java | 1 + 2 files changed, 4 insertions(+) diff --git a/dotCMS/src/main/java/com/dotcms/analytics/track/collectors/PagesCollector.java b/dotCMS/src/main/java/com/dotcms/analytics/track/collectors/PagesCollector.java index 1f8a1cd951b9..e8f510d2e012 100644 --- a/dotCMS/src/main/java/com/dotcms/analytics/track/collectors/PagesCollector.java +++ b/dotCMS/src/main/java/com/dotcms/analytics/track/collectors/PagesCollector.java @@ -12,6 +12,7 @@ import com.dotmarketing.portlets.htmlpageasset.business.HTMLPageAssetAPI; import com.dotmarketing.portlets.htmlpageasset.model.IHTMLPage; import com.dotmarketing.util.PageMode; +import com.liferay.util.StringPool; import io.vavr.control.Try; import java.util.HashMap; @@ -94,6 +95,7 @@ public CollectorPayloadBean collect(final CollectorContextMap collectorContextMa pageObject.put(WORKING, String.valueOf(Try.of(()->page.isWorking()).getOrElse(false))); collectorPayloadBean.put(EVENT_TYPE, EventType.PAGE_REQUEST.getType()); } + pageObject.put(URL, uri); } @@ -104,6 +106,7 @@ public CollectorPayloadBean collect(final CollectorContextMap collectorContextMa if (Objects.nonNull(site)) { collectorPayloadBean.put(SITE_NAME, site.getHostname()); + collectorPayloadBean.put(SITE_ID, site.getIdentifier()); } return collectorPayloadBean; diff --git a/dotCMS/src/test/java/com/dotcms/analytics/track/collectors/PagesCollectorTest.java b/dotCMS/src/test/java/com/dotcms/analytics/track/collectors/PagesCollectorTest.java index a5915a358e0a..f4118faebb1f 100644 --- a/dotCMS/src/test/java/com/dotcms/analytics/track/collectors/PagesCollectorTest.java +++ b/dotCMS/src/test/java/com/dotcms/analytics/track/collectors/PagesCollectorTest.java @@ -63,5 +63,6 @@ public RequestMatcher getRequestMatcher() { Assert.assertEquals("www.dotcms.com", collectorPayloadBean.get(Collector.SITE_NAME)); Assert.assertEquals("en", collectorPayloadBean.get(Collector.LANGUAGE)); Assert.assertEquals(EventType.PAGE_REQUEST.getType(), collectorPayloadBean.get(Collector.EVENT_TYPE)); + Assert.assertEquals("1", collectorPayloadBean.get(Collector.SITE_ID)); } }