Commit bfe18190 authored by Cristian Aguirre's avatar Cristian Aguirre

Update 'Tiempo de primera respuesta' chart

parent 83408ffc
...@@ -2,18 +2,18 @@ package com.bytesw.bytebot.etl.services; ...@@ -2,18 +2,18 @@ package com.bytesw.bytebot.etl.services;
import com.bytesw.bytebot.etl.dao.SessionBotRepository; import com.bytesw.bytebot.etl.dao.SessionBotRepository;
import com.bytesw.bytebot.etl.model.Session; import com.bytesw.bytebot.etl.model.Session;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.Instant; import java.time.*;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@Log4j2
public abstract class MessageProcessedSupport { public abstract class MessageProcessedSupport {
protected static final String SENDER_ID_FIELD_NAME = "senderId"; protected static final String SENDER_ID_FIELD_NAME = "senderId";
...@@ -35,6 +35,7 @@ public abstract class MessageProcessedSupport { ...@@ -35,6 +35,7 @@ public abstract class MessageProcessedSupport {
protected OffsetDateTime getOffsetDateTimeFromTimestampPython(Object objectTimestamp) { protected OffsetDateTime getOffsetDateTimeFromTimestampPython(Object objectTimestamp) {
BigDecimal dateDecimal; BigDecimal dateDecimal;
log.debug("TIME MILI: "+objectTimestamp);
if (objectTimestamp instanceof Double) { if (objectTimestamp instanceof Double) {
dateDecimal = new BigDecimal((Double) objectTimestamp); dateDecimal = new BigDecimal((Double) objectTimestamp);
} else { } else {
...@@ -43,16 +44,15 @@ public abstract class MessageProcessedSupport { ...@@ -43,16 +44,15 @@ public abstract class MessageProcessedSupport {
} }
dateDecimal = new BigDecimal(String.valueOf(objectTimestamp)); dateDecimal = new BigDecimal(String.valueOf(objectTimestamp));
} }
Long timestamp = (long)(dateDecimal.doubleValue()*1000);
Long timestamp = dateDecimal.longValue();
if (String.valueOf(timestamp).length() < 13) { if (String.valueOf(timestamp).length() < 13) {
int numberOfZero = 13 - String.valueOf(timestamp).length(); int numberOfZero = 13 - String.valueOf(timestamp).length();
for (int i = 0; i < numberOfZero; i++) { for (int i = 0; i < numberOfZero; i++) {
timestamp = timestamp * 10; timestamp = timestamp * 10;
} }
} }
OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault()); OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault());
log.debug("TIME: "+date);
return date; return date;
} }
......
...@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service; ...@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Optional; import java.util.Optional;
@Service @Service
...@@ -44,6 +45,7 @@ public class StartSessionMessageProcessed extends MessageProcessedSupport implem ...@@ -44,6 +45,7 @@ public class StartSessionMessageProcessed extends MessageProcessedSupport implem
if (timestamp != null) { if (timestamp != null) {
// Validate if the below method is ok // Validate if the below method is ok
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSX");
OffsetDateTime sessionDate = getOffsetDateTimeFromTimestampPython(timestamp); OffsetDateTime sessionDate = getOffsetDateTimeFromTimestampPython(timestamp);
if (sessionDate != null) { if (sessionDate != null) {
Session session = new Session(); Session session = new Session();
......
...@@ -115,16 +115,16 @@ spring: ...@@ -115,16 +115,16 @@ spring:
hikari.registerMbeans: true hikari.registerMbeans: true
security: security:
basepath: http://localhost:9077/bytebot basepath: http://192.168.1.6:9077/bytebot
provider: byte # oracle, amazon provider: byte # oracle, amazon
oauth2-client: oauth2-client:
clientId: xdf-client clientId: xdf-client
clientSecret: xdf-secret clientSecret: xdf-secret
accessTokenUri: http://192.168.1.6:18080/oauth/token accessTokenUri: http://127.0.0.1:18080/oauth/token
userAuthorizationUri: http://192.168.1.6:18080/oauth/authorize userAuthorizationUri: http://127.0.0.1:18080/oauth/authorize
oauth2-resource: oauth2-resource:
userInfoUri: http://192.168.1.6:18080/oauth/userinfo userInfoUri: http://127.0.0.1:18080/oauth/userinfo
logoutUri: http://192.168.1.6:18080/oauth/userlogout logoutUri: http://127.0.0.1:18080/oauth/userlogout
tenants: tenants:
- -
id: T186A1 id: T186A1
...@@ -142,16 +142,16 @@ spring: ...@@ -142,16 +142,16 @@ spring:
testWhileIdle: true testWhileIdle: true
hikari.registerMbeans: true hikari.registerMbeans: true
security: security:
basepath: http://localhost:9077/bytebot basepath: http://192.168.1.6:9077/bytebot
provider: byte # oracle, amazon provider: byte # oracle, amazon
oauth2-client: oauth2-client:
clientId: xdf-client clientId: xdf-client
clientSecret: xdf-secret clientSecret: xdf-secret
accessTokenUri: http://192.168.1.6:18080/oauth/token accessTokenUri: http://127.0.0.1:18080/oauth/token
userAuthorizationUri: http://192.168.1.6:18080/oauth/authorize userAuthorizationUri: http://127.0.0.1:18080/oauth/authorize
oauth2-resource: oauth2-resource:
userInfoUri: http://192.168.1.6:18080/oauth/userinfo userInfoUri: http://127.0.0.1:18080/oauth/userinfo
logoutUri: http://192.168.1.6:18080/oauth/userlogout logoutUri: http://127.0.0.1:18080/oauth/userlogout
jpa: jpa:
......
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
<select id="avgFirstResponseTime" resultType="Long" flushCache="true"> <select id="avgFirstResponseTime" resultType="Long" flushCache="true">
SELECT AVG(RESP_TIME) SELECT AVG(RESP_TIME)
FROM ( FROM (
select TIMESTAMPDIFF(SECOND, SESSION_DATE, SESSION_FRDAT) AS RESP_TIME select TIMESTAMPDIFF(MICROSECOND, SESSION_DATE, SESSION_FRDAT)/1000 AS RESP_TIME
from AVB_SESSION bs WHERE SESSION_FRDAT IS NOT NULL from AVB_SESSION bs WHERE SESSION_FRDAT IS NOT NULL
AND SESSION_DATE &lt;= #{endDate} AND SESSION_DATE &lt;= #{endDate}
AND SESSION_DATE &gt;= #{startDate} AND SESSION_DATE &gt;= #{startDate}
) RESPONSE_DIF ) RESPONSE_DIF
</select> </select>
</mapper> </mapper>
...@@ -34,13 +34,10 @@ ...@@ -34,13 +34,10 @@
<select id="avgFirstResponseTime" resultType="Double" flushCache="true"> <select id="avgFirstResponseTime" resultType="Double" flushCache="true">
SELECT AVG(RESP_TIME) SELECT AVG(RESP_TIME)
FROM ( FROM (
SELECT ((DATE_PART('day', SESSION_FRDAT - SESSION_DATE) * 24 + SELECT DATE_PART('milliseconds', SESSION_FRDAT - SESSION_DATE) AS RESP_TIME
DATE_PART('hour', SESSION_FRDAT - SESSION_DATE)) * 60 + from AVB_SESSION bs WHERE SESSION_FRDAT IS NOT null
DATE_PART('minute', SESSION_FRDAT - SESSION_DATE)) * 60 + AND SESSION_DATE &lt;= #{endDate}
DATE_PART('second', SESSION_FRDAT - SESSION_DATE) AS RESP_TIME AND SESSION_DATE &gt;= #{startDate}
from AVB_SESSION bs WHERE SESSION_FRDAT IS NOT null
AND SESSION_DATE &lt;= #{endDate}
AND SESSION_DATE &gt;= #{startDate}
) RESPONSE_DIF ) RESPONSE_DIF
</select> </select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment