Api Reference¶
Fields and Enums¶
-
class
monitor_api.
ResourceMethod
¶ Represents a sorting method.
- LOWEST
sort in ascending order
- TOP
sort in descending order
-
class
monitor_api.
ResourceType
¶ The different types of probed resources.
- TOTAL_TIME
Real elapsed time
- USER_TIME
Time spent running in user mode.
- KERNEL_TIME
Time spent running in kernel mode.
- CPU
Amount of CPU used
- MEMORY
Amount of memory used
-
class
monitor_api.
MetricScope
¶ Represent the level at which pytest-monitor collects and aggregate data.
- FUNCTION
Metrics collected for a single test function
- MODULE
Metrics collected at module level
- PACKAGE
Metrics collected at package level (not working yet)
-
class
monitor_api.
Field
¶ Fields that can be used to control collections export.
- SESSION_H
Session identifier
- CONTEXT_H
Context identifier
- ITEM_START_TIME
UTC Time at which the item has been run
- ITEM_PATH
Python path like to the item
- ITEM
Test identifier
- ITEM_VARIANT
Fully qualified test identifier
- ITEM_FS_LOC
Path to the python file hosting the test item.
- KIND
Test scope
- COMPONENT
Component or project to which the test belong.
- TOTAL_TIME
Total time spent running the test
- USER_TIME
Time spent in user mode while running the test.
- KERNEL_TIME
Time spent in kernel mode while running the test
- CPU_USAGE
Cpu usage while running the test.
- MEM_USAGE
Memory usage of the test.
- H
Session/Context identifier.
- SCM
Source Code Management reference
- RUN_DATE
Session start date
- TAGS
Session description tags
- CPU_COUNT
Number of CPU
- CPU_FREQUENCY_MHZ
Max frequency of CPUs
- CPU_TYPE
Cpu types (x64, …)
- CPU_VENDOR
CPU Vendor
- RAM_TOTAL_MB
Amount of RAM on the machine
- MACHINE_NODE
Fully qualified domain name
- MACHINE_TYPE
Machine type
- MACHINE_ARCH
Machine architecture
- SYSTEM_INFO
Basic information about the kernel.
- PYTHON_INFO
Basic information about the interpreter.
Entities¶
-
class
monitor_api.core.entities.
Context
(h: str = None, cpu_count: int = None, cpu_freq: int = None, cpu_type: str = None, cpu_vendor: str = None, ram_total: int = None, mac_node: str = None, mac_type: str = None, mac_arch: str = None, sys_info: str = None, py_info: str = None)¶ Single execution context record. This is basically the machine which executed tests.
- Parameters
h (str) – Context identifier.
cpu_count (int) – Number of CPU on the machine
cpu_freq (int) – Nominal frequency of the CPI
cpu_type (str) – Architecture of the CPU
cpu_vendor (str) – The CPU Vendor. Optional.
ram_total (int) – Total amount of physical RAM available on the machine.
mac_node (str) – Fully qualified domain name of the machine.
mac_type (str) – Machine/OS type
mac_arch (str) – Machine architecture (32 or 64bits)
sys_info (str) – OS kernel information.
py_info (str) – Python information.
-
property
cpu_count
¶ Total number of CPU on the machine.
- Returns
The number of CPU on the machine
- Return type
int
-
property
cpu_freq
¶ Nominal CPU frequency on the machine. Expressed in MHz
- Returns
The CPU frequency expressed in MHz.
- Return type
int
-
property
cpu_type
¶ Architecture of the CPU.
- Returns
Architecture identifier string.
- Return type
str
-
property
cpu_vendor
¶ CPU model name, as provided by vendor.
- Returns
CPU brand name
- Return type
str
-
property
h
¶ Context identifier. Unique across all contexts. If two identifiers share the same value, it means that they point to objects with similar values.
- Returns
A unique key for referencing this context.
- Return type
str
-
property
machine_arch
¶ The machine architecture (32 or 64 bits).
- Returns
the machine bitmode.
- Return type
str
-
property
machine_node
¶ The machine fully qualified domain name.
- Returns
the machine hostname.
- Return type
str
-
property
machine_type
¶ The machine type details the instruction set supported by the processor.
- Returns
the machine type.
- Return type
str
-
property
python_info
¶ A string detailing some information about the version of Python used for testing. Can explain how the interpreter has been compiled, on which system and when.
- Returns
A informative string about the python interpreter.
- Return type
str
-
property
sys_info
¶ A string detailing some information about the OS kernel. Can explain the exact version of the kernel.
- Returns
A informative string about the OS kernel.
- Return type
str
-
to_dict
(keep: List[monitor_api.enums.Field] = None, drop: List[monitor_api.enums.Field] = None) → dict¶ Convert the instance to a dictionary for further use. You can control which field will be exported using a keep/drop approach. Note that controlling the export can only be done using either keep or drop parameter.
- Parameters
keep (list(monitor_api.Field)) – List of field to keep. Use it if the field you want to focus on is small.
drop (list(monitor_api.Field)) – List of field to drop. Use it if the field you want to focus on is long.
- Returns
A dictionary containing members whitelisted for export
- Return type
dict
-
property
total_ram
¶ Total amount of RAM available on the machine, expressed in MB.
- Returns
The amount of RAM (in MB)
- Return type
int
-
class
monitor_api.core.entities.
Metric
(context_h: str = None, session_h: str = None, start_time: str = None, item_path: str = None, item: str = None, variant: str = None, path: str = None, kind: monitor_api.enums.MetricScope = None, component: str = None, wall_time: float = None, user_time: float = None, kernel_time: float = None, cpu_usage: float = None, memory_usage: float = None)¶ Basic metric record.
- Parameters
context_h (str) – Context identifier.
session_h (str) – Session identifier.
start_time – Time at which the metrics have been registered (in ISO format).
item_path (str) – Python like path to the item (with eventual modules).
item (str) – Test item name.
variant (str) – Full item qualified identifier.
path (str) – Path on the filesystem to the module containing the test item.
kind (str) – Metric’s scope (function, module).
component (str) – Logical system to which the test belongs.
wall_time (float) – Total time spent running the test.
user_time (float) – Time spent running the test in user mode.
kernel_time (float) – Time spent running the test in kernel mode.
cpu_usage (float) – Cpu usage while running the test.
memory_usage (float) – Total memory used by the test.
-
property
component
¶ Retrieves the test component. Components can be viewed as a logical system representing an application or a subsystem.
- Returns
the test’s component name.
- Return type
str
-
property
context
¶ Retrieves the context identifier linked to this metric.
- Returns
A context identifier
- Return type
str
-
property
cpu_usage
¶ Retrieves the cpu usage (in percentage) of the test.
- Example
0.6577 means 65.77 % use of a single CPU.
3.768 means 3 CPU at 100 % plus another one at 76.8 %.
- Returns
The test’s cpu usage.
- Return type
float
-
hash
()¶ Emulate hash key to avoid the same metric to be inserted multiple times in Metrics resource (useful for some entry points).
- Returns
A hash key that uniquely identifies the test.
- Return type
str
-
is_function
()¶ Test if the metric scope is positioned to FUNCTION.
- Returns
True if the metric concerns a test function
- Return type
bool
-
is_module
()¶ Test if the metric scope is positioned to MODULE.
- Returns
True if the metric concerns a test module
- Return type
bool
-
is_package
()¶ Test if the metric scope is positioned to PACKAGE.
- Returns
True if the metric concerns a test package
- Return type
bool
-
property
item
¶ Retrieves the test item name. If you want the test identifier, you should rather consider variant. Note that this might not be sufficient if multiple components have items named the same way.
- Returns
The test item.
- Return type
str
-
property
item_path
¶ Python path like string to the object.
- Returns
An import path
- Return type
str
-
property
kernel_time
¶ Retrieves the amount of time spent running in kernel mode. The unit is the second.
- Returns
Time spent running in kernel mode.
- Return type
float
-
property
memory_usage
¶ Retrieves the amount of memory used by the test. The unit is the MB.
- Returns
Memory used (in MB)
- Return type
float
-
property
path
¶ Retrieves the test path relatively to current working directory where pytest has run.
- Returns
A path
- Return type
str
-
property
run_time
¶ Provide the time at which the metrics have been measured.
- Returns
A date time expressed in UTC Coordinates.
- Return type
datetime.datetime
-
property
scope
¶ Retrieves the metrics scope (function, module or package).
- Returns
the test scope
- Return type
monitor_api.MetricScope
-
property
session
¶ Retrieves the session identifier linked to this metric.
- Returns
A session identifier
- Return type
str
-
to_dict
(keep: List[monitor_api.enums.Field] = None, drop: List[monitor_api.enums.Field] = None) → dict¶ Convert the instance to a dictionary for further use. You can control which field will be exported using a keep/drop approach. Note that controlling the export can only be done using either keep or drop parameter.
- Parameters
keep (list(monitor_api.Field)) – List of field to keep. Use it if the field you want to focus on is small.
drop (list(monitor_api.Field)) – List of field to drop. Use it if the field you want to focus on is long.
- Returns
A dictionary containing members whitelisted for export.
- Return type
dict
-
property
user_time
¶ Retrieves the amount of time spent running the test in user mode. The unit is the second.
- Returns
Time spent running in user mode.
- Return type
float
-
property
variant
¶ Retrieves the fully qualified test name, including parameter values if any.
- Returns
A test identifier
- Return type
str
-
property
wall_time
¶ Retrieves the total, real time spent running the test. The unit is the second.
- Returns
Time spent running the test.
- Return type
float
-
class
monitor_api.core.entities.
Session
(h: str = None, scm_ref: str = None, run_date: str = None, tags: Union[Dict[str, str], List[Dict[str, str]], None] = None)¶ A session record. Contains SCM reference, start date and tags.
- Parameters
h (str) – session identifier
scm_ref (str) – Source code management reference
run_date (str) – Date time at which the session has been started.
tags (dict) – Additional tags used for identifying special run conditions.
-
property
h
¶ Session identifier. Unique across all sessions. If two identifiers share the same value, it means that they point to objects with similar values.
- Returns
A unique key for referencing this session.
- Return type
str
-
property
scm
¶ SCM reference to the code which have been executed.
- Returns
A SCM reference
- Return type
str
-
property
start_date
¶ Retrieve the start date at which the test session has started.
- Returns
A datetime object positioned at the time the session started.
- Return type
datetime.datetime
Retrieves all tags set on this session. All tags have their values represented as string.
- Returns
A dictionary with key as tags and values as tag’s value.
- Return type
dict[str, str]
-
to_dict
(keep: List[monitor_api.enums.Field] = None, drop: List[monitor_api.enums.Field] = None, expand_tags: bool = False) → dict¶ Convert the instance to a dictionary for further use. You can control which field will be exported using a keep/drop approach. Tags can be exported using an expand strategy and if requested, each tag is exported as if it was a real session field. This means that the final dictionary will have a depth of 1. Otherwise, tags will be grouped under a ‘tags’ element thus giving access to a sub dictionary containing all tags and only all tags. In this case, the final dictionary will have a depth of 2.
Note that controlling the export can only be done using either keep or drop parameter.
- Parameters
keep (list(monitor_api.Field)) – List of field to keep. Use it if the field you want to focus on is small.
drop (list(monitor_api.Field)) – List of field to drop. Use it if the field you want to focus on is long.
expand_tags (bool) – control how tags are exported. If set to True, tags will be exported like other session members.
- Returns
A dictionary containing members whitelisted for export
- Return type
dict
Collections¶
-
class
monitor_api.core.collections.
Contexts
(**kwargs)¶ Dict like structure for manipulating monitor_api.core.entities.Context objects.
-
add
(context: monitor_api.core.entities.Context) → monitor_api.core.entities.Context¶ Add a context object to this collection.
- Parameters
context (monitor_api.core.entities.Context) – Context object to add. As for dictionaries, overwrites any existing entry with equivalent hash.
- Returns
The object which have been added
- Return type
-
filter_with
(cond: Callable[[monitor_api.core.entities.Context], bool], inplace: bool = False)¶ Apply a filter to the bag of monitor_api.core.entities.Context held by the instance calling this method. Only monitor_api.core.entities.Context objects matching the condition method are kept.
- Parameters
cond (Callable[[monitor_api.core.entities.Context], bool]) – A callable returning a boolean (True means keep) with a unique parameter of type monitor_api.core.entities.Context
inplace (bool) – If True, change the content of this instance by keeping only values for which cond is True
- Returns
The object itself
- Return type
monitor_api.core.collections.Contexts
-
to_df
(keep: List[monitor_api.enums.Field] = None, drop: List[monitor_api.enums.Field] = None) → pandas.core.frame.DataFrame¶ Turn a collection of monitor_api.core.entities.Context into a pandas DataFrame.
You can keep or drop a given list of monitor_api.Field by specifying either keep or drop as a parameter. If both are provided, keep will be used instead of drop.
- Parameters
keep (list(monitor_api.Field)) – List of field to keep during the export. Cannot be used conjointly with drop
drop (list(monitor_api.Field)) – List of field to keep during the export. Cannot be used conjointly with keep
- Returns
A valid pandas DataFrame object representing the collection of this instance, without any index set minus eventual information that might have been marked as dropped.
- Return type
pandas.DataFrame
-
-
class
monitor_api.core.collections.
Metrics
(initlist=None)¶ -
filter_with
(cond: Callable[[monitor_api.core.entities.Metric], bool], inplace: bool = False)¶ Apply a filter to the bag of monitor_api.core.entities.Metric held by the instance calling this method. Only monitor_api.core.entities.Metric objects matching the condition method are kept.
- Parameters
cond (Callable[[monitor_api.core.entities.Metric], bool]) – A callable returning a boolean (True means keep) with a unique parameter of type monitor_api.core.entities.Metric
inplace (bool) – If True, change the content of this instance by keeping only values for which cond is True
- Returns
The object itself
- Return type
monitor_api.core.collections.Metrics
-
static
merge
(metric_collection_r, metric_collection_l)¶ Merge two collection of metrics and ensure that no duplicate remains in the resulting collection.
- Parameters
metric_collection_r (monitor_api.core.collections.Metrics) – First collection to merge
metric_collection_l (monitor_api.core.collections.Metrics) – Second collection to merge
- Returns
A new collection without duplicates.
- Return type
-
to_df
(sessions: monitor_api.core.collections.Sessions = None, contexts: monitor_api.core.collections.Contexts = None, keep: List[monitor_api.enums.Field] = None, drop: List[monitor_api.enums.Field] = None) → pandas.core.frame.DataFrame¶ Turn a collection of monitor_api.core.entities.Session into a pandas DataFrame.
You can keep or drop a given list of monitor_api.Field by specifying either keep or drop as a parameter. If both are provided, keep will be used instead of drop.
- Parameters
sessions –
contexts –
keep (list(monitor_api.Field)) – List of field to keep during the export. Cannot be used conjointly with drop
drop (list(monitor_api.Field)) – List of field to keep during the export. Cannot be used conjointly with keep
- Returns
A valid pandas DataFrame object representing the collection of this instance, without any index set minus eventual information that might have been marked as dropped.
- Return type
pandas.DataFrame
-
unique
(inplace: bool = False)¶ Filter the collection so that no duplicated metric remains.
- Parameters
inplace (bool) – Modify this collection so that duplicates are removed.
- Returns
A new collection without duplicates.
- Return type
-
variants_of
(item: str)¶ Performs a filter operation in order to get a new collection with only metric objects regarding any variant of the provided item.
- Parameters
item (str) – The test item for which you want to collect all variants known by this collection.
- Returns
A new Metrics object holding only metrics concerning a variant of the provided item.
- Return type
-
-
class
monitor_api.core.collections.
Sessions
(**kwargs)¶ -
add
(session: monitor_api.core.entities.Session) → monitor_api.core.entities.Session¶ Add a session object to this collection.
- Parameters
session (monitor_api.core.entities.Session) – Session object to add. As for dictionaries, overwrites any existing entry with equivalent hash.
- Returns
The object which have been added
- Return type
-
filter_with
(cond: Callable[[monitor_api.core.entities.Session], bool], inplace: bool = False)¶ Apply a filter to the bag of monitor_api.core.entities.Session held by the instance calling this method. Only monitor_api.core.entities.Session objects matching the condition method are kept.
- Parameters
cond (Callable[[monitor_api.core.entities.Session], bool]) – A callable returning a boolean (True means keep) with a unique parameter of type monitor_api.core.entities.Session
inplace (bool) – If True, change the content of this instance by keeping only values for which cond is True
- Returns
The object itself
- Return type
monitor_api.core.collections.Sessions
-
to_df
(keep: List[monitor_api.enums.Field] = None, drop: List[monitor_api.enums.Field] = None) → pandas.core.frame.DataFrame¶ Turn a collection of monitor_api.core.entities.Session into a pandas DataFrame.
You can keep or drop a given list of monitor_api.Field by specifying either keep or drop as a parameter. If both are provided, keep will be used instead of drop. Tags are exported (if requested) using the expand strategy (see monitor_api.core.entities.Session.to_dict for more details)
- Parameters
keep (list(monitor_api.Field)) – List of field to keep during the export. Cannot be used conjointly with drop
drop (list(monitor_api.Field)) – List of field to keep during the export. Cannot be used conjointly with keep
- Returns
A valid pandas DataFrame object representing the collection of this instance, without any index set minus eventual information that might have been marked as dropped.
- Return type
pandas.DataFrame
-
with_scm
(scm: str)¶ Performs a filter operation in order to get a new collection with only session objects with the requested source code reference.
- Parameters
scm (str) – The source code reference to use for filter operation
- Returns
A new Sessions object holding only sessions with scm reference set to the requested one.
- Return type
Performs a filter operation in order to get a new collection with only session objects with the requested tag specification. You can query for tag presence and/or tag value
- Parameters
args (list[str]) – The list of tags to query for presence
kwargs – Dictionary of tags to query for their values.
- Returns
A new Sessions object holding only sessions matching the specified tag requirements.
- Return type
-
Monitor¶
-
class
monitor_api.monitor.
Monitor
(url: str, **kwargs)¶ Interface for manipulating your collected metrics either from a local storage or a remote server.
- Parameters
url (str) – The url to the server, or the path to the local database.
- Keyword Arguments for Remote server
Please refer to the requests’s Session . for more details
- Keyword Arguments for Local server
Please refer to sqlite3 connections for more details
-
count_components
() → int¶ Count total number of non empty components.
- Returns
The number of non empty components
- Return type
int
-
count_contexts
() → int¶ Count the number of context entries.
- Returns
The number of different context entries
- Return type
int
-
count_metrics
(session_h: str = None, context_h: str = None, scm_ref: str = None) → int¶ Count the number of metrics under some conditions. If no condition is set, the total number of metrics is computed. If session_h is set, count all metrics having session_h as session reference. Otherwise, if context_h is set, count all metrics having context_h as context reference. Otherwise, if scm_ref is set, count all metrics having a session pointing to this scm reference.
- Parameters
session_h (str) – A full session reference.
context_h (str) – A full context reference.
scm_ref (str) – A full scm reference.
- Returns
A number greater of equal to 0, -1 in case of access error.
- Return type
int
-
count_sessions
() → int¶ Count the number of session entries.
- Returns
The number of different session entries
- Return type
int
-
get_context
(context_h: str) → Optional[monitor_api.core.entities.Context]¶ Read and extract a single context object from a hash value.
- Parameters
context_h (str) – hash value of the context you wish to retrieve.
- Returns
A context object if there is a match between your hash key and accessed set of context, None otherwise.
- Return type
-
get_session
(session_h: str) → Optional[monitor_api.core.entities.Session]¶ Retrieve the session object having the given session reference.
- Parameters
session_h (str) – The full session reference
- Returns
A session object if the provided reference has a match, None otherwise.
- Return type
-
list_build_sessions
(pipeline: str, build_id: str) → monitor_api.core.collections.Sessions¶ Retrieve all sessions for the given pipeline and build identifier.
- Parameters
pipeline (str) – The pipeline identifier
build_id (str) – The build identifier
- Returns
All session objects for the given build.
- Return type
-
list_component_metrics
(component: Optional[str] = None) → monitor_api.core.collections.Metrics¶ Read for all metrics refering to the given component.
- Parameters
component (str) – Optional. Component name. If None, metrics without component will be searched for.
- Returns
A list of metrics, all of them having the requested component.
- Return type
-
list_component_pipeline_builds
(component: str, pipeline: str) → List[str]¶ Read for known build ids of a pipeline on a given component. This is handy if you want to filter out sessions for comparison purpose.
- Parameters
component (str) – Component for which this query must be done
pipeline (str) – Pipeline identifier
- Returns
The list of build ids affiliated with the pair pipeline/component
- Return type
list(str)
-
list_component_pipelines
(component: str) → List[str]¶ Read for known pipelines on a given component.
- Parameters
component (str) – Component for which this query must be done
- Returns
The list of pipelines affiliated with this component
- Return type
list(str)
-
list_components
() → List[str]¶ Read all non empty components.
- Returns
a list of non empty components
- Return type
list(str)
-
list_context_metrics
(context_h: str) → monitor_api.core.collections.Metrics¶ Read and extract all metrics having the given context hash value.
- Parameters
context_h (str) – hash value of the context you wish to retrieve.
- Returns
A list of metrics, all of which having their context key equal to the given context hash value.
- Return type
-
list_contexts
() → monitor_api.core.collections.Contexts¶ Read all contexts and extract them into a Dict like structure for further preprocessing. The reference key is their hash member.
- Returns
All contexts object referenced by their hash value.
- Return type
-
list_contexts_from
(metrics: monitor_api.core.collections.Metrics) → monitor_api.core.collections.Contexts¶ Retrieve all contexts referenced in the metrics set.
- Parameters
metrics (Metrics) – A set of metrics
- Returns
All context objects reference in your Metrics object.
- Return type
-
list_item_metrics
(item: str) → monitor_api.core.collections.Metrics¶ Read all metrics for the given test item, mixing variant metrics together if your test is parameterized.
- Parameters
item – the name of the test for which metrics must be retrieved.
- Rtype item
str
- Returns
A (possibly empty) list of metrics.
- Return type
-
list_metrics
() → monitor_api.core.collections.Metrics¶ Read all metrics.
- Returns
A (possibly empty) list of metrics.
- Return type
-
list_metrics_by_scm_id
(scm_ref: str) → monitor_api.core.collections.Metrics¶ Read all metrics having a session pointing to this scm reference.
- Parameters
scm_ref – Your entire scm reference
- Rtype scm_ref
str
- Returns
A (possibly empty) list of metrics.
- Return type
-
list_metrics_by_type
(metric_type: monitor_api.enums.MetricScope) → monitor_api.core.collections.Metrics¶ Read all metrics linked to the given type of metrics.
- Parameters
metric_type – the type of the test entity (function, module or package).
- Rtype metric_type
MetricType
- Returns
A (possibly empty) list of metrics.
- Return type
- Note
metric_type value package is not supported for now.
-
list_metrics_from
(sessions: monitor_api.core.collections.Sessions = None, contexts: monitor_api.core.entities.Context = None) → monitor_api.core.collections.Metrics¶ For sessions and contexts, retrieve all metrics referencing at least a session or a context.
- Parameters
- Returns
A (possibly empty) list of metrics
- Return type
-
list_metrics_from_pattern
(item: str = None, variant: str = None) → monitor_api.core.collections.Metrics¶ Read all metrics using a prefix expression on either the test function or its variant.
- Parameters
item – Prefix of your item. Leave it None if you want to focus on variants.
variant – Prefix of your variant. Leave it None if you want to focus on item.
- Rtype item
str
- Rtype variant
str
- Returns
A (possibly empty) list of metrics.
- Return type
-
list_metrics_of_variant
(variant: str, component: str = None) → monitor_api.core.collections.Metrics¶ Read all metrics for the given test variant, with ability to restrict the view with the component.
- Parameters
variant – the name of the test for which metrics must be retrieved.
component – Component name. Enables component restriction if set.
- Rtype variant
str
- Rtype component
str
- Returns
A (possibly empty) list of metrics.
- Return type
-
list_metrics_resources
(resource: monitor_api.enums.ResourceType, method: monitor_api.enums.ResourceMethod, max_element: int = 10) → monitor_api.core.collections.Metrics¶ Retrieve metrics having the higher (resp. lower) resource consumption accross the whole sets of metrics. Operates on at most 500 entries.
- Parameters
resource (ResourceType) – The resource you want to operate the extraction on.
method (ResourceType) – Indicate if you want greediest or most disciplined tests.
max_element (int) – Set the number of element you wish to retrieve. Default is 10.
- Returns
A (possibly empty) list of metrics.
- Return type
-
list_metrics_resources_from_build
(pipeline: str, build: str, resource: monitor_api.enums.ResourceType, method: monitor_api.enums.ResourceMethod, max_element: int = 10) → monitor_api.core.collections.Metrics¶ Retrieve metrics having the higher (resp. lower) resource consumption for a full build reference. Operates on at most 500 entries.
- Parameters
pipeline (str) – The pipeline name of the build.
build (str) – The build identifier
resource (ResourceType) – The resource you want to operate the extraction on.
method (ResourceType) – Indicate if you want greediest or most disciplined tests.
max_element (int) – Set the number of element you wish to retrieve. Default is 10.
- Returns
A (possibly empty) list of metrics.
- Return type
-
list_metrics_resources_from_component
(component: str, resource: monitor_api.enums.ResourceType, method: monitor_api.enums.ResourceMethod, max_element: int = 10) → monitor_api.core.collections.Metrics¶ Retrieve metrics having the higher (resp. lower) resource consumption for a given component. Operates on at most 500 entries.
- Parameters
component (str) – A valid component identifier
resource (ResourceType) – The resource you want to operate the extraction on.
method (ResourceType) – Indicate if you want greediest or most disciplined tests.
max_element (int) – Set the number of element you wish to retrieve. Default is 10.
- Returns
A (possibly empty) list of metrics.
- Return type
-
list_metrics_resources_from_pipeline
(pipeline: str, resource: monitor_api.enums.ResourceType, method: monitor_api.enums.ResourceMethod, max_element: int = 10) → monitor_api.core.collections.Metrics¶ Retrieve metrics having the higher (resp. lower) resource consumption accross a pipeline (multiple builds). Operates on at most 500 entries.
- Parameters
pipeline (str) – The pipeline name of the build.
resource (ResourceType) – The resource you want to operate the extraction on.
method (ResourceType) – Indicate if you want greediest or most disciplined tests.
max_element (int) – Set the number of element you wish to retrieve. Default is 10.
- Returns
A (possibly empty) list of metrics.
- Return type
-
list_pipeline_builds
(pipeline: str) → List[str]¶ For a given pipeline, list all known build identifiers.
- Parameters
pipeline (str) – The pipeline for which all build must be listed.
- Returns
The list of builds associated to this pipeline
- Return type
list(str)
-
list_pipelines
() → List[str]¶ Retrieve the list of known pipelines
- Returns
the list of pipeline names
- Return type
list(str)
-
list_session_metrics
(session_h: str = None) → monitor_api.core.collections.Metrics¶ Read all metrics having the given session reference.
- Parameters
session_h (str) – The full session reference
- Returns
A (possibly empty) list of metrics.
- Return type
-
list_sessions
(with_tags: Union[str, List[str]] = None, restrict_flags: Union[str, List[str]] = None, method: str = None) → monitor_api.core.collections.Sessions¶ Read all sessions matching your criteria. If no filters are provided, all sessions are retrieved.
- Parameters
with_tags (either str or list(str)) – Set the tags you want your sessions must have.
restrict_flags (either str or list(str)) – restrict you tag’s values. Must have same length has with_tags.
method (str (allowed values are match_all and match_any)) – indicates whether you want a strict match (match_all) or a permissive one (match_any)
- Returns
The list of sessions matching the conditions.
- Return type
- Note
This interface is subject for change in future version!