관리-도구
편집 파일: asgi.cpython-38.pyc
U .?�fF � @ sP d dl mZ d dlmZ ddlmZ ddlmZmZ edfee ed�dd �Z d S )� )�Callable)�parse_qs� )�_bake_output)�CollectorRegistry�REGISTRYF)�registry�disable_compression�returnc s � �fdd�}|S )z;Create a ASGI app which serves the metrics from a registry.c � s� | � d�dkst�t| � dd��}d�dd� | � d�D ��}d�d d� | � d�D ��}t�|||� �\}}}g } |D ]} | �td d� | D ��� qt|� I d H }|� d�dkr�|d t|�d�d �| d��I d H |d|d��I d H d S )N�type�httpZquery_string� �,c S s, g | ]$\}}|� d ��� dkr|� d ��qS )�utf8�accept��decode�lower��.0�name�value� r �D/opt/hc_python/lib/python3.8/site-packages/prometheus_client/asgi.py� <listcomp> s �z9make_asgi_app.<locals>.prometheus_app.<locals>.<listcomp>�headersc S s, g | ]$\}}|� d ��� dkr|� d ��qS )r zaccept-encodingr r r r r r s �c s s | ]}|� d �V qdS )r N)�encode)r �xr r r � <genexpr> s z8make_asgi_app.<locals>.prometheus_app.<locals>.<genexpr>zhttp.requestzhttp.response.start� r )r �statusr zhttp.response.body)r �body) �get�AssertionErrorr �joinr �append�tuple�int�split)�scopeZreceive�send�paramsZ accept_headerZaccept_encoding_headerr r �outputZformatted_headers�header�payload�r r r r �prometheus_app s* � ��� z%make_asgi_app.<locals>.prometheus_appr )r r r0 r r/ r � make_asgi_app s r1 N)�typingr �urllib.parser Z expositionr r r r �boolr1 r r r r �<module> s