AlkantarClanX12

Your IP : 3.149.23.124


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/wmt/common/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/wmt/common/__pycache__/report.cpython-311.pyc

�

 tf�����ddlZddlmZmZddlmZddlmZddlm	Z	ddl
mZmZeGd�d����Z
eGd	�d
����ZeGd�d����Zd
�Zd�Zd�ZdS)�N)�	dataclass�asdict)�func)�literal_column)�cfg)�ScrapeResult�
session_scopec�H�eZdZUeed<eed<eed<eed<eed<d�ZdS)�
SummaryReport�	count_all�count_successful�count_failed�count_undone�average_timec�b�|j|j|j|jt	|jdz��gS)N��)rr
rr�intr)�self�argss  ��/builddir/build/BUILDROOT/cl-web-monitoring-tool-3.1.3-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/wmt/common/report.py�to_templatezSummaryReport.to_templates6�����%��!��!��D�%��-�.�.�0�	0�N)�__name__�
__module__�__qualname__r�__annotations__�floatr�rrrrs^��������N�N�N�����������������0�0�0�0�0rrc�4�eZdZUeed<eed<eed<d�ZdS)�ErrorReport�code�count_errors�urlc�p�t|j��}|dkrd|j�d|�d�}||j|jgS)N�html�	<a href="�">�</a>)�
url_to_domainr#r"r!�r�alternativer#s   rrzErrorReport.to_template#sN���D�H�%�%���&� � �3�d�h�3�3�#�3�3�3�C���!��	��	rN)rrr�strrrrrrrr r sC�������

�I�I�I�����	�H�H�H�����rr c�*�eZdZUeed<eed<d�ZdS)�DurationReportr#rc��t|j��}|dkrd|j�d|�d�}|t|jdz��gS)Nr%r&r'r(r)r)r#rrr*s   rrzDurationReport.to_template1sV���D�H�%�%���&� � �3�d�h�3�3�#�3�3�3�C���D�%��-�.�.�0�	0rN)rrrr,rrrrrrr.r.,s:�������	�H�H�H�����0�0�0�0�0rr.c�2�d}tj|d|��S)Nzhttp(s)?://�)�re�sub)r#�patterns  rr)r):s���G�
�6�'�2�s�#�#�#rc��t|��5}|�tjtjtj���d�����tj	|ktj	|ktjdktj
dk���tjtj�����}|�tj
|jj��tj|jj��|jj���|jj�����}|�tjtjtj���d��tj�����tj	|ktj	|ktjdk���tj���t+d����������}|�t���tj	|ktj	|ktj
dk�����}ddd��n#1swxYwYd�|D��}d�|D��}d�|D��}d	�|D��}	td
�|D����}
td�|D����}d�|D��}|sd
n;t/t1dt|��zt3|��z����}
t5|
|z|z|
|||
���}|||	d�S)N�	err_count��TrFc�H�g|]\}}}tj|���|||f�� Sr�r�is_domain_ignored)�.0r#r�counts    r�
<listcomp>z#generate_report.<locals>.<listcomp>isE��5�5�5�4L�C��u��.�s�3�3�5�c�<��/�5�5�5rc�H�g|]\}}}tj|���|||f�� Srr9)r;r!r<r#s    rr=z#generate_report.<locals>.<listcomp>lsE��3�3�3�*:�$��s��,�S�1�1�3�D�%��%�3�3�3rc�:�g|]\}}}t|||�����S))r!r"r#)r )r;r!r"r#s    rr=z#generate_report.<locals>.<listcomp>osC��@�@�@�/��l�C� �T��#�N�N�N�@�@�@rc�r�g|]4\}}}t|tt|dz���������5S)r)r#r)r.r�round)r;r#r�_s    rr=z#generate_report.<locals>.<listcomp>rsW��B�B�B�/�3��a�&�#�C��l�UY�FY�@Z�@Z�<[�<[�\�\�\�B�B�Brc3�"K�|]
\}}}|V��dS�Nr)r;r#rB�
success_counts    r�	<genexpr>z"generate_report.<locals>.<genexpr>us)����#]�#]�6K�c�1�m�M�#]�#]�#]�#]�#]�#]rc3�"K�|]
\}}}|V��dSrDr)r;rB�errors_countr#s    rrFz"generate_report.<locals>.<genexpr>vs)����T�T�0D��<��|�T�T�T�T�T�Trc��g|]
}|d��S)�r�r;�items  rr=z#generate_report.<locals>.<listcomp>xs��2�2�2�D��Q��2�2�2rrr)rr
rrr��summary_report�error_report�duration_report)r	�queryr�
response_code�websiterr<�label�filter�create_date�is_finished�group_by�subquery�group_concat�c�sumr6�all�avg�response_time_ms�order_byr�descrrA�lenr)�engine�
start_date�end_date�sessionrY�error_stats�
success_stats�count_unsuccessfulrOrP�successful_requests_count�error_requests_count�averages�
average_countrNs               r�generate_reportrn?s���	�v�	�	�'�'��=�=��!;�!-�!5�!%����!3�!3�K�!@�!@�B�B�
�F�<�+�z�9��+�x�7��-��4��+�t�3�
5�
5��X�l�0�,�2F�
G�
G�
�X�Z�Z�	��m�m�D�$5�h�j�6N�$O�$O�$(�H�X�Z�-A�$B�$B�$,�J�$6�8�8��X�h�j�(�
)�
)�
�S�U�U�		� �
�
�l�&:�&*�h�|�/L�&M�&M�&S�&S�Tb�&c�&c�&*�j�l�l�4�4��V�L�,�
�:� �,��8� �.�#�5�7�7��X�l�*�
+�
+�
�X�n�^�4�4�9�9�;�;�
<�
<�
�S�U�U�	�%�]�]�<�8�8�
�V�L�,�
�:� �,��8� �,��5�7�7��U�W�W�		�G'�'�'�'�'�'�'�'�'�'�'����'�'�'�'�R5�5�P]�5�5�5�M�3�3�k�3�3�3�K�@�@�3>�@�@�@�L�B�B�3@�B�B�B�O�!$�#]�#]�}�#]�#]�#]� ]� ]���T�T��T�T�T�T�T��2�2�M�2�2�2�H�%�[�A�A�3�u�T�C��M�M�5I�C�PX�M�M�5Y�/Z�/Z�+[�+[�M�"�-F�I]�-]�`r�-r�4M�0D�0B�0=�	?�?�?�N�)�$�*���s�KK(�(K,�/K,c�t�t|d��d�|dD��d�|dD��d�S)NrNc�,�g|]}t|����Sr�rrKs  rr=zreport_dict.<locals>.<listcomp>�s��I�I�I�$�����I�I�IrrOc�,�g|]}t|����SrrqrKs  rr=zreport_dict.<locals>.<listcomp>�s��O�O�O�T�F�4�L�L�O�O�OrrPrMrq)�reports r�report_dictrt�sO�� ��(8�!9�:�:�I�I�&��2H�I�I�I�O�O�V�<M�5N�O�O�O���r)r2�dataclassesrr�
sqlalchemyr�sqlalchemy.sql.expressionr�
wmt.commonr�wmt.dbrr	rr r.r)rnrtrrr�<module>rzsM��
�	�	�	�)�)�)�)�)�)�)�)�������4�4�4�4�4�4�������.�.�.�.�.�.�.�.��
0�
0�
0�
0�
0�
0�
0���
0� ������������
0�
0�
0�
0�
0�
0�
0���
0�$�$�$�
D�D�D�N����r