Welcome!



I am the monitor-server. I will assist you in querying and storing your pytest-monitor runs results.
I provide

To exploit me:
  1. Use the REST API I provide to read data
    Consult my endpoints
  2. Use the Monitor API
    Read the docs here



Statistics


Extracting metrics


Synopsis

List all stored metrics the monitor-server instance has access to.

/api/v1/metrics/

Parameters
Attribute Type Required Description
page integer No Directly jump to the requested page. The following semantic is supported for the page parameter:
  • if page is provided as a positive number, the page whose index matches the requested value is returned
  • if page is given as a negative number, then, negative index is used, meaning that pages are indexed from the end.
Values
Attribute Type Required Description
session_h string Yes Session id attached to the test
ctx_h string Yes Context id attached to the test
item_start_time string Yes Effective start time of the test. Format: iso8681
item_path string Yes Item path using python import spectification.
item string Yes Qualified name of the test
item_variant string Yes Fully qualified name of the test (with parametrization info)
item_fs_loc string Yes Relative path from pytest invocation directory to the item's module
kind string Yes Item type (function, module, ...)
component string Yes Logical entity to which the test belong (user defined).
wall_time float Yes Total time spent running the test (in seconds)
user_time string Yes Total time spent running in user space (in seconds).
krnl_time string Yes Total time spent running in kernel space (in seconds).
cpu_usage string Yes Percentage of CPU used while the test ran
mem_usage string Yes Memory used while running the test (in MB).
Scenario

You have monitored some tests, and now you want to read collected metrics.

For doing so, let's introduce the Monitor object. It will be your only entry point to every interaction with either your remote server or a local database.

import monitor_api.monitor import Monitor URL = '{{request.url_root}}' mon = Monitor(URL) # Intermediate collection of entities. Useful for raw manipulation. collection_of_metrics = mon.list_metrics() # Convertion to pandas.Dataframe. Useful for in-depth analysis and plotting. df = collection_of_metrics.to_df()
The Monitor object uses a small semantic around actions you can perform:
  • count is used to obtain integers and roughly aims at counting entities.
  • count aims at providing an exhaustive listing of entities for specific resources such as components, variants and so on.
  • count get is used to obtain a fully described, single entity

With the help of curl and jq
bash $> curl -X GET {{request.url_root}}api/v1/metrics/ | jq { "metrics": [ { "session_h": "0041724ff4e0adac62b70b4f810c79fc5ad8ba5b", "context_h": "e9188c68dd9ddeccd0a2f59422d16a2bf7337683", "item_start_time": "2020-12-04T23:18:15.661016", "item_path": "tests.test_file", "item": "test_that", "item_variant": "test_that[]", "item_fs_loc": "tests/test_file.py", "kind": "function", "component": "test_component", "total_time": 10, "user_time": 2.4, "kernel_time": 0.1, "cpu_usage": 35.68, "mem_usage": 56.87 } ], "prev_url": "/api/v1/metrics/?page=1", "next_url": "/api/v1/metrics/?page=3", "total_page": 3 }

Extracting sessions




Synopsis

List all stored sessions the monitor-server instance has access to.

/api/v1/sessions/

Parameters
Attribute Type Required Description
page integer No Directly jump to the requested page. The following semantic is supported for the page parameter:
  • if page is provided as a positive number, the page whose index matches the requested value is returned
  • if page is given as a negative number, then, negative index is used, meaning that pages are indexed from the end.
Values
Attribute Type Required Description
h string Yes Session identifier.
run_date string Yes Date and time when test session has started. Format: iso8601.
scm_ref string No Reference to the SCM if any.
description string Yes Dictionary of tags:
  • All elements are of type string.
  • Only dictionaries with a depth of 1 are accepted.
Scenario

You have monitored some tests, and now you want to extract all test sessions.

For doing so, let's introduce the Monitor object. It will be your only entry point to every interaction with either your remote server or a local database.

import monitor_api.monitor import Monitor URL = '{{request.url_root}}' mon = Monitor(URL) # Intermediate collection of entities. Useful for raw manipulation. collection_of_session = mon.list_sessions() # Convertion to pandas.Dataframe. Useful for in-depth analysis and plotting. df = collection_of_session.to_df()
The Monitor object uses a small semantic around actions you can perform:
  • count is used to obtain integers and roughly aims at counting entities.
  • count aims at providing an exhaustive listing of entities for specific resources such as components, variants and so on.
  • count get is used to obtain a fully described, single entity

With the help of curl and jq
bash $> curl -X GET {{request.url_root}}api/v1/metrics/ | jq { "sessions": [ { "session_h": "0041724ff4e0adac62b70b4f810c79fc5ad8ba5b", "run_date": "2020-12-04T23:18:15.661016", "run_date": "4914d195225cf6b1c5a160c555b6948ea1ba2bcd", "tags": [ { "key" : "numpy" , "value" : "1.18.2" , } ] }, ], "prev_url": "/api/v1/sessions/?page=1", "next_url": "/api/v1/sessions/?page=3", "total_page": 3 }

Extracting contexts


Synopsis

List all stored execution contexts the monitor-server instance has access to.

/api/v1/contexts/

Parameters
Attribute Type Required Description
page integer No Directly jump to the requested page. The following semantic is supported for the page parameter:
  • if page is provided as a positive number, the page whose index matches the requested value is returned
  • if page is given as a negative number, then, negative index is used, meaning that pages are indexed from the end.
Values
Attribute Type Required Description
h string Yes Context id attached to the test
cpu_count integer Yes Number of CPUs available on the host
cpu_frequency integer Yes Nominal frequency of CPUs, in MHz
cpu_type string Yes Architecture of the CPU
cpu_vendor string No Information string about the CPU constructor
ram_total integer Yes Total amount of RAM available, in MB
mac_node string Yes Fully Qualified Domain Name (FQDN) of the machine.
mac_type string Yes Machine architecture.
sys_info string Yes Short string about current OS level.
py_info float Yes Short string about the python interpreter used during your tests.
Scenario

You have monitored some tests, and now you want to extract information about the machines used.

For doing so, let's introduce the Monitor object. It will be your only entry point to every interaction with either your remote server or a local database.

import monitor_api.monitor import Monitor URL = '{{request.url_root}}' mon = Monitor(URL) # Intermediate collection of entities. Useful for raw manipulation. collection_of_contexts = mon.list_contexts() # Convertion to pandas.Dataframe. Useful for in-depth analysis and plotting. df = collection_of_contexts.to_df()
The Monitor object uses a small semantic around actions you can perform:
  • count is used to obtain integers and roughly aims at counting entities.
  • count aims at providing an exhaustive listing of entities for specific resources such as components, variants and so on.
  • count get is used to obtain a fully described, single entity

With the help of curl and jq
bash $> curl -X GET {{request.url_root}}api/v1/metrics/ | jq { "contexts": [ { "h": "0041724ff4e0adac62b70b4f810c79fc5ad8ba5b", "cpu_count": 8, "cpu_frequency": 2500, "cpu_type": "i386", "cpu_vendor": "", "ram_total": 16384, "machine_node": "host.name.org", "machine_type": "x86_64", "machine_arch": "64bit", "system_info": "Linux - 3.10.0-693.el7.x86_64", "python_info": "3.6.10 packaged by conda-forge", } ], "prev_url": "/api/v1/contexts/?page=1", "next_url": "/api/v1/contexts/?page=3", "total_page": 3 }