日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

TimeStream集成Prometheus接口

阿里云Elasticsearch團隊自研的TimeStream時序引擎增強插件,支持使用PromQL查詢Elasticsearch數據,無縫對接Prometheus+Grafana。本文介紹如何基于Elasticsearch TimeStream使用Prometheus集成接口。

背景信息

TimeStream是阿里云Elasticsearch團隊自研,并結合Elastic社區時序類產品特性共建的時序引擎。阿里云Elasticsearch提供的TimeStream時序增強功能插件,優化了Elasticsearch在存儲指標數據方面的DSL(Domain-Specific Language)查詢復雜且慢以及存儲成本過高等問題。詳細信息請參見TimeStream時序增強引擎介紹

前提條件

已創建阿里云Elasticsearch實例,且實例版本為7.10(內核版本為1.8.0及以上)或7.16及以上(內核版本為1.7.0及以上)。具體操作請參見創建阿里云Elasticsearch實例

Prometheus API說明

Prometheus API除了可以訪問通過Prometheus Remote Write方式寫入的數據,也可以訪問任意TimeStream索引。

Prometheus API支持去掉返回的指標和維度的前后綴關鍵字。如果使用默認的數據模型,指標前綴metric.會被去掉,維度前綴label.會被去掉。

例如,通過Prometheus Remote Write方式寫入如下數據:
{
  "labels": {
    "instance": "127.0.0.1:9114",
    "job": "elasticsearch"
  },
  "metrics": {
    "up": 0.0,
    "scrape_samples_post_metric_relabeling": 0.0,
    "scrape_samples_scraped": 0.0,
    "scrape_duration_seconds": 4.45999E-4,
    "scrape_series_added": 0.0
  },
  "@timestamp": "1655717638795"
}
Prometheus API返回的維度字段會去掉前綴labels.,/api/v1/labels接口返回結果如下:
{
  "status" : "success",
  "data" : [
    "__name__",
    "instance",
    "job"
  ]
}
                
Prometheus API返回的指標字段會去掉前綴metrics.,/api/v1/metadata接口返回結果如下:
{
  "status" : "success",
  "data" : {
    "scrape_samples_post_metric_relabeling" : [
      {
        "type" : "gauge",
        "help" : "",
        "unit" : ""
      }
    ],
    "scrape_samples_scraped" : [
      {
        "type" : "gauge",
        "help" : "",
        "unit" : ""
      }
    ],
    "scrape_duration_seconds" : [
      {
        "type" : "gauge",
        "help" : "",
        "unit" : ""
      }
    ],
    "scrape_series_added" : [
      {
        "type" : "gauge",
        "help" : "",
        "unit" : ""
      }
    ],
    "up" : [
      {
        "type" : "gauge",
        "help" : "",
        "unit" : ""
      }
    ]
  }
}
如果您自定義了數據模型,則需要額外配置前后綴關鍵字,否則Prometheus API返回的就是實際的數據。配置前后綴關鍵字的示例如下:
PUT _time_stream/{name}
{
  "time_stream": {
    "labels_fields": "@labels.*_l",
    "metrics_fields": "@metrics.*_m",
    "label_prefix": "@labels.",
    "label_suffix": "_l",
    "metric_prefix": "@metrics.",
    "metric_suffix": "_m"
  }
}

RemoteWrite接口

API

POST /_time_stream/prom_write/{index}
---PB data---

使用說明

在Prometheus中配置Remote Write,即可將Prometheus數據同步到Elasticsearch,配置示例如下:
remote_write:
  - url: "http://127.0.0.1:9200/_time_stream/prom_write/prom_index"
    basic_auth:
     username: elastic
     password: xxxx

Prometheus通過Remote Write寫入數據到TimeStream索引,只支持默認的時序數據模型,即維度前綴是label.,指標前綴是metric.

Instant Query接口

API

GET  /_time_stream/prom/{index}/query
POST /_time_stream/prom/{index}/query

使用說明

Prometheus Instant Query接口,詳細信息請參見Prometheus instant queries

Range Query接口

API

GET  /_time_stream/prom/{index}/query_range
POST /_time_stream/prom/{index}/query_range

使用說明

Prometheus Range Query接口,詳細信息請參見Prometheus range queries

Series Metadata接口

API

GET  /_time_stream/prom/{index}/series
POST /_time_stream/prom/{index}/series

使用說明

Prometheus查詢時間線的接口,詳細信息請參見Prometheus finding series by label matchers

Labels Metadata接口

API

GET  /_time_stream/prom/{index}/labels
POST /_time_stream/prom/{index}/labels

使用說明

Prometheus查詢維度(label)列表的接口,詳細信息請參見Prometheus getting label names

Label Values Metadata接口

API

GET /_time_stream/prom/{index}/label/<label_name>/values

使用說明

Prometheus查詢維度對應values列表的接口,詳細信息請參見Prometheus querying label values

Metric Metadata接口

API

GET /_time_stream/prom/{index}/metadata

使用說明

Prometheus查詢指標(Metrics)列表的接口,詳細信息請參見Prometheus querying metric metadata

TimeStream PromQL支持情況

表達式支持情況

表達式類型是否支持說明
powOpbinaryOperator冪乘
unaryOpbinaryOperator正、負
multOpbinaryOperator乘、除、取模
addOpbinaryOperator加、減
compareOpbinaryOperator比較(==,>=, >, <=, <, !=)
andUnlessOpbinaryOperator集合運算(and、or、unless)
orOpbinaryOperator集合運算(or)
functionvector函數
aggregationvector聚合運算
instantSelectorvector瞬時選擇器
matrixSelectorvector向量選擇器
offsetvector偏移量
literalvector常量
labelMatchervector標簽匹配
groupinggroupgroup聚合,包括on、ignoring、group_left、group_right

Aggregation operator支持情況

Aggregation operator是否支持
sum(calculate sum over dimensions)
min(select minimum over dimensions)
max(select maximum over dimensions)
avg(calculate the average over dimensions)
group(all values in the resulting vector are 1)
stddev(calculate population standard deviation over dimensions)
stdvar(calculate population standard variance over dimensions)
count(count number of elements in the vector)
count_values(count number of elements with the same value)
bottomk(smallest k elements by sample value)
topk(largest k elements by sample value)
quantile(calculate φ-quantile (0 ≤ φ ≤ 1) over dimensions)

Function支持情況

Function是否支持
abs(v instant-vector)
absent(v instant-vector)
absent_over_time(v range-vector)
ceil(v instant-vector)
changes(v range-vector)
clamp(v instant-vector, min scalar, max scalar)
clamp_max(v instant-vector, max scalar)
clamp_min(v instant-vector, min scalar)
day_of_month(v=vector(time()) instant-vector)
day_of_week(v=vector(time()) instant-vector)
days_in_month(v=vector(time()) instant-vector)
delta(v range-vector)
deriv(v range-vector)
exp(v instant-vector)
floor(v instant-vector)
histogram_quantile(φ scalar, b instant-vector)
holt_winters(v range-vector, sf scalar, tf scalar)
hour(v=vector(time()) instant-vector)
idelta(v range-vector)
increase(v range-vector)
irate(v range-vector)
label_join(v instant-vector, dst_label string, separator string, src_label_1 string, src_label_2 string, ...)
label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string)
ln(v instant-vector)
log2(v instant-vector)
log10(v instant-vector)
minute(v=vector(time()) instant-vector)
month(v=vector(time()) instant-vector)
predict_linear(v range-vector, t scalar)
rate(v range-vector)
resets(v range-vector)
round(v instant-vector, to_nearest=1 scalar)
scalar(v instant-vector)
sgn(v instant-vector)
sort(v instant-vector)
sort_desc()
sqrt(v instant-vector)
time()
timestamp(v instant-vector)
vector(s scalar)
year(v=vector(time()) instant-vector)
avg_over_time(range-vector)
min_over_time(range-vector)
max_over_time(range-vector)
sum_over_time(range-vector)
count_over_time(range-vector)
quantile_over_time(scalar, range-vector)
stddev_over_time(range-vector)
stdvar_over_time(range-vector)
last_over_time(range-vector)
present_over_time(range-vector)
acos(v instant-vector)
acosh(v instant-vector)
asin(v instant-vector)
asinh(v instant-vector)
atan(v instant-vector)
atanh(v instant-vector)
cos(v instant-vector)
cosh(v instant-vector)
sin(v instant-vector)
sinh(v instant-vector)
tan(v instant-vector)
tanh(v instant-vector)
deg(v instant-vector)
pi()
rad(v instant-vector)