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