o
    bi,                     @   sF  d dl mZmZ d dlmZ d dlmZmZ eG dd dZddddd	d
dZ	dddddddZ
G dd deZeG dd dZddi g ddddddiddd dddddd d!d"id#d$id%did&d'd(d)ddd*d+ddd,d-
d.g d/dd0d1ddd2ddd3d4d5d2dd2d2dd3gd6
Zi d7i d8dd9d:d;dd<dd=dd>i g dd?d@dd d dAdBd:dCd dDddEdFdGddddddddddHddddIdJddKddLd2dMdNdii dOddPdQdRdSdTddUdVdWdXdYddZd dd[d\d]dd^dXd_dd`d dd[gdad:dbddcdddg deg dfd2dgg dhd2did/djdd dkdldmdnd2dod2dg dpd0d1ddd2ddd3d4d5d2dd2d2dd3gdd2dqdrZddsdeig d dOdtd2dudvdwdudxdydugdzd5d{g dd|d}d~d&d&dgdddi d&ddQg d2d2d/dd0dddd2ddd3d4d5d2dd2d2dd3gdZddsdig dOdd2dugdzd5dg dd:dgdddddddiddQg d/dd0dddd2ddd3d4d5d2dd2d2dd3gd	Zddi g ddFg dddd}gdddgdddi ddQg d2d2d/dd0d1ddd2ddd3d4d5d2dd2d2dd3gdZG dd deZeG dd dZeG dd dZeG dd dZd2S )    )	dataclassfield)Enum)ListOptionalc                   @   s.   e Zd ZU eed< eed< eed< eed< dS )GridPosxywhN)__name__
__module____qualname__int__annotations__ r   r   c/home/ubuntu/.local/lib/python3.10/site-packages/ray/dashboard/modules/metrics/dashboards/common.pyr      s
   
 r   T0 
randomWalkA)exemplarexprintervallegendFormat	queryTyperefIdheatmapF)formatfullMetaSearchincludeNullMetadatainstantrange
useBackendc                   @   s   e Zd ZeZeZdS )TargetTemplateN)r   r   r   GRAPH_TARGET_TEMPLATEGRAPHHEATMAP_TARGET_TEMPLATEHEATMAPr   r   r   r   r$   !   s    r$   c                   @   s4   e Zd ZU dZeed< eed< ejZe	e ed< dS )Targeta  Defines a Grafana target (time-series query) within a panel.

    A panel will have one or more targets. By default, all targets are rendered as
    stacked area charts, with the exception of legend="MAX", which is rendered as
    a blue dotted line. Any legend="FINISHED|FAILED|DEAD|REMOVED" series will also be
    rendered hidden by default.

    Attributes:
        expr: The prometheus query to evaluate.
        legend: The legend string to format for each time-series.
    r   legendtemplateN)
r   r   r   __doc__strr   r$   r&   r+   r   r   r   r   r   r)   &   s
   
 r)   z${datasource}z<Description>)defaults	overrides      unitnoneg      ?zdark-orangeschemeexponentialSpectral@   )exponentfillminmodereversescaler4   stepscolorzrgba(255,0,255,0.7)leg&.>showautozRequest count)layoutvaluesingle)r;   showColorScale
yHistogramleft)axisPlacementr<   r2   )
	calculatecellGap
cellValuesr?   	exemplarsfilterValuesr*   	rowsFrametooltipyAxisz11.2.0z<Title>z
object:628unitsN)	$$hashKeyr   labellogBasemaxr:   rA   z
object:629short)

datasourcedescriptionfieldConfigidoptionspluginVersiontargetstitletypeyaxesaliasColorsbars
dashLength
   dashesrX   rY   rZ   gridPos   )r   r
   r   r	   r9   fillGradienthiddenSeriesr[      r*   current)alignAsTableavgrl   	hideEmptyhideZerorV   r:   	rightSiderA   sortsortDesctotalvalueslines	linewidthnullPointModer\   alertThreshold
percentager]   z7.5.17pointradius   pointsrendererflotseriesOverrideszobject:2987MAXz#1F60C4)rS   aliasrf   r?   r9   stackz	object:78z,/FINISHED|FAILED|DEAD|REMOVED|Failed Nodes:/)rS   r   rj   zMAX + PENDINGz#777777spaceLengthr   steppedLiner^   
thresholdstimeFromtimeRegions	timeShiftr_   rP   
individual)sharedrr   
value_typer`   graphtime)bucketsr;   namerA   ru   )align
alignLevel)xaxisra   yaxisr;   zsuper-light-yellow)r?   rD   zsuper-light-green2   greend   )r;   r>   )r?   mappingsr:   r   r2   N   rD   arealastNotNull)calcsfieldsru   )	colorMode	graphModejustifyModeorientationreduceOptionstexttextModestatTokens)rX   rZ   r[   r\   r]   r^   r   r   r_   r`   ra   zcontinuous-YlBlzrgb(230, 230, 230))r?   r   r   r2   	titleSize)r   showThresholdLabelsshowThresholdMarkersr   gauge)	rX   rZ   r[   r\   r]   r^   r_   r`   ra   tablerightpercent)displayMode	placementru   pie)displayLabelsr*   pieTyper   r   piechart)rX   rY   rZ   r[   r\   r]   r^   r   r   r_   r`   ra   c                   @   s    e Zd ZeZeZeZe	Z
eZdS )PanelTemplateN)r   r   r   GRAPH_PANEL_TEMPLATEr&   HEATMAP_TEMPLATEr(   PIE_CHART_TEMPLATE	PIE_CHARTSTAT_PANEL_TEMPLATESTATGAUGE_PANEL_TEMPLATEGAUGEr   r   r   r   r   k  s    r   c                   @   s   e Zd ZU dZeed< eed< eed< eed< ee ed< dZ	eed< d	Z
eed
< dZeed< dZee ed< ejZee ed< dS )Panela|  Defines a Grafana panel (graph) for the Ray dashboard page.

    A panel contains one or more targets (time-series queries).

    Attributes:
        title: Short name of the graph. Note: please keep this in sync with the title
            definitions in Metrics.tsx.
        description: Long form description of the graph.
        id: Integer id used to reference the graph from Metrics.tsx.
        unit: The unit to display on the y-axis of the graph.
        targets: List of query targets.
        fill: Whether or not the graph will be filled by a color.
        stack: Whether or not the lines in the graph will be stacked.
    r_   rY   r[   r2   r^   re   r9   Tr   r1   rw   Ngrid_posr+   )r   r   r   r,   r-   r   r   r   r)   r9   r   boolrw   r   r   r   r   r&   r+   r   r   r   r   r   s  s   
 r   c                   @   s:   e Zd ZU dZeed< eed< ee ed< dZ	e
ed< dS )RowzDefines a Grafana row that can contain multiple panels.

    Attributes:
        title: The title of the row
        panels: List of panels contained in this row
        collapsed: Whether the row should be collapsed by default
    r_   r[   panelsF	collapsedN)r   r   r   r,   r-   r   r   r   r   r   r   r   r   r   r   r     s   
 r   c                   @   sf   e Zd ZU eed< eed< ee ed< eed< eedZee	 ed< eedZ
ee ed< dd	 Zd
S )DashboardConfigr   default_uidstandard_global_filtersbase_json_file_name)default_factoryr   rowsc                 C   s   | j s
| jstdd S d S )Nz0At least one of panels or rows must be specified)r   r   
ValueError)selfr   r   r   __post_init__  s   zDashboardConfig.__post_init__N)r   r   r   r-   r   r   r   listr   r   r   r   r   r   r   r   r   r     s   
 r   )dataclassesr   r   enumr   typingr   r   r   r%   r'   r$   r)   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>   s   





4
	
 !"#$%(	?@ABCDEFGHIK	
i	
;
	
0
-