HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //lib/google-cloud-sdk/lib/surface/firestore/databases/__pycache__/ping.cpython-312.pyc
�

�����v�dZddlmZddlmZddlmZddlZddlZddlZddlZddl	m
Z
ddlmZddl
mZdd	l
mZdd
lmZej$ej&ej(j*ej(j,ej(j.�Gd�dej0���Zy)
z,The gcloud Firestore databases ping command.�)�absolute_import)�division)�unicode_literalsN)�	databases)�base)�connection_util)�flags)�
propertiesc�.�eZdZdZdZdZed��Zd�Zy)�Pingz�Times the connection and ping time for a Firestore with MongoDB compatibility database.

  ## EXAMPLES

  To time the connection and ping times for a Firestore with MongoDB
  compatibility database `testdb`:

      $ {command} --database=testdb
  ��
c�2�tj|d��y)NT��required)r	�AddDatabaseIdFlag)�parsers �'lib/surface/firestore/databases/ping.py�Argsz	Ping.Args2s��	���F�T�2�c��tjjjj	d��}tj||j�}|j�d|j�d�}g}td|�d��t|j�D]2}	|jtj||j ���4t)t+d|D�cgc]
}|s�|d	��c}��}	|	rt-|	�t/|	�zd
�nd}
|D�cgc]
}|s�|d��}}t)t+dt0j2j5|���}|rt-|�t/|�zd
�nd}
t/|�dkDrt7j8|�d
�nd}dt/|	��d
|j�d|
�dt/|��d
|j |jz�d|
�d|�d�}tt;j<|��y#t"$r1}td|�d|���t%j&d�Yd}~���d}~wwxYwcc}wcc}w)NTr�.z.firestore.googz Testing connectivity latency to z"Failed to establish connection to z: �rz.3fzN/Az
    Successful connections: z / z+
    Average connection setup latency (s): z
    Successful pings: z
    Ping time average (s): z'
    Ping time standard deviation (s): z
    )r
�VALUES�core�project�Getr�GetDatabase�database�uid�
locationId�print�range�
_NUM_CONNECTS�appendr�ConnectAndPing�
_NUM_PINGS�IOError�time�sleep�list�filter�sum�len�	itertools�chain�
from_iterable�
statistics�stdev�textwrap�dedent)�self�argsr�db�hostname�timing_results�_�e�result�
connect_times�connection_time_avg�ping_time_lists�
ping_times�
ping_time_avg�ping_time_stddev�summarys                r�RunzPing.Run6sF�����$�$�,�,�0�0�$�0�?�G�	�	�	�w��
�
�	6�B��&�&���2�=�=�/��9�H��N�	�,�X�J�a�
8�9�
�4�%�%�
&�������*�*�8�T�_�_�E�	
�'���t�n�G�n�F��f�Q�i�n�G�H��M�
��}���M� 2�2�3�
7�
��
0>�H�~�V��v�a�y�~�O�H���t�Y�_�_�2�2�?�C�D��J�7A�3�z�?�S��_�,�S�
1�e��25�Z��1�1D�:���J�'��
,�%��� ��/�0��D�4F�4F�3G�H+�+>�*?�@��:��'�s�4�?�?�T�=O�=O�+O�*P�Q�)�?�+'�'7�&8�9��G�
�(�/�/�'�
"�#��=��
�2�8�*�B�q�c�B�C��
�
�1�
�
����H��Is0�/H�I�#I�I	�I	�	I�&H<�<IN)	�__name__�
__module__�__qualname__�__doc__r$r'�staticmethodrrE�rrrr s*��
��-��*��3��3�*$rr)rI�
__future__rrrr/r2r4r)� googlecloudsdk.api_lib.firestorer�googlecloudsdk.callioper�$googlecloudsdk.command_lib.firestorerr	�googlecloudsdk.corer
�DefaultUniverseOnly�
ReleaseTracks�ReleaseTrack�ALPHA�BETA�GA�CommandrrKrr�<module>rXs���3�&��'�����6�(�@�6�*�������������T�.�.�3�3�T�5F�5F�5I�5I��<$�4�<�<�<$���<$r