/_metric/${metric_name},${metric_name} 为新建的 metric 的名称。参数名称 | 必选 | 类型 | 描述 |
tags | 是 | map | 维度列,用于唯一标识数据,须至少包含一个维度,支持的数据类型:text(带有分词、全文索引的字符串)、string(不分词的字符串)、long、integer、short、byte、double、float、date、boolean。 格式如 {"region": "string","set": "long","host": "string"} |
time | 是 | map | 时间列相关配置,用于存储数据入库的唯一时间,例如 {"name": "timestamp", "format": "epoch_second"},填写时,需填写完整,name和format的值不能为空 |
fields | 否 | map | 数据列,用于存储数据,为了节省空间,建议使用最适合实际业务使用的类型,支持的数据类型:string(字符串)、long、integer、short、byte、double、float、date、boolean。 例如 {"cpu_usage":"float"} |
options | 否 | map | 常用的调优配置信息 例如 {"expire_day":7,"refresh_interval":"10s","number_of_shards":5,"number_of_replicas":1,"rolling_period":1,"max_string_length": 256,"default_date_format":"strict_date_optional_time","indexed_fields":["host"]} |
过期时间 | 子表时长 |
≤ 7天 | 1天 |
> 7天,≤ 20天 | 3天 |
> 20天,≤ 49天 | 7天 |
> 49天,≤ 3个月 | 15天 |
>3个月 | 30天 |
永不过期 | 30天 |
curl -u root:le201909 -H 'Content-Type:application/json' -X PUT 172.xx.xx.4:9201/_metric/ctsdb_test -d'{"tags":{"region":"string"},"time":{"name":"timestamp","format":"epoch_second"},"fields":{"cpuUsage":"float"},"options":{"expire_day":7,"refresh_interval":"10s","number_of_shards":5}}'
{"acknowledged": true,"message": "create ctsdb metric ctsdb_test success!"}
{"error": {"reason": "table ctsdb_test already exist","type": "metric_exception"},"status": 201}
文档反馈