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
Labels
Merge Requests
105
Merge Requests
105
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
11f38552
Commit
11f38552
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
8a2f83cb
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 @
11f38552
...
@@ -37,6 +37,7 @@ import urllib.parse
...
@@ -37,6 +37,7 @@ import urllib.parse
import
psutil
import
psutil
import
requests
import
requests
import
MySQLdb
from
.
import
ERP5InstanceTestCase
,
default
,
matrix
,
setUpModule
from
.
import
ERP5InstanceTestCase
,
default
,
matrix
,
setUpModule
from
.test_erp5
import
ZopeSkinsMixin
from
.test_erp5
import
ZopeSkinsMixin
...
@@ -141,6 +142,24 @@ class TestOrderBuildPackingListSimulation(
...
@@ -141,6 +142,24 @@ class TestOrderBuildPackingListSimulation(
text
=
True
),
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
(
def
write_measurement
(
self
,
measurement
:
dict
[
str
,
typing
.
Union
[
str
,
float
]])
->
None
:
self
,
measurement
:
dict
[
str
,
typing
.
Union
[
str
,
float
]])
->
None
:
json
.
dump
(
json
.
dump
(
...
@@ -184,6 +203,15 @@ class TestOrderBuildPackingListSimulation(
...
@@ -184,6 +203,15 @@ class TestOrderBuildPackingListSimulation(
zeo_root_stats
=
zeo_stats
.
pop
(
'root'
)
zeo_root_stats
=
zeo_stats
.
pop
(
'root'
)
assert
not
zeo_stats
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
(
self
.
logger
.
info
(
"Measurements for %s (after %s): "
"Measurements for %s (after %s): "
"elapsed=%s zope_total_rss=%s / %s root_fs_size=%s"
,
"elapsed=%s zope_total_rss=%s / %s root_fs_size=%s"
,
...
@@ -203,6 +231,8 @@ class TestOrderBuildPackingListSimulation(
...
@@ -203,6 +231,8 @@ class TestOrderBuildPackingListSimulation(
'zope_count'
:
zope_count
,
'zope_count'
:
zope_count
,
'root_fs_size'
:
root_fs_size
,
'root_fs_size'
:
root_fs_size
,
'zeo_stats'
:
zeo_root_stats
,
'zeo_stats'
:
zeo_root_stats
,
'innodb_metrics'
:
innodb_metrics
,
'mariadb_metrics'
:
mariadb_metrics
,
'now'
:
str
(
now
),
'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