
    Zj                         d dl mZ d dlmZ d dlmZ d dlmZ d dlmZm	Z	m
Z
mZmZ d dlmZmZmZ d dlmZ  ee          Zdee
         d	efd
Z G d d          ZdS )    )Callable)fnmatch)	getLogger)
Instrument)AggregationDefaultAggregation_Aggregation#_ExplicitBucketHistogramAggregation&_ExponentialBucketHistogramAggregation)'AlignedHistogramBucketExemplarReservoirExemplarReservoirBuilder SimpleFixedSizeExemplarReservoir)_Instrumentaggregation_typereturnc                     t          | t                    rt          S t          | t                    rt          S t          S )z*Default reservoir factory per aggregation.)
issubclassr
   r   r   r   )r   s    e/var/www/FlaskApp/flask-venv/lib/python3.11/site-packages/opentelemetry/sdk/metrics/_internal/view.py_default_reservoir_factoryr      s>     "$GHH 766"$JKK 0//++    c                       e Zd ZdZ e            Z	 	 	 	 	 	 	 	 	 	 	 ddee         dz  dedz  dedz  dedz  dedz  dedz  d	edz  d
e	e         dz  de
dz  deee         gef         dz  dedz  fdZdedefdZdS )Viewa
  
    A `View` configuration parameters can be used for the following
    purposes:

    1. Match instruments: When an instrument matches a view, measurements
       received by that instrument will be processed.
    2. Customize metric streams: A metric stream is identified by a match
       between a view and an instrument and a set of attributes. The metric
       stream can be customized by certain attributes of the corresponding view.

    The attributes documented next serve one of the previous two purposes.

    Args:
        instrument_type: This is an instrument matching attribute: the class the
            instrument must be to match the view.

        instrument_name: This is an instrument matching attribute: the name the
            instrument must have to match the view. Wild card characters are supported. Wild
            card characters should not be used with this attribute if the view has also a
            ``name`` defined.

        meter_name: This is an instrument matching attribute: the name the
            instrument meter must have to match the view.

        meter_version: This is an instrument matching attribute: the version
            the instrument meter must have to match the view.

        meter_schema_url: This is an instrument matching attribute: the schema
            URL the instrument meter must have to match the view.

        name: This is a metric stream customizing attribute: the name of the
            metric stream. If `None`, the name of the instrument will be used.

        description: This is a metric stream customizing attribute: the
            description of the metric stream. If `None`, the description of the instrument will
            be used.

        attribute_keys: This is a metric stream customizing attribute: this is
            a set of attribute keys. If not `None` then only the measurement attributes that
            are in ``attribute_keys`` will be used to identify the metric stream.

        aggregation: This is a metric stream customizing attribute: the
            aggregation instance to use when data is aggregated for the
            corresponding metrics stream. If `None` an instance of
            `DefaultAggregation` will be used.

        exemplar_reservoir_factory: This is a metric stream customizing attribute:
            the exemplar reservoir factory

        instrument_unit: This is an instrument matching attribute: the unit the
            instrument must have to match the view.

    This class is not intended to be subclassed by the user.
    Ninstrument_typeinstrument_name
meter_namemeter_versionmeter_schema_urlnamedescriptionattribute_keysaggregationexemplar_reservoir_factoryinstrument_unitc                 \   ||cxu r|cxu r|cxu r|cxu r|cxu r	 n nt          d|           ||d|v sd|v rt          d| d          || _        || _        || _        || _        || _        || _        || _        || _        || _	        |	p| j
        | _        |
pt          | _        d S )Nz=Some instrument selection criteria must be provided for View *?zView z5 declared with wildcard characters in instrument_name)	Exception_name_instrument_type_instrument_name_instrument_unit_meter_name_meter_version_meter_schema_url_description_attribute_keys_default_aggregation_aggregationr   _exemplar_reservoir_factory)selfr   r   r   r   r   r   r   r    r!   r"   r#   s               r   __init__zView.__init__`   s|   $            	   
          =6:= =   +''3/+A+A 0 0 0 0   
 / / /%+!1'-'D4+D&D*D 	(((r   
instrumentr   c                    | j         t          || j                   sdS | j        t          |j        | j                  sdS | j        t          |j        | j                  sdS | j        |j        j        | j        k    rdS | j	        |j        j
        | j	        k    rdS | j        |j        j        | j        k    rdS dS )NFT)r)   
isinstancer*   r   r   r+   unitr,   instrumentation_scoper-   versionr.   
schema_url)r4   r6   s     r   _matchzView._match   s     ,j$*?@@ u ,:?D,ABB u ,:?D,ABB u'/48HHHu*/74;NNNu!-0;)* * utr   )NNNNNNNNNNN)__name__
__module____qualname____doc__r   r1   typer   strsetr   r   r	   r   r5   r   boolr=    r   r   r   r   &   sP       5 5n .-// 48&*!%$('+"&*.*. &*:
 :
j)D0:
 t:
 $J	:

 Tz:
 *:
 Dj:
 4Z:
 C4:
 !4':
 %-, "::%
 %:
 t:
 :
 :
 :
|       r   r   N)collections.abcr   r   loggingr   opentelemetry.metricsr   /opentelemetry.sdk.metrics._internal.aggregationr   r   r	   r
   r   ,opentelemetry.sdk.metrics._internal.exemplarr   r   r   .opentelemetry.sdk.metrics._internal.instrumentr   r>   _loggerrB   r   r   rF   r   r   <module>rN      sP  
 % $ $ $ $ $             , , , , , ,                      
 G F F F F F
)H

,<(,, , , ,T T T T T T T T T Tr   