<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Templating variables for metrics dashboards > 原文:[https://docs.gitlab.com/ee/operations/metrics/dashboards/templating_variables.html](https://docs.gitlab.com/ee/operations/metrics/dashboards/templating_variables.html) * [`text` variable type](#text-variable-type) * [Simple syntax](#simple-syntax) * [Full syntax](#full-syntax) * [`custom` variable type](#custom-variable-type) * [Simple syntax](#simple-syntax-1) * [Full syntax](#full-syntax-1) * [`metric_label_values` variable type](#metric_label_values-variable-type) * [Full syntax](#full-syntax-2) # Templating variables for metrics dashboards[](#templating-variables-for-metrics-dashboards "Permalink") 在 GitLab 13.0 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/214539) . 模板變量可用于使指標儀表板更加通用. `templating`是[儀表板 YAML 中](yaml.html#dashboard-top-level-properties)的頂級鍵. 在`templating`下的`variables`鍵中定義變量. `variables`鍵的值應為哈希, `variables`下的每個鍵在儀表板上定義一個模板變量,并且可以包含字母數字和下劃線字符. 可以使用[使用變量中](variables.html)所述的語法在同一儀表板的 Prometheus 查詢[中使用變量](variables.html) . ## `text` variable type[](#text-variable-type "Permalink") **警告:**此變量類型是*alpha*功能,如有更改,恕不另行通知! 對于儀表板 YAML 中定義的每個`text`變量,儀表板 UI 上都會有一個自由文本框,您可以為每個變量輸入一個值. `text`變量類型支持簡單和完整的語法. ### Simple syntax[](#simple-syntax "Permalink") 本示例創建一個名為`variable1` ,其默認值為`default value` : ``` templating: variables: variable1: 'default value' # `text` type variable with `default value` as its default. ``` ### Full syntax[](#full-syntax "Permalink") 本示例創建一個名為`variable1` ,其默認值為`default` . UI 上文本框的標簽將為`label`鍵的值: ``` templating: variables: variable1: # The variable name that can be used in queries. label: 'Variable 1' # (Optional) label that will appear in the UI for this text box. type: text options: default_value: 'default' # (Optional) default value. ``` ## `custom` variable type[](#custom-variable-type "Permalink") **警告:**此變量類型是*alpha*功能,如有更改,恕不另行通知! 儀表板 YAML 中定義的每個`custom`變量都會在儀表板 UI 上創建一個下拉選擇器,允許您為每個變量選擇一個值. `custom`變量類型支持簡單和完整的語法. ### Simple syntax[](#simple-syntax-1 "Permalink") 本示例創建一個名為`variable1` ,其默認值為`value1` . 儀表板界面將顯示一個下拉列表,其中包含`value1` , `value2`和`value3`作為選擇. ``` templating: variables: variable1: ['value1', 'value2', 'value3'] ``` ### Full syntax[](#full-syntax-1 "Permalink") 本示例創建一個名為`variable1` ,其默認值為`value_option_2` . UI 上文本框的標簽將為`label`鍵的值. 儀表板界面將顯示一個下拉列表,其中包含`Option 1`和`Option 2` . 如果從下拉列表中選擇`Option 1` ,則變量將被替換為`value option 1` . 同樣,如果選擇`Option 2` ,則變量將替換為`value_option_2` : ``` templating: variables: variable1: # The variable name that can be used in queries. label: 'Variable 1' # (Optional) label that will appear in the UI for this dropdown. type: custom options: values: - value: 'value option 1' # The value that will replace the variable in queries. text: 'Option 1' # (Optional) Text that will appear in the UI dropdown. - value: 'value_option_2' text: 'Option 2' default: true # (Optional) This option should be the default value of this variable. ``` ## `metric_label_values` variable type[](#metric_label_values-variable-type "Permalink") **警告:**此變量類型是*alpha*功能,如有更改,恕不另行通知! ### Full syntax[](#full-syntax-2 "Permalink") 本示例創建一個名為`variable2` . 下拉列表的值將是`up{env="production"}`描述的 Prometheus 系列中`backend`標簽的所有不同值. ``` templating: variables: variable2: # The variable name that can be interpolated in queries. label: 'Variable 2' # (Optional) label that will appear in the UI for this dropdown. type: metric_label_values options: series_selector: 'up{env="production"}' label: 'backend' ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看