Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ cube('request', {
MIN(utc_time) as createdAt,
MAX(source_ip) as source_ip,
MAX(language) as language,
MAX(user_agent) as user_agent,
MAX(useragent) as user_agent,
MAX(persona) as persona,
MAX(rendermode) as rendermode,
MAX(referer) as referer,
MAX(host) as host,
MAX(CASE WHEN event_type = 'PAGE_REQUEST' THEN object_id ELSE NULL END) as page_id,
MAX(CASE WHEN event_type = 'PAGE_REQUEST' THEN object_title ELSE NULL END) as page_title,
Expand All @@ -174,7 +177,7 @@ cube('request', {
MAX(CASE WHEN event_type = 'URL_MAP' THEN object_content_type_id ELSE NULL END) as url_map_content_type_id,
MAX(CASE WHEN event_type = 'URL_MAP' THEN object_content_type_name ELSE NULL END) as url_map_content_type_name,
MAX(CASE WHEN event_type = 'URL_MAP' THEN object_content_type_var_name ELSE NULL END) as url_map_content_type_var_name,
MAX(CASE WHEN event_type = 'URL_MAP' THEN object_detail_page_url ELSE NULL END) as url_map_detail_page_url,
MAX(object_detail_page_url) as url_map_detail_page_url,
MAX(url) AS url,
CASE
WHEN MAX(CASE WHEN event_type = 'FILE_REQUEST' THEN 1 ELSE 0 END) = 1 THEN 'FILE'
Expand All @@ -192,6 +195,9 @@ cube('request', {
sourceIp: { sql: 'source_ip', type: `string` },
language: { sql: 'language', type: `string` },
userAgent: { sql: 'user_agent', type: `string` },
referer: { sql: 'referer', type: `string` },
renderMode: { sql: 'rendermode', type: `string` },
persona: { sql: 'persona', type: `string` },
host: { sql: 'host', type: `string` },
url: { sql: 'url', type: `string` },
pageId: { sql: 'page_id', type: `string` },
Expand All @@ -209,11 +215,52 @@ cube('request', {
urlMapContentDetailTitle: { sql: 'url_map_content_detail_title', type: `string` },
urlMapContentId: { sql: 'url_map_content_type_id', type: `string` },
urlMapContentTypeName: { sql: 'url_map_content_type_name', type: `string` },
urlMapContentTypeVarName: { sql: 'url_map_content_type_var_name', type: `string` },
urlMapContentTypeVarName: { sql: 'url_map_content_type_var_name', type: `string` }
},
measures: {
count: {
type: "count"
},
totalSessions: {
sql: 'sessionid',
type: 'countDistinct',
title: 'Total Sessions'
},
totalRequest: {
sql: 'request_id',
type: 'countDistinct',
title: 'Total Requests'
},
pageRequest: {
sql: 'page_id',
type: 'count',
title: 'Count of Page request'
},
uniquePageRequest: {
sql: 'page_id',
type: 'countDistinct',
title: 'Unique Page Ids by Session'
},
pageRequestAverage: {
sql: `${fileRequest} / NULLIF(${totalRequest}, 0)`,
type: 'number',
title: 'FileRequest Average'
},
fileRequest: {
sql: 'file_id',
type: 'count',
title: 'Count of File Request'
},
uniqueFileRequest: {
sql: 'file_id',
type: 'countDistinct',
title: 'Unique Count of File Request'
},
fileRequestAverage: {
sql: `${fileRequest} / NULLIF(${totalRequest}, 0)`,
type: 'number',
title: 'FileRequest Average'
}
}
});

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
import com.dotcms.enterprise.cluster.ClusterFactory;
import com.dotcms.util.FunctionUtils;
import com.dotmarketing.business.APILocator;
import com.dotmarketing.business.web.WebAPILocator;
import com.dotmarketing.util.PageMode;
import com.dotmarketing.util.UtilMethods;

import javax.servlet.http.HttpServletRequest;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
Expand Down Expand Up @@ -41,6 +45,21 @@ public CollectorPayloadBean collect(final CollectorContextMap collectorContextMa
FunctionUtils.getOrDefault(Objects.nonNull(serverId), ()->serverId,()->APILocator.getServerAPI().readServerId()));
collectorPayloadBean.put("sessionId", sessionId);
collectorPayloadBean.put("sessionNew", sessionNew);

if (UtilMethods.isSet(collectorContextMap.get("referer"))) {
collectorPayloadBean.put("referer", collectorContextMap.get("referer").toString());
}

if (UtilMethods.isSet(collectorContextMap.get("user-agent"))) {
collectorPayloadBean.put("userAgent", collectorContextMap.get("user-agent").toString());
}

final HttpServletRequest request = (HttpServletRequest)collectorContextMap.get("request");

collectorPayloadBean.put("persona",
WebAPILocator.getPersonalizationWebAPI().getContainerPersonalization(request));

collectorPayloadBean.put("renderMode", PageMode.get(request).toString().replace("_MODE", ""));
return collectorPayloadBean;
}

Expand Down

0 comments on commit 54f21fa

Please sign in to comment.