관리-도구
편집 파일: values.cpython-311.pyc
� �܋f� � � � d dl mZ d dlZd dlmZ ddlmZmZ G d� de� � Z ej fd�Zd � Z e� � Z dS ) � )�unicode_literalsN)�Lock� )�mmap_key� MmapedDictc �. � e Zd ZdZdZd� Zd� Zd� Zd� ZdS )� MutexValuezA float protected by a mutex.Fc �: � d| _ t � � | _ d S )Ng )�_valuer �_lock)�self�typ�metric_name�name� labelnames�labelvalues�kwargss �i/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/prometheus_client/values.py�__init__zMutexValue.__init__ s � �����V�V�� � � � c �f � | j 5 | xj |z c_ d d d � � d S # 1 swxY w Y d S �N�r r )r �amounts r �inczMutexValue.inc s~ � � �Z� "� "��K�K�6�!�K�K� "� "� "� "� "� "� "� "� "� "� "� "���� "� "� "� "� "� "s �&�*�*c �T � | j 5 || _ d d d � � d S # 1 swxY w Y d S r r )r �values r �setzMutexValue.set su � � �Z� � ��D�K� � � � � � � � � � � � ���� � � � � � s ��!�!c �R � | j 5 | j cd d d � � S # 1 swxY w Y d S r r )r s r �getzMutexValue.get ss � � �Z� � ��;� � � � � � � � � � � � ���� � � � � � s �� � N) �__name__� __module__�__qualname__�__doc__� _multiprocessr r r r � r r r r s[ � � � � � �'�'��M�� � �"� "� "� � � �� � � � r r c �~ � ����� i �g �d � � � i�t � � � G ���� �fd�dt � � }|S )a8 Returns a MmapedValue class based on a process_identifier function. The 'process_identifier' function MUST comply with this simple rule: when called in simultaneously running processes it MUST return distinct values. Using a different function than the default 'os.getpid' is at your own risk. r c �` �� e Zd ZdZdZd��fd� Z� �fd�Z� ���fd�Z�fd�Z�fd�Z �fd �Z d S )�&MultiProcessValue.<locals>.MmapedValuezAA float protected by a mutex backed by a per-process mmaped file.T� c �� �� ||||||f| _ �5 | � � � | � � � � � | � � d d d � � d S # 1 swxY w Y d S r )�_params�"_MmapedValue__check_for_pid_change�_MmapedValue__reset�append) r r r r r r �multiprocess_moder �lock�valuess ��r r z/MultiProcessValue.<locals>.MmapedValue.__init__4 s� �� ���T�:�{�L]�]�D�L�� $� $��+�+�-�-�-�������� � �d�#�#�#� $� $� $� $� $� $� $� $� $� $� $� $���� $� $� $� $� $� $s �>A�A �#A c � �� | j \ }}}}}}|dk r |dz |z }n|}|� vr\t j � t j d d� |� d � � � � }t |� � � |<