관리-도구
편집 파일: metrics.cpython-38.pyc
U .?�fam � @ s� d dl Z d dlmZ d dlZd dlZd dlmZmZmZm Z m Z mZmZm Z mZmZmZmZ d dlZddlmZ ddlmZmZmZ ddlmZmZmZmZ ddlmZm Z m!Z! dd l"m#Z#m$Z$ dd l%m&Z&m'Z' eddd �Z(ededef d �Z)dd� Z*dd� Z+dd� Z,dd� Z-e.d�dd�Z/e/� a0dd� Z1dd� Z2G dd� de�Z3G d d!� d!e3�Z4G d"d#� d#e3�Z5G d$d%� d%e3�Z6G d&d'� d'e3�Z7G d(d)� d)e3�Z8G d*d+� d+e3�Z9dS ),� N)�Lock)�Any�Callable�Dict�Iterable�List�Literal�Optional�Sequence�Tuple�Type�TypeVar�Union� )�values)�ExceptionCounter�InprogressTracker�Timer)�Metric�METRIC_LABEL_NAME_RE�METRIC_NAME_RE�RESERVED_METRIC_LABEL_NAME_RE)� Collector�CollectorRegistry�REGISTRY)�Exemplar�Sample)�floatToGoString�INF�T�MetricWrapperBase)�bound�F.c C s� d}|r||d 7 }|r$||d 7 }||7 }| dkrJ|� d�rJ|d d� }|rh|� d| �sh|d| 7 }|r�| dkr�td| ��|S )N� �_�counter�_totali����)�info�statesetz2Metric name is of a type that cannot have a unit: )�endswith� ValueError)�metric_type�name� namespace� subsystem�unitZ full_name� r0 �G/opt/hc_python/lib/python3.8/site-packages/prometheus_client/metrics.py�_build_full_name s r2 c C s0 t �| �std| ��t�| �r,td| ��d S )NzInvalid label metric name: �Reserved label metric name: )r �matchr* r )�lr0 r0 r1 �_validate_labelname) s r6 c C s4 t |�}|D ]"}t|� || jkrtd| ��q|S )Nr3 )�tupler6 �_reserved_labelnamesr* )�cls� labelnamesr5 r0 r0 r1 �_validate_labelnames0 s r; c C sJ d}| � � D ](\}}t|� |t|�7 }|t|�7 }q|dkrFtd��d S )Nr � zDExemplar labels have %d UTF-8 characters, exceeding the limit of 128)�itemsr6 �lenr* )�exemplarZrunes�k�vr0 r0 r1 �_validate_exemplar9 s rB ��returnc C s t j�dd��� dkS )NZ!PROMETHEUS_DISABLE_CREATED_SERIES�False)�true�1�t)�os�environ�get�lowerr0 r0 r0 r1 �_get_use_createdC s rM c C s da dS )zJDisable exporting _created metrics on counters, histograms, and summaries.FN��_use_createdr0 r0 r0 r1 �disable_created_metricsJ s rP c C s da dS )zIEnable exporting _created metrics on counters, histograms, and summaries.TNrN r0 r0 r0 r1 �enable_created_metricsP s rQ c @ s< e Zd ZU dZee ed<