Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ejercicio2-framework-back
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Josue
ejercicio2-framework-back
Commits
bfe18190
Commit
bfe18190
authored
Nov 23, 2021
by
Cristian Aguirre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 'Tiempo de primera respuesta' chart
parent
83408ffc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
27 deletions
+26
-27
MessageProcessedSupport.java
.../bytesw/bytebot/etl/services/MessageProcessedSupport.java
+6
-6
StartSessionMessageProcessed.java
...sw/bytebot/etl/services/StartSessionMessageProcessed.java
+2
-0
application.yml
src/main/resources/application.yml
+10
-10
SessionMapper.xml
.../resources/config/mappers/bytebot/mysql/SessionMapper.xml
+4
-4
SessionMapper.xml
...sources/config/mappers/bytebot/postgres/SessionMapper.xml
+4
-7
No files found.
src/main/java/com/bytesw/bytebot/etl/services/MessageProcessedSupport.java
View file @
bfe18190
...
@@ -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
;
}
}
...
...
src/main/java/com/bytesw/bytebot/etl/services/StartSessionMessageProcessed.java
View file @
bfe18190
...
@@ -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
();
...
...
src/main/resources/application.yml
View file @
bfe18190
...
@@ -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://1
92.168.1.6
:18080/oauth/token
accessTokenUri
:
http://1
27.0.0.1
:18080/oauth/token
userAuthorizationUri
:
http://1
92.168.1.6
:18080/oauth/authorize
userAuthorizationUri
:
http://1
27.0.0.1
:18080/oauth/authorize
oauth2-resource
:
oauth2-resource
:
userInfoUri
:
http://1
92.168.1.6
:18080/oauth/userinfo
userInfoUri
:
http://1
27.0.0.1
:18080/oauth/userinfo
logoutUri
:
http://1
92.168.1.6
:18080/oauth/userlogout
logoutUri
:
http://1
27.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://1
92.168.1.6
:18080/oauth/token
accessTokenUri
:
http://1
27.0.0.1
:18080/oauth/token
userAuthorizationUri
:
http://1
92.168.1.6
:18080/oauth/authorize
userAuthorizationUri
:
http://1
27.0.0.1
:18080/oauth/authorize
oauth2-resource
:
oauth2-resource
:
userInfoUri
:
http://1
92.168.1.6
:18080/oauth/userinfo
userInfoUri
:
http://1
27.0.0.1
:18080/oauth/userinfo
logoutUri
:
http://1
92.168.1.6
:18080/oauth/userlogout
logoutUri
:
http://1
27.0.0.1
:18080/oauth/userlogout
jpa
:
jpa
:
...
...
src/main/resources/config/mappers/bytebot/mysql/SessionMapper.xml
View file @
bfe18190
...
@@ -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
<
= #{endDate}
AND SESSION_DATE
<
= #{endDate}
AND SESSION_DATE
>
= #{startDate}
AND SESSION_DATE
>
= #{startDate}
) RESPONSE_DIF
) RESPONSE_DIF
</select>
</select>
</mapper>
</mapper>
src/main/resources/config/mappers/bytebot/postgres/SessionMapper.xml
View file @
bfe18190
...
@@ -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
<
= #{endDate}
DATE_PART('second', SESSION_FRDAT - SESSION_DATE) AS RESP_TIME
AND SESSION_DATE
>
= #{startDate}
from AVB_SESSION bs WHERE SESSION_FRDAT IS NOT null
AND SESSION_DATE
<
= #{endDate}
AND SESSION_DATE
>
= #{startDate}
) RESPONSE_DIF
) RESPONSE_DIF
</select>
</select>
</mapper>
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment