Ë
    dQê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y)é    )ÚCallable)Úfnmatchcase)Ú	getLogger)Ú
Instrument)ÚAggregationÚDefaultAggregationÚ_AggregationÚ#_ExplicitBucketHistogramAggregationÚ&_ExponentialBucketHistogramAggregation)Ú'AlignedHistogramBucketExemplarReservoirÚExemplarReservoirBuilderÚ SimpleFixedSizeExemplarReservoir)Ú_InstrumentÚaggregation_typeÚreturnc                 óf   — t        | t        «      rt        S t        | t        «      rt        S t        S )z*Default reservoir factory per aggregation.)Ú
issubclassr
   r   r   r   )r   s    úm/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/opentelemetry/sdk/metrics/_internal/view.pyÚ_default_reservoir_factoryr      s.   € ô Ð"Ô$GÔHÜ6Ð6ÜÐ"Ô$JÔKÜ/Ð/Ü+Ð+ó    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  dedz  fd„Zdedefd„Zy)Ú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.

        aggregation_cardinality_limit: This is a metric stream customizing
            attribute: the maximum number of distinct attribute sets the
            stream aggregates per collection cycle. Measurements with further
            attribute sets are aggregated into one additional point identified
            by the attribute ``otel.metric.overflow=true``. If `None` the
            cardinality limit of the metric reader is used, which defaults to
            2000. Must be a positive integer.

    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_unitÚaggregation_cardinality_limitc                 óÒ  — |�3t        |t        «      st        |t        «      r|dk  rt        d|›�«      ‚||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�«      ‚|| _        || _        || _        || _        || _	        || _
        || _        || _        || _        |	xs | j                  | _        |
xs t         | _        || _        y )Né   z>aggregation_cardinality_limit must be a positive integer, got z=Some instrument selection criteria must be provided for View Ú*ú?zView z5 declared with wildcard characters in instrument_name)Ú
isinstanceÚboolÚintÚ
ValueErrorÚ	ExceptionÚ_nameÚ_instrument_typeÚ_instrument_nameÚ_instrument_unitÚ_meter_nameÚ_meter_versionÚ_meter_schema_urlÚ_descriptionÚ_attribute_keysÚ_default_aggregationÚ_aggregationr   Ú_exemplar_reservoir_factoryÚ_aggregation_cardinality_limit)Úselfr   r   r   r   r   r   r   r    r!   r"   r#   r$   s                r   Ú__init__zView.__init__h   s7  € ð )Ð4ÜÐ4´dÔ;ÜÐ;¼SÔAØ,¨qÒ0äØPÐQnÐPqÐróð ð
 Øóàóð óð ó	ð
  óð óô Ð[Ð\`Ð[aÐbÓcÐcàÐ Ð ;ÀÈÑAWÐ[^ÐbqÑ[qä˜e D 6Ð)^Ð_Ó`Ð`ð
 ˆŒ
Ø /ˆÔØ /ˆÔØ /ˆÔØ%ˆÔØ+ˆÔØ!1ˆÔà'ˆÔØ-ˆÔØ'ÒD¨4×+DÑ+DˆÔØ+EÒ+cÔIcˆÔ(Ø.KˆÕ+r   Ú
instrumentr   c                 ó:  — | j                   �t        || j                   «      sy| j                  �/t        |j                  | j                  j                  «       «      sy| j                  �!t        |j                  | j                  «      sy| j                  �$|j                  j                  | j                  k7  ry| j                  �$|j                  j                  | j                  k7  ry| j                  �$|j                  j                  | j                  k7  ryy)NFT)r/   r)   r0   r   r   Úlowerr1   Úunitr2   Úinstrumentation_scoper3   Úversionr4   Ú
schema_url)r;   r=   s     r   Ú_matchzView._match£   sò   € Ø× Ñ Ð,Ü˜j¨$×*?Ñ*?Ô@Øà× Ñ Ð,ô
 ˜zŸ™°×0EÑ0E×0KÑ0KÓ0MÔNØà× Ñ Ð,ô ˜zŸ™°×0EÑ0EÔFØà×ÑÐ'Ø×/Ñ/×4Ñ4¸×8HÑ8HÒHØà×ÑÐ*Ø×/Ñ/×7Ñ7¸4×;NÑ;NÒNØà×!Ñ!Ð-Ø×/Ñ/×:Ñ:¸d×>TÑ>TÒTØàr   )NNNNNNNNNNNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r7   Útyper   ÚstrÚsetr   r   r	   r   r+   r<   r   r*   rD   © r   r   r   r   &   s%  „ ñ=ñ~ .Ó/Ðð 48Ø&*Ø!%Ø$(Ø'+ØØ"&Ø*.Ø*.ØfjØ&*Ø48ñ7Là˜jÑ)¨DÑ0ð7Lð ˜t™ð7Lð ˜$‘Jð	7Lð
 ˜T‘zð7Lð  ™*ð7Lð �D‰jð7Lð ˜4‘Zð7Lð ˜C™ 4™ð7Lð ! 4Ñ'ð7Lð %-¨d°<Ñ.@Ð-AÐC[Ð-[Ñ$\Ð_cÑ$cð7Lð ˜t™ð7Lð (+¨T¡zó7Lðv ð °ô r   r   N)Úcollections.abcr   Úfnmatchr   Úloggingr   Úopentelemetry.metricsr   Ú/opentelemetry.sdk.metrics._internal.aggregationr   r   r	   r
   r   Ú,opentelemetry.sdk.metrics._internal.exemplarr   r   r   Ú.opentelemetry.sdk.metrics._internal.instrumentr   rE   Ú_loggerrI   r   r   rL   r   r   ú<module>rU      s]   ðõ
 %Ý Ý å ,÷õ ÷ñ õ
 Gá
�HÓ
€ð,Ø˜<Ñ(ð,àó,÷\ò \r   