
    9h                          S SK r  " S S5      rg)    Nc                   z    \ rS rSrSrSS jr\S 5       r\S 5       r\S 5       r	\S 5       r
S	 rS
 rS rS rSrg)
MetricName   a  
This class encapsulates a metric's name, logical group and its
related attributes (tags).

group, tags parameters can be used to create unique metric names.
e.g. domainName:type=group,key1=val1,key2=val2

Usage looks something like this:

    # set up metrics:
    metric_tags = {'client-id': 'producer-1', 'topic': 'topic'}
    metric_config = MetricConfig(tags=metric_tags)

    # metrics is the global repository of metrics and sensors
    metrics = Metrics(metric_config)

    sensor = metrics.sensor('message-sizes')
    metric_name = metrics.metric_name('message-size-avg',
                                      'producer-metrics',
                                      'average message size')
    sensor.add(metric_name, Avg())

    metric_name = metrics.metric_name('message-size-max',
    sensor.add(metric_name, Max())

    tags = {'client-id': 'my-client', 'topic': 'my-topic'}
    metric_name = metrics.metric_name('message-size-min',
                                      'producer-metrics',
                                      'message minimum size', tags)
    sensor.add(metric_name, Min())

    # as messages are sent we record the sizes
    sensor.record(message_size)
Nc                     U(       a  U(       d  [        S5      eUb   [        U[        5      (       d  [        S5      eXl        X l        X0l        [        R                  " U5      U l        SU l        g)a9  
Arguments:
    name (str): The name of the metric.
    group (str): The logical group name of the metrics to which this
        metric belongs.
    description (str, optional): A human-readable description to
        include in the metric.
    tags (dict, optional): Additional key/val attributes of the metric.
z!name and group must be non-empty.Nztags must be a dict if present.r   )	
ValueError
isinstancedict_name_group_descriptioncopy_tags_hash)selfnamegroupdescriptiontagss        aC:\Suresh\moveshuttle\MDcreated\moveengine\venv\Lib\site-packages\aiokafka/metrics/metric_name.py__init__MetricName.__init__(   sY     @AAJtT$:$:>??
'YYt_

    c                     U R                   $ N)r
   r   s    r   r   MetricName.name=   s    zzr   c                     U R                   $ r   )r   r   s    r   r   MetricName.groupA   s    {{r   c                     U R                   $ r   )r   r   s    r   r   MetricName.descriptionE   s       r   c                 B    [         R                   " U R                  5      $ r   )r   r   r   s    r   r   MetricName.tagsI   s    yy$$r   c                 F   U R                   S:w  a  U R                   $ SnSnX-  [        U R                  5      -   nX-  [        U R                  5      -   nU R                  (       a,  [        [        U R                  R                  5       5      5      OSnX-  U-   nX l         U$ )Nr         )r   hashr   r   r   	frozensetitems)r   primeresult	tags_hashs       r   __hash__MetricName.__hash__M   s    ::?::$tzz"22$tyy/1:>))D499??#456	)+
r   c                     XL a  gUc  g[        U 5      [        U5      L =(       aY    U R                  UR                  :H  =(       a9    U R                  UR                  :H  =(       a    U R                  UR                  :H  $ )NTF)typer   r   r   r   others     r   __eq__MetricName.__eq__Y   sh    ==J$u+% (

ekk)(		UZZ'( 		UZZ'		
r   c                 .    U R                  U5      (       + $ r   )r2   r0   s     r   __ne__MetricName.__ne__e   s    ;;u%%%r   c           	      p    SU R                    SU R                   SU R                   SU R                   S3	$ )NzMetricName(name=z, group=z, description=z, tags=))r   r   r   r   r   s    r   __str__MetricName.__str__h   s?    tyyk$** >++,GDII;aA	
r   )r   r   r   r
   r   )NN)__name__
__module____qualname____firstlineno____doc__r   propertyr   r   r   r   r,   r2   r5   r9   __static_attributes__ r   r   r   r      sq    !F*     ! ! % %


&
r   r   )r   r   rB   r   r   <module>rC      s    h
 h
r   