mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-25 01:10:37 +00:00
refactor(otlp_metric): make otlp metric compatible with promql (#6543)
* chore: tmp save Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: minor update * chore: remove metric metadata and introduce shared attrs Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: replace . with _ in metric name Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: minor update & fix tests Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: add legacy mode param to otlp metrics Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: update test Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: update test & fix Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: add automatically legacy check for otlp metrics Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: fix clippy Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: typos Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: insert table options in compat mode & add test Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: check table options consistency Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: update test and add comments Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: minor tags update Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: minor update about scope labeling Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: update opts using header & update test Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: minor code refactor Signed-off-by: shuiyisong <xixing.sys@gmail.com> * chore: fix cr issue Signed-off-by: shuiyisong <xixing.sys@gmail.com> --------- Signed-off-by: shuiyisong <xixing.sys@gmail.com>
This commit is contained in:
@@ -81,12 +81,12 @@ mod test {
|
||||
assert_eq!(
|
||||
recordbatches.pretty_print().unwrap(),
|
||||
"\
|
||||
+------------+-------+--------------------+------------+-------------------------------+----------------+
|
||||
| resource | scope | telemetry_sdk_name | host | greptime_timestamp | greptime_value |
|
||||
+------------+-------+--------------------+------------+-------------------------------+----------------+
|
||||
| greptimedb | otel | java | testsevrer | 1970-01-01T00:00:00.000000100 | 100.0 |
|
||||
| greptimedb | otel | java | testserver | 1970-01-01T00:00:00.000000105 | 105.0 |
|
||||
+------------+-------+--------------------+------------+-------------------------------+----------------+",
|
||||
+----------------+---------------------+----------------+
|
||||
| container_name | greptime_timestamp | greptime_value |
|
||||
+----------------+---------------------+----------------+
|
||||
| testserver | 1970-01-01T00:00:00 | 105.0 |
|
||||
| testsevrer | 1970-01-01T00:00:00 | 100.0 |
|
||||
+----------------+---------------------+----------------+",
|
||||
);
|
||||
|
||||
let mut output = instance
|
||||
@@ -123,11 +123,11 @@ mod test {
|
||||
assert_eq!(
|
||||
recordbatches.pretty_print().unwrap(),
|
||||
"\
|
||||
+------------+-------+--------------------+------------+-------------------------------+----------------+
|
||||
| resource | scope | telemetry_sdk_name | host | greptime_timestamp | greptime_value |
|
||||
+------------+-------+--------------------+------------+-------------------------------+----------------+
|
||||
| greptimedb | otel | java | testserver | 1970-01-01T00:00:00.000000100 | 51.0 |
|
||||
+------------+-------+--------------------+------------+-------------------------------+----------------+",
|
||||
+------------+---------------------+----------------+
|
||||
| host | greptime_timestamp | greptime_value |
|
||||
+------------+---------------------+----------------+
|
||||
| testserver | 1970-01-01T00:00:00 | 51.0 |
|
||||
+------------+---------------------+----------------+",
|
||||
);
|
||||
|
||||
let mut output = instance
|
||||
@@ -141,24 +141,24 @@ mod test {
|
||||
assert_eq!(
|
||||
recordbatches.pretty_print().unwrap(),
|
||||
"\
|
||||
+------------+-------+--------------------+------------+-------------------------------+----------------+
|
||||
| resource | scope | telemetry_sdk_name | host | greptime_timestamp | greptime_value |
|
||||
+------------+-------+--------------------+------------+-------------------------------+----------------+
|
||||
| greptimedb | otel | java | testserver | 1970-01-01T00:00:00.000000100 | 4.0 |
|
||||
+------------+-------+--------------------+------------+-------------------------------+----------------+"
|
||||
+------------+---------------------+----------------+
|
||||
| host | greptime_timestamp | greptime_value |
|
||||
+------------+---------------------+----------------+
|
||||
| testserver | 1970-01-01T00:00:00 | 4.0 |
|
||||
+------------+---------------------+----------------+",
|
||||
);
|
||||
}
|
||||
|
||||
fn build_request() -> ExportMetricsServiceRequest {
|
||||
let data_points = vec![
|
||||
NumberDataPoint {
|
||||
attributes: vec![keyvalue("host", "testsevrer")],
|
||||
attributes: vec![keyvalue("container.name", "testsevrer")],
|
||||
time_unix_nano: 100,
|
||||
value: Some(Value::AsInt(100)),
|
||||
..Default::default()
|
||||
},
|
||||
NumberDataPoint {
|
||||
attributes: vec![keyvalue("host", "testserver")],
|
||||
attributes: vec![keyvalue("container.name", "testserver")],
|
||||
time_unix_nano: 105,
|
||||
value: Some(Value::AsInt(105)),
|
||||
..Default::default()
|
||||
|
||||
@@ -458,7 +458,7 @@ pub async fn setup_test_http_app_with_frontend_and_user_provider(
|
||||
.with_log_ingest_handler(instance.fe_instance().clone(), None, None)
|
||||
.with_logs_handler(instance.fe_instance().clone())
|
||||
.with_influxdb_handler(instance.fe_instance().clone())
|
||||
.with_otlp_handler(instance.fe_instance().clone())
|
||||
.with_otlp_handler(instance.fe_instance().clone(), true)
|
||||
.with_jaeger_handler(instance.fe_instance().clone())
|
||||
.with_greptime_config_options(instance.opts.to_toml().unwrap());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user