관리-도구
편집 파일: multiprocess.cpython-311.pyc
� �܋fJ � � � d dl mZ d dlmZ d dlZd dlZd dlZddlmZ ddl m Z ddlmZ ddl mZ e n # e$ r eZY nw xY wd Z G d � de� � Zd d�ZdS )� )�unicode_literals)�defaultdictN� )�Metric)� MmapedDict)�Sample)�floatToGoStringzMultiprocess metricc �d � e Zd ZdZd d�Zed d�� � Zed� � � Zed� � � Zd� Z dS )�MultiProcessCollectorz+Collector for files for multi-process mode.Nc �� � |�t j � d� � }|rt j � |� � st d� � �|| _ |r|� | � � d S d S )N�prometheus_multiproc_dirz:env prometheus_multiproc_dir is not set or not a directory)�os�environ�get�path�isdir� ValueError�_path�register)�self�registryr s �o/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/prometheus_client/multiprocess.py�__init__zMultiProcessCollector.__init__ s| � ��<��:�>�>�"<�=�=�D�� [�2�7�=�=��.�.� [��Y�Z�Z�Z��� �� $����d�#�#�#�#�#� $� $� Tc �l � t � | � � }t � ||� � S )z�Merge metrics from given mmap files. By default, histograms are accumulated, as per prometheus wire format. But if writing the merged data back to mmap files, use accumulate=False to avoid compound accumulation. )r � _read_metrics�_accumulate_metrics)�files� accumulate�metricss r �mergezMultiProcessCollector.merge! s- � � (�5�5�e�<�<��$�8�8��*�M�M�Mr c �P �� i }i ��fd�}| D �]}t j � |� � � d� � }|d } t j |� � }n!# t $ r |dk r|d dv rY �o� w xY w|D ]�\ }}} ||� � \ } }}} |� | � � }|�t | t |� � }||| <