openstef.monitoring package¶
Submodules¶
openstef.monitoring.performance_meter module¶
- class openstef.monitoring.performance_meter.PerformanceMeter(logger)¶
Bases:
object
- checkpoint(name_checkpoint, **kwargs)¶
Creates a timing checkpoint and logs the runtime from the previous one.
- Parameters:
name_checkpoint (
str
) – The name of the checkpoint. This will be logged as “checkpoint: name_checkpoint”**kwargs – Any other kwargs are appended to the logging.
- Returns:
self
- complete_level(successful=True, **kwargs)¶
Completes the most inner level and logs the total runtime of that level.
- Parameters:
successful (
bool
) – Whether the level was successful. Defaults to True.**kwargs – Any other kwargs are appended to the logging.
- Returns:
self
- start_level(level_label, level_name, **kwargs)¶
Enters a new level in the performance meter and logs it.
This function also creates a checkpoint on the newly created level.
- Parameters:
level_label (
str
) – The label of the new level. This could i.e. be ‘task’level_name (
str
) – The name of the specified level.**kwargs – Any other kwargs are appended to the logging.
- Returns:
self
openstef.monitoring.teams module¶
- openstef.monitoring.teams.build_sql_query_string(df, table)¶
Build sql insert query string for Teams message output from df.
- Parameters:
df (
DataFrame
) – Df of table values to insert in sql.table (
str
) – Table to insert df into.
- Return type:
str
- Returns:
Sql query of insert statement.
- openstef.monitoring.teams.format_message(title, params, fallback=None, color=None)¶
- Return type:
dict
- openstef.monitoring.teams.get_card_section(section_dict)¶
Get card section for teams message from dictionary.
- Return type:
cardsection
- openstef.monitoring.teams.post_teams(msg, invalid_coefficients=None, coefficients_df=None, url=None, proxies=None)¶
Post a message to Teams - KTP.
Note that currently no authentication occurs. Security is given by keeping the URL secret. One should therefore refrain from using more enhanced features such as action buttons.
- Parameters:
msg (
Union
[str
,dict
]) – For simple messages a string can be passed. For more complex messages pass a dict. The following keys are supported: text, links, sections. Each section can contain the following keys: text, title, images, facts, markdown. Also see: https://docs.microsoft.com/en-us/outlook/actionable-messages/send-via-connectorsinvalid_coefficients (
DataFrame
) – df of information of invalid coefficients. Defaults to None.coefficients_df (
DataFrame
) – df of new coefficients. Defaults to None.url (
str
) – webhook url, monitoring by defaultproxies (
dict
) – Optinonal proxy settings.
Note
This function is namespace-specific.
- Return type:
None