123456789101112131415161718192021222324 |
- [[metric]] # 定义一个指标配置
- context = "test_histo" # 指标的上下文或分类,这里是 "test_histo",表示这是一个用于测试的直方图
- # SQL 查询,选择了多个字段来模拟直方图的不同桶(buckets)和相关的计数值
- request = "SELECT 'firstlabel' as label1, 'secondlabel' as label2, 3 as le_20, 19 as le_40, 31 as le_60, 40 as le_80, 45 as count, 123.45 as data FROM DUAL"
- # 描述字段 data 为直方图类型,表示数据字段的所有值的总和
- metricsdesc = { data = "Histogram - sum total of all values in the data field." }
- # 指定 data 字段的类型为直方图(histogram)
- metricstype = { data = "histogram" }
- # 定义标签字段,这里是 "label1" 和 "label2",可以作为直方图的维度来区分数据
- labels = [ "label1", "label2" ]
- # 配置每个桶(bucket)的阈值,用于定义直方图的范围
- metricsbuckets = { data = { le_20 = "20", le_40 = "40", le_60 = "60", le_80 = "80" } }
- # 该直方图指标将生成如下形式的度量数据:
- # HELP xugudb_test_histo_data Histogram - sum total of all values in the data field.
- # TYPE xugudb_test_histo_data histogram
- # xugudb_test_histo_data_bucket{label1="firstlabel",label2="secondlabel",le="20"} 3
- # xugudb_test_histo_data_bucket{label1="firstlabel",label2="secondlabel",le="40"} 19
- # xugudb_test_histo_data_bucket{label1="firstlabel",label2="secondlabel",le="60"} 31
- # xugudb_test_histo_data_bucket{label1="firstlabel",label2="secondlabel",le="80"} 40
- # xugudb_test_histo_data_bucket{label1="firstlabel",label2="secondlabel",le="+Inf"} 45
- # xugudb_test_histo_data_sum{label1="firstlabel",label2="secondlabel"} 123.45
- # xugudb_test_histo_data_count{label1="firstlabel",label2="secondlabel"} 45
|