Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
slapos
Commits
dba3cfe7
Commit
dba3cfe7
authored
Nov 07, 2023
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5/test/benchmarks: record InnoDB and MariaDB metrics.
parent
04c5315e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
software/erp5/test/test/benchmarks.py
software/erp5/test/test/benchmarks.py
+30
-0
No files found.
software/erp5/test/test/benchmarks.py
View file @
dba3cfe7
...
...
@@ -37,6 +37,7 @@ import urllib.parse
import
psutil
import
requests
import
MySQLdb
from
.
import
ERP5InstanceTestCase
,
default
,
matrix
,
setUpModule
from
.test_erp5
import
ZopeSkinsMixin
...
...
@@ -141,6 +142,24 @@ class TestOrderBuildPackingListSimulation(
text
=
True
),
})
def
getDatabaseConnection
(
self
):
connection_parameter_dict
=
json
.
loads
(
self
.
computer_partition
.
getConnectionParameterDict
()[
'_'
])
db_url
=
urllib
.
parse
.
urlparse
(
connection_parameter_dict
[
'mariadb-database-list'
][
0
])
self
.
assertEqual
(
'mysql'
,
db_url
.
scheme
)
self
.
assertTrue
(
db_url
.
path
.
startswith
(
'/'
))
database_name
=
db_url
.
path
[
1
:]
return
MySQLdb
.
connect
(
user
=
db_url
.
username
,
passwd
=
db_url
.
password
,
host
=
db_url
.
hostname
,
port
=
db_url
.
port
,
db
=
database_name
,
use_unicode
=
True
,
charset
=
'utf8mb4'
,
)
def
write_measurement
(
self
,
measurement
:
dict
[
str
,
typing
.
Union
[
str
,
float
]])
->
None
:
json
.
dump
(
...
...
@@ -184,6 +203,15 @@ class TestOrderBuildPackingListSimulation(
zeo_root_stats
=
zeo_stats
.
pop
(
'root'
)
assert
not
zeo_stats
# InnoDB/MariaDB metrics
with
contextlib
.
closing
(
self
.
getDatabaseConnection
())
as
cnx
:
cursor
=
cnx
.
cursor
(
MySQLdb
.
cursors
.
DictCursor
)
cursor
.
execute
(
'SELECT * FROM information_schema.INNODB_METRICS'
)
innodb_metrics
=
{
r
[
'NAME'
]:
r
[
'COUNT'
]
for
r
in
cursor
.
fetchall
()
if
r
.
get
(
'ENABLED'
)
or
r
.
get
(
'STATUS'
)
==
'enabled'
}
cursor
.
execute
(
'SHOW GLOBAL STATUS'
)
mariadb_metrics
=
{
r
[
'Variable_name'
]:
r
[
'Value'
]
for
r
in
cursor
.
fetchall
()}
self
.
logger
.
info
(
"Measurements for %s (after %s): "
"elapsed=%s zope_total_rss=%s / %s root_fs_size=%s"
,
...
...
@@ -203,6 +231,8 @@ class TestOrderBuildPackingListSimulation(
'zope_count'
:
zope_count
,
'root_fs_size'
:
root_fs_size
,
'zeo_stats'
:
zeo_root_stats
,
'innodb_metrics'
:
innodb_metrics
,
'mariadb_metrics'
:
mariadb_metrics
,
'now'
:
str
(
now
),
})
...
...
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