diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md index 7f91d6a8cdad..a4f630c562f0 100644 --- a/docs/en/changes/changes.md +++ b/docs/en/changes/changes.md @@ -105,7 +105,8 @@ - `memory_swap_percentage` -> `memory_virtual_memory_percentage` * Fix/Change UI init setting for Windows Swap -> Virtual Memory * Fix `Memory Swap Usage`/`Virtual Memory Usage` display with UI init.(Linux/Windows) -* Fix inaccurate APISIX metrics + +* Fix inaccurate APISIX metrics. * Fix inaccurate MongoDB Metrics. * Support Apache ActiveMQ server monitoring. * Add Service Hierarchy auto matching layer relationships (upper -> lower) as following: @@ -114,6 +115,7 @@ * MQE query: make metadata not return `null`. * MQE labeled metrics Binary Operation: return empty value if the labels not match rather than report error. * Fix inaccurate Hierarchy of RabbitMQ Server monitoring metrics. +* Fix inaccurate MySQL/MariaDB, Redis, PostgreSQL metrics. #### UI diff --git a/docs/en/setup/backend/backend-mysql-monitoring.md b/docs/en/setup/backend/backend-mysql-monitoring.md index 79e636515dcd..262737c9f5da 100644 --- a/docs/en/setup/backend/backend-mysql-monitoring.md +++ b/docs/en/setup/backend/backend-mysql-monitoring.md @@ -17,19 +17,19 @@ SkyWalking leverages prometheus/mysqld_exporter for collecting metrics data. It MySQL/MariaDB monitoring provides monitoring of the status and resources of the MySQL/MariaDB server. MySQL/MariaDB cluster is cataloged as a `Layer: MYSQL` `Service` in OAP. Each MySQL/MariaDB server is cataloged as an `Instance` in OAP. #### Supported Metrics -| Monitoring Panel | Unit | Metric Name | Description | Data Source | -|-----|------|-----|-----|-----| -| MySQL Uptime | day | meter_mysql_uptime | The MySQL startup time | mysqld_exporter| -| Max Connections | | meter_mysql_max_connections | The max number of connections. | mysqld_exporter| -| Innodb Buffer Pool Size | MB | meter_mysql_innodb_buffer_pool_size | The buffer pool size in Innodb engine | mysqld_exporter| -| Thread Cache Size | | meter_mysql_thread_cache_size | The size of thread cache | mysqld_exporter| -| Current QPS| | meter_mysql_qps | Queries Per Second | mysqld_exporter| -| Current TPS | | meter_mysql_tps | Transactions Per Second | mysqld_exporter| +| Monitoring Panel | Unit | Metric Name | Description | Data Source | +|-----|------|--------------------------------------------------------------------------------------------------------------------------------------------------|-----|-----| +| MySQL Uptime | day | meter_mysql_uptime | The MySQL startup time | mysqld_exporter| +| Max Connections | | meter_mysql_max_connections | The max number of connections. | mysqld_exporter| +| Innodb Buffer Pool Size | MB | meter_mysql_innodb_buffer_pool_size | The buffer pool size in Innodb engine | mysqld_exporter| +| Thread Cache Size | | meter_mysql_thread_cache_size | The size of thread cache | mysqld_exporter| +| Current QPS| | meter_mysql_qps | Queries Per Second | mysqld_exporter| +| Current TPS | | meter_mysql_tps | Transactions Per Second | mysqld_exporter| | Commands Rate | | meter_mysql_commands_insert_rate
meter_mysql_commands_select_rate
meter_mysql_commands_delete_rate
meter_mysql_commands_update_rate | The rate of total number of insert/select/delete/update executed by the current server | mysqld_exporter| -| Threads | | meter_mysql_threads_connected
meter_mysql_threads_created
meter_mysql_threads_cached
meter_mysql_threads_running | The number of currently open connections(threads_connected)
The number of threads created(threads_created)
The number of threads in the thread cache(threads_cached)
The number of threads that are not sleeping(threads_running) | mysqld_exporter| -| Connects | | meter_mysql_connects_available
meter_mysql_connects_aborted | The number of available connections(connects_available)
The number of MySQL instance connection rejections(connects_aborted)| mysqld_exporter| -| Connection Errors | | meter_mysql_connection_errors_internal
meter_mysql_connection_errors_max_connections | Errors due to exceeding the max_connections(connection_errors_max_connections)
Error caused by internal system(connection_errors_internal) | mysqld_exporter| -| Slow Queries Rate | | meter_mysql_slow_queries_rate | The rate of slow queries | mysqld_exporter| +| Threads | | meter_mysql_threads_connected
meter_mysql_threads_created
meter_mysql_threads_cached
meter_mysql_threads_running | The number of currently open connections(threads_connected)
The number of threads created(threads_created)
The number of threads in the thread cache(threads_cached)
The number of threads that are not sleeping(threads_running) | mysqld_exporter| +| Connects | | meter_mysql_max_connections
meter_mysql_status_thread_connected
meter_mysql_connects_aborted | The number of available connections(connects_available)
The number of MySQL instance connection rejections(connects_aborted)| mysqld_exporter| +| Connection Errors | | meter_mysql_connection_errors_internal
meter_mysql_connection_errors_max_connections | Errors due to exceeding the max_connections(connection_errors_max_connections)
Error caused by internal system(connection_errors_internal) | mysqld_exporter| +| Slow Queries Rate | | meter_mysql_slow_queries_rate | The rate of slow queries | mysqld_exporter| ### Customizations You can customize your own metrics/expression/dashboard panel. diff --git a/docs/en/setup/backend/backend-redis-monitoring.md b/docs/en/setup/backend/backend-redis-monitoring.md index ef5a2198bcfd..54b1f931af24 100644 --- a/docs/en/setup/backend/backend-redis-monitoring.md +++ b/docs/en/setup/backend/backend-redis-monitoring.md @@ -17,19 +17,19 @@ SkyWalking leverages redis-exporter for collecting metrics data from Redis. It l Redis monitoring provides monitoring of the status and resources of the Redis server. Redis cluster is cataloged as a `Layer: REDIS` `Service` in OAP. Each Redis server is cataloged as an `Instance` in OAP. #### Supported Metrics -| Monitoring Panel | Unit | Metric Name | Description | Data Source | -|-----------------------------------|--------|---------------------------------------------------------------------------------------------------|----------------------------------------------------|----------------| -| Uptime | day | meter_redis_uptime | The uptime of Redis. | redis-exporter | -| Connected Clients | | meter_redis_connected_clients | The number of connected clients. | redis-exporter | -| Blocked Clients | | meter_redis_blocked_clients | The number of blocked clients. | redis-exporter | -| Memory Max Bytes | MB | meter_redis_memory_max_bytes | The max bytes of memory. | redis-exporter | -| Hits Rate | % | meter_redis_hit_rate | Hit rate of redis when used as a cache. | redis-exporter | -| Average Time Spend By Command | second | meter_redis_average_time_spent_by_command | Average time to execute various types of commands. | redis-exporter | -| Total Commands Trend | | meter_redis_total_commands_rate | The Trend of total commands. | redis-exporter | +| Monitoring Panel | Unit | Metric Name | Description | Data Source | +|-----------------------------------|--------|--------------------------------------------------------------------------------------------------|----------------------------------------------------|----------------| +| Uptime | day | meter_redis_uptime | The uptime of Redis. | redis-exporter | +| Connected Clients | | meter_redis_connected_clients | The number of connected clients. | redis-exporter | +| Blocked Clients | | meter_redis_blocked_clients | The number of blocked clients. | redis-exporter | +| Memory Max Bytes | MB | meter_redis_memory_max_bytes | The max bytes of memory. | redis-exporter | +| Hits Rate | % | meter_redis_hit_rate | Hit rate of redis when used as a cache. | redis-exporter | +| Average Time Spend By Command | second | meter_redis_average_time_spent_by_command | Average time to execute various types of commands. | redis-exporter | +| Total Commands Trend | | meter_redis_total_commands_rate | The Trend of total commands. | redis-exporter | | DB keys | | meter_redis_evicted_keys_total
meter_redis_expired_keys_total
meter_redis_db_keys | The number of Expired / Evicted / total keys. | redis-exporter | -| Net Input/Output Bytes | KB | meter_redis_net_input_bytes
meter_redis_net_output_bytes | Total bytes of input / output of redis net. | redis-exporter | -| Memory Usage | % | meter_redis_memory_usage | Percentage of used memory. | redis-exporter | -| Total Time Spend By Command Trend | | meter_redis_commands_duration_seconds_total_rate | The trend of total time spend by command | redis-exporter | +| Net Input/Output Bytes | KB | meter_redis_net_input_bytes
meter_redis_net_output_bytes | Total bytes of input / output of redis net. | redis-exporter | +| Memory Usage | % | meter_redis_memory_used_bytes
meter_redis_memory_max_bytes | Percentage of used memory. | redis-exporter | +| Total Time Spend By Command Trend | | meter_redis_commands_duration
meter_redis_commands_total | The trend of total time spend by command | redis-exporter | ### Customizations You can customize your own metrics/expression/dashboard panel. diff --git a/oap-server/server-starter/src/main/resources/otel-rules/mysql/mysql-service.yaml b/oap-server/server-starter/src/main/resources/otel-rules/mysql/mysql-service.yaml index 814f390d08bb..642a08591871 100644 --- a/oap-server/server-starter/src/main/resources/otel-rules/mysql/mysql-service.yaml +++ b/oap-server/server-starter/src/main/resources/otel-rules/mysql/mysql-service.yaml @@ -34,39 +34,41 @@ metricPrefix: meter_mysql metricsRules: # database throughput - name: commands_insert_rate - exp: mysql_global_status_commands_total.tagEqual('command','insert').rate('PT1M') + exp: mysql_global_status_commands_total.tagEqual('command','insert').sum(['service_instance_id','host_name']).rate('PT1M') - name: commands_select_rate - exp: mysql_global_status_commands_total.tagEqual('command','select').rate('PT1M') + exp: mysql_global_status_commands_total.tagEqual('command','select').sum(['service_instance_id','host_name']).rate('PT1M') - name: commands_delete_rate - exp: mysql_global_status_commands_total.tagEqual('command','delete').rate('PT1M') + exp: mysql_global_status_commands_total.tagEqual('command','delete').sum(['service_instance_id','host_name']).rate('PT1M') - name: commands_update_rate - exp: mysql_global_status_commands_total.tagEqual('command','update').rate('PT1M') + exp: mysql_global_status_commands_total.tagEqual('command','update').sum(['service_instance_id','host_name']).rate('PT1M') - name: qps - exp: mysql_global_status_queries.rate('PT1M') + exp: mysql_global_status_queries.rate('PT1M').sum(['service_instance_id','host_name']) - name: tps - exp: mysql_global_status_commands_total.tagMatch('command','rollback|commit').sum(['host_name']).rate('PT1M') + exp: mysql_global_status_commands_total.tagMatch('command','rollback|commit').sum(['host_name', 'service_instance_id']).rate('PT1M') # connections ## threads - name: threads_connected - exp: mysql_global_status_threads_connected + exp: mysql_global_status_threads_connected.sum(['service_instance_id','host_name']) - name: threads_created - exp: mysql_global_status_threads_created + exp: mysql_global_status_threads_created.sum(['service_instance_id','host_name']) - name: threads_running - exp: mysql_global_status_threads_running + exp: mysql_global_status_threads_running.sum(['service_instance_id','host_name']) - name: threads_cached - exp: mysql_global_status_threads_cached + exp: mysql_global_status_threads_cached.sum(['service_instance_id','host_name']) ## connect - name: connects_aborted - exp: mysql_global_status_aborted_connects - - name: connects_available - exp: mysql_global_variables_max_connections.sum(['host_name']) - mysql_global_status_threads_connected.sum(['host_name']) + exp: mysql_global_status_aborted_connects.sum(['service_instance_id','host_name']) + - name: max_connections + exp: mysql_global_variables_max_connections.sum(['host_name','service_instance_id']) + - name: status_thread_connected + exp: mysql_global_status_threads_connected.sum(['host_name','service_instance_id']) - name: connection_errors_max_connections - exp: mysql_global_status_connection_errors_total.tagEqual('error','max_connection') + exp: mysql_global_status_connection_errors_total.tagEqual('error','max_connection').sum(['service_instance_id','host_name']) - name: connection_errors_internal - exp: mysql_global_status_connection_errors_total.tagEqual('error','internal') + exp: mysql_global_status_connection_errors_total.tagEqual('error','internal').sum(['service_instance_id','host_name']) # slow queries - name: slow_queries_rate - exp: mysql_global_status_slow_queries.rate('PT1M') + exp: mysql_global_status_slow_queries.sum(['service_instance_id','host_name']).rate('PT1M') diff --git a/oap-server/server-starter/src/main/resources/otel-rules/postgresql/postgresql-instance.yaml b/oap-server/server-starter/src/main/resources/otel-rules/postgresql/postgresql-instance.yaml index b36349c0ffd1..2005cce99bfd 100644 --- a/oap-server/server-starter/src/main/resources/otel-rules/postgresql/postgresql-instance.yaml +++ b/oap-server/server-starter/src/main/resources/otel-rules/postgresql/postgresql-instance.yaml @@ -104,12 +104,12 @@ metricsRules: ## buffers - name: instance_buffers_checkpoint - exp: pg_stat_bgwriter_buffers_checkpoint.rate('PT1M') + exp: pg_stat_bgwriter_buffers_checkpoint_total.rate('PT1M') - name: instance_buffers_clean - exp: pg_stat_bgwriter_buffers_clean.rate('PT1M') + exp: pg_stat_bgwriter_buffers_clean_total.rate('PT1M') - name: instance_buffers_backend_fsync - exp: pg_stat_bgwriter_buffers_backend_fsync.rate('PT1M') + exp: pg_stat_bgwriter_buffers_backend_fsync_total.rate('PT1M') - name: instance_buffers_alloc - exp: pg_stat_bgwriter_buffers_alloc.rate('PT1M') + exp: pg_stat_bgwriter_buffers_alloc_total.rate('PT1M') - name: instance_buffers_backend - exp: pg_stat_bgwriter_buffers_backend.rate('PT1M') + exp: pg_stat_bgwriter_buffers_backend_total.rate('PT1M') diff --git a/oap-server/server-starter/src/main/resources/otel-rules/postgresql/postgresql-service.yaml b/oap-server/server-starter/src/main/resources/otel-rules/postgresql/postgresql-service.yaml index 1dc9e3e388fb..60b705a97107 100644 --- a/oap-server/server-starter/src/main/resources/otel-rules/postgresql/postgresql-service.yaml +++ b/oap-server/server-starter/src/main/resources/otel-rules/postgresql/postgresql-service.yaml @@ -46,7 +46,7 @@ metricsRules: exp: pg_stat_database_tup_returned.sum(['service_instance_id','host_name']).rate('PT1M') ## locks - name: locks_count - exp: pg_locks_count.tag({tags -> tags.mode = tags.datname + ":" + tags.mode}).sum(['service_instance_id','host_name']) + exp: pg_locks_count.sum(['service_instance_id','host_name']) ## sessions - name: active_sessions @@ -68,13 +68,13 @@ metricsRules: ## checkpoint - name: checkpoint_write_time_rate - exp: pg_stat_bgwriter_checkpoint_write_time_total.rate('PT1M') + exp: pg_stat_bgwriter_checkpoint_write_time_total.rate('PT1M').sum(['service_instance_id','host_name']) - name: checkpoint_sync_time_rate - exp: pg_stat_bgwriter_checkpoint_sync_time_total.rate('PT1M') + exp: pg_stat_bgwriter_checkpoint_sync_time_total.rate('PT1M').sum(['service_instance_id','host_name']) - name: checkpoint_req_rate - exp: pg_stat_bgwriter_checkpoints_req_total.rate('PT1M') + exp: pg_stat_bgwriter_checkpoints_req_total.rate('PT1M').sum(['service_instance_id','host_name']) - name: checkpoints_timed_rate - exp: pg_stat_bgwriter_checkpoints_timed_total.rate('PT1M') + exp: pg_stat_bgwriter_checkpoints_timed_total.rate('PT1M').sum(['service_instance_id','host_name']) ## conflicts and deadlocks - name: conflicts_rate @@ -84,12 +84,12 @@ metricsRules: ## buffers - name: buffers_checkpoint - exp: pg_stat_bgwriter_buffers_checkpoint.rate('PT1M') + exp: pg_stat_bgwriter_buffers_checkpoint_total.rate('PT1M').sum(['service_instance_id','host_name']) - name: buffers_clean - exp: pg_stat_bgwriter_buffers_clean.rate('PT1M') + exp: pg_stat_bgwriter_buffers_clean_total.rate('PT1M').sum(['service_instance_id','host_name']) - name: buffers_backend_fsync - exp: pg_stat_bgwriter_buffers_backend_fsync.rate('PT1M') + exp: pg_stat_bgwriter_buffers_backend_fsync_total.rate('PT1M').sum(['service_instance_id','host_name']) - name: buffers_alloc - exp: pg_stat_bgwriter_buffers_alloc.rate('PT1M') + exp: pg_stat_bgwriter_buffers_alloc_total.rate('PT1M').sum(['service_instance_id','host_name']) - name: buffers_backend - exp: pg_stat_bgwriter_buffers_backend.rate('PT1M') + exp: pg_stat_bgwriter_buffers_backend_total.rate('PT1M').sum(['service_instance_id','host_name']) diff --git a/oap-server/server-starter/src/main/resources/otel-rules/redis/redis-service.yaml b/oap-server/server-starter/src/main/resources/otel-rules/redis/redis-service.yaml index 0a9d4b9b5263..8181ac0ccee4 100644 --- a/oap-server/server-starter/src/main/resources/otel-rules/redis/redis-service.yaml +++ b/oap-server/server-starter/src/main/resources/otel-rules/redis/redis-service.yaml @@ -33,34 +33,38 @@ expSuffix: tag({tags -> tags.host_name = 'redis::' + tags.host_name}).service([ metricPrefix: meter_redis metricsRules: - name: uptime - exp: redis_uptime_in_seconds.max(['host_name']) + exp: redis_uptime_in_seconds.max(['host_name','service_instance_id']) - name: connected_clients - exp: redis_connected_clients.sum(['host_name']) + exp: redis_connected_clients.sum(['host_name','service_instance_id']) - name: blocked_clients - exp: redis_blocked_clients.sum(['host_name']) - - name: memory_usage - exp: redis_memory_used_bytes.sum(['host_name']) * 100 / redis_memory_max_bytes.sum(['host_name']) + exp: redis_blocked_clients.sum(['host_name','service_instance_id']) + - name: memory_used_bytes + exp: redis_memory_used_bytes.sum(['host_name','service_instance_id']) + - name: memory_max_bytes + exp: redis_memory_max_bytes.sum(['host_name','service_instance_id']) - name: total_commands_rate - exp: redis_commands_total.sum(['cmd','host_name']).rate('PT1M') + exp: redis_commands_total.sum(['cmd','host_name','service_instance_id']).rate('PT1M') - name: hit_rate - exp: redis_keyspace_hits_total * 100 / (redis_keyspace_misses_total + redis_keyspace_hits_total) + exp: (redis_keyspace_hits_total * 100 / (redis_keyspace_misses_total + redis_keyspace_hits_total)).sum(['service_instance_id','host_name']) - name: net_input_bytes_total - exp: redis_net_input_bytes_total.sum(['host_name']).rate('PT5M') + exp: redis_net_input_bytes_total.sum(['host_name','service_instance_id']).rate('PT5M') - name: net_output_bytes_total - exp: redis_net_output_bytes_total.sum(['host_name']).rate('PT5M') + exp: redis_net_output_bytes_total.sum(['host_name','service_instance_id']).rate('PT5M') - name: db_keys - exp: redis_db_keys.sum(['host_name']) + exp: redis_db_keys.sum(['host_name','service_instance_id']) - name: expired_keys_total - exp: redis_expired_keys_total.sum(['host_name']) + exp: redis_expired_keys_total.sum(['host_name','service_instance_id']) - name: evicted_keys_total - exp: redis_evicted_keys_total.sum(['host_name']) + exp: redis_evicted_keys_total.sum(['host_name','service_instance_id']) - - name: average_time_spent_by_command - exp: (redis_commands_duration_seconds_total.sum(['host_name','cmd']) / redis_commands_total.sum(['host_name','cmd'])).rate('PT1M') + - name: commands_duration + exp: redis_commands_duration_seconds_total.sum(['host_name','cmd','service_instance_id']) + - name: commands_total + exp: redis_commands_total.sum(['host_name','cmd','service_instance_id']) - name: commands_duration_seconds_total_rate - exp: redis_commands_duration_seconds_total.sum(['host_name','cmd']).rate('PT1M') + exp: redis_commands_duration_seconds_total.sum(['host_name','cmd','service_instance_id']).rate('PT1M') diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/mysql/mysql-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/mysql/mysql-service.json index 30a8eabaff33..d0b16e64a415 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/mysql/mysql-service.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/mysql/mysql-service.json @@ -38,7 +38,7 @@ } ], "expressions": [ - "meter_mysql_qps" + "aggregate_labels(meter_mysql_qps,sum)" ] }, { @@ -65,7 +65,7 @@ } ], "expressions": [ - "meter_mysql_tps" + "aggregate_labels(meter_mysql_tps,sum)" ] }, { @@ -99,10 +99,10 @@ } ], "expressions": [ - "meter_mysql_commands_insert_rate", - "meter_mysql_commands_delete_rate", - "meter_mysql_commands_select_rate", - "meter_mysql_commands_update_rate" + "aggregate_labels(meter_mysql_commands_insert_rate,sum)", + "aggregate_labels(meter_mysql_commands_delete_rate,sum)", + "aggregate_labels(meter_mysql_commands_select_rate,sum)", + "aggregate_labels(meter_mysql_commands_update_rate,sum)" ] }, { @@ -136,10 +136,10 @@ } ], "expressions": [ - "meter_mysql_threads_cached", - "meter_mysql_threads_running", - "meter_mysql_threads_created", - "meter_mysql_threads_connected" + "aggregate_labels(meter_mysql_threads_cached,sum)", + "aggregate_labels(meter_mysql_threads_running,sum)", + "aggregate_labels(meter_mysql_threads_created,sum)", + "aggregate_labels(meter_mysql_threads_connected,sum)" ] }, { @@ -169,8 +169,8 @@ } ], "expressions": [ - "meter_mysql_connects_available", - "meter_mysql_connects_aborted" + "aggregate_labels(meter_mysql_max_connections,sum)-aggregate_labels(meter_mysql_status_thread_connected,sum)", + "aggregate_labels(meter_mysql_connects_aborted,sum)" ] }, { @@ -197,7 +197,7 @@ } ], "expressions": [ - "meter_mysql_slow_queries_rate" + "aggregate_labels(meter_mysql_slow_queries_rate,sum)" ] }, { @@ -227,8 +227,8 @@ } ], "expressions": [ - "meter_mysql_connection_errors_internal", - "meter_mysql_connection_errors_max_connections" + "aggregate_labels(meter_mysql_connection_errors_internal,sum)", + "aggregate_labels(meter_mysql_connection_errors_max_connections,sum)" ] } ] @@ -295,10 +295,10 @@ "isRoot": false, "isDefault": true, "expressions": [ - "avg(meter_mysql_commands_select_rate)", - "avg(meter_mysql_commands_insert_rate)", - "avg(meter_mysql_commands_update_rate)", - "avg(meter_mysql_commands_delete_rate)" + "avg(aggregate_labels(meter_mysql_commands_select_rate,sum))", + "avg(aggregate_labels(meter_mysql_commands_insert_rate,sum))", + "avg(aggregate_labels(meter_mysql_commands_update_rate,sum))", + "avg(aggregate_labels(meter_mysql_commands_delete_rate,sum))" ], "expressionsConfig": [ { @@ -317,7 +317,8 @@ "unit": "rows / s", "label": "Delete" } - ] + ], + "id": "MySQL-Service" } } -] +] \ No newline at end of file diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/postgresql/postgresql-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/postgresql/postgresql-service.json index 6a16add84c40..2c37473d47ab 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/postgresql/postgresql-service.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/postgresql/postgresql-service.json @@ -31,7 +31,12 @@ "title": "Fetched Rows Trend (rows per second)" }, "expressions": [ - "meter_pg_fetched_rows_rate" + "aggregate_labels(meter_pg_fetched_rows_rate,sum)" + ], + "metricConfig": [ + { + "label": "Feched Rows Rate" + } ] }, { @@ -51,7 +56,12 @@ "title": "Inserted Rows Trend (rows per second)" }, "expressions": [ - "meter_pg_inserted_rows_rate" + "aggregate_labels(meter_pg_inserted_rows_rate,sum)" + ], + "metricConfig": [ + { + "label": "Inserted Rows Rate" + } ] }, { @@ -90,11 +100,11 @@ } ], "expressions": [ - "meter_pg_buffers_checkpoint", - "meter_pg_buffers_clean", - "meter_pg_buffers_backend_fsync", - "meter_pg_buffers_alloc", - "meter_pg_buffers_backend" + "aggregate_labels(meter_pg_buffers_checkpoint,sum)", + "aggregate_labels(meter_pg_buffers_clean,sum)", + "aggregate_labels(meter_pg_buffers_backend_fsync,sum)", + "aggregate_labels(meter_pg_buffers_alloc,sum)", + "aggregate_labels(meter_pg_buffers_backend,sum)" ] }, { @@ -116,7 +126,12 @@ "title": "Updated Rows Trend (rows per second)" }, "expressions": [ - "meter_pg_updated_rows_rate" + "aggregate_labels(meter_pg_updated_rows_rate,sum)" + ], + "metricConfig": [ + { + "label": "Updated Rows Rate" + } ] }, { @@ -136,7 +151,12 @@ "title": "Deleted Rows Trend (rows per second)" }, "expressions": [ - "meter_pg_deleted_rows_rate" + "aggregate_labels(meter_pg_deleted_rows_rate,sum)" + ], + "metricConfig": [ + { + "label": "Deleted Rows Rate" + } ] }, { @@ -156,7 +176,12 @@ "title": "Returned Rows Trend (rows per second)" }, "expressions": [ - "meter_pg_returned_rows_rate" + "aggregate_labels(meter_pg_returned_rows_rate,sum)" + ], + "metricConfig": [ + { + "label": "Returned Rows Rate" + } ] }, { @@ -178,7 +203,12 @@ "title": "Temporary Files Trend (per second)" }, "expressions": [ - "meter_pg_temporary_files_rate" + "aggregate_labels(meter_pg_temporary_files_rate,sum)" + ], + "metricConfig": [ + { + "label": "Temporary Files Trend" + } ] }, { @@ -200,7 +230,12 @@ "title": "Committed Transactions Trend (per second)" }, "expressions": [ - "meter_pg_committed_transactions_rate" + "aggregate_labels(meter_pg_committed_transactions_rate,sum)" + ], + "metricConfig": [ + { + "label": "Committed Transactions Rate" + } ] }, { @@ -222,7 +257,12 @@ "title": "Rolled Back Transactions Trend (per second)" }, "expressions": [ - "meter_pg_rolled_back_transactions_rate" + "aggregate_labels(meter_pg_rolled_back_transactions_rate,sum)" + ], + "metricConfig": [ + { + "label": "Rolled Back Transactions Rate" + } ] }, { @@ -244,7 +284,12 @@ "title": "Cache Hit Rate (%)" }, "expressions": [ - "meter_pg_cache_hit_rate" + "aggregate_labels(meter_pg_cache_hit_rate,sum)" + ], + "metricConfig": [ + { + "label": "Cache Hit Rate" + } ] }, { @@ -280,10 +325,10 @@ } ], "expressions": [ - "meter_pg_checkpoint_sync_time_rate", - "meter_pg_checkpoints_timed_rate", - "meter_pg_checkpoint_req_rate", - "meter_pg_checkpoint_write_time_rate" + "aggregate_labels(meter_pg_checkpoint_sync_time_rate,sum)", + "aggregate_labels(meter_pg_checkpoints_timed_rate,sum)", + "aggregate_labels(meter_pg_checkpoint_req_rate,sum)", + "aggregate_labels(meter_pg_checkpoint_write_time_rate,sum)" ] }, { @@ -305,7 +350,12 @@ "title": "Conflicts Trend (per second)" }, "expressions": [ - "meter_pg_conflicts_rate" + "aggregate_labels(meter_pg_conflicts_rate,sum)" + ], + "metricConfig": [ + { + "label": "Conflicts Rate" + } ] }, { @@ -327,7 +377,12 @@ "title": "Deadlocks Trend (per second)" }, "expressions": [ - "meter_pg_deadlocks_rate" + "aggregate_labels(meter_pg_deadlocks_rate,sum)" + ], + "metricConfig": [ + { + "label": "Deadlocks Rate" + } ] }, { @@ -349,7 +404,12 @@ "title": "Active Sessions" }, "expressions": [ - "meter_pg_active_sessions" + "aggregate_labels(meter_pg_active_sessions,sum)" + ], + "metricConfig": [ + { + "label": "Active Sessions" + } ] }, { @@ -371,7 +431,12 @@ "title": "Locks" }, "expressions": [ - "meter_pg_locks_count" + "aggregate_labels(meter_pg_locks_count,sum)" + ], + "metricConfig": [ + { + "label": "Locks Count" + } ] }, { @@ -393,7 +458,12 @@ "title": "Idle Sessions" }, "expressions": [ - "meter_pg_idle_sessions" + "aggregate_labels(meter_pg_idle_sessions,sum)" + ], + "metricConfig": [ + { + "label": "Idle Sessions" + } ] } ] @@ -448,12 +518,14 @@ "layer": "POSTGRESQL", "entity": "Service", "name": "PostgreSQL-Service", + "id": "PostgreSQL-Service", + "isRoot": false, "isDefault": true, "expressions": [ - "avg(meter_pg_fetched_rows_rate)", - "avg(meter_pg_inserted_rows_rate)", - "avg(meter_pg_updated_rows_rate)", - "avg(meter_pg_deleted_rows_rate)" + "avg(aggregate_labels(meter_pg_fetched_rows_rate,sum))", + "avg(aggregate_labels(meter_pg_inserted_rows_rate,sum))", + "avg(aggregate_labels(meter_pg_updated_rows_rate,sum))", + "avg(aggregate_labels(meter_pg_deleted_rows_rate,sum))" ], "expressionsConfig": [ { @@ -475,4 +547,4 @@ ] } } -] +] \ No newline at end of file diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/redis/redis-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/redis/redis-service.json index 17588dd72dcc..7408dcb9fe5f 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/redis/redis-service.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/redis/redis-service.json @@ -31,7 +31,7 @@ "title": "Uptime (day)" }, "expressions": [ - "latest(meter_redis_uptime)/3600/24" + "latest(aggregate_labels(meter_redis_uptime,max))/3600/24" ] }, { @@ -51,7 +51,7 @@ "title": "Connected Clients" }, "expressions": [ - "latest(meter_redis_connected_clients)" + "latest(aggregate_labels(meter_redis_connected_clients,sum))" ] }, { @@ -62,10 +62,10 @@ "i": "2", "type": "Widget", "graph": { - "type": "Area", - "opacity": 0.4, - "showXAxis": true, - "showYAxis": true + "type": "Card", + "fontSize": 14, + "textAlign": "center", + "showUnit": true }, "widget": { "title": "Memory Usage (%)" @@ -76,7 +76,7 @@ } ], "expressions": [ - "meter_redis_memory_usage" + "latest(aggregate_labels(meter_redis_memory_used_bytes,sum)/aggregate_labels(meter_redis_memory_max_bytes,sum))*100" ] }, { @@ -98,7 +98,7 @@ "title": "Total Commands Trend" }, "expressions": [ - "meter_redis_total_commands_rate" + "aggregate_labels(meter_redis_total_commands_rate,sum(cmd))" ] }, { @@ -125,7 +125,7 @@ } ], "expressions": [ - "meter_redis_hit_rate" + "aggregate_labels(meter_redis_hit_rate,sum)" ] }, { @@ -155,8 +155,8 @@ "title": "Net Input / Output Bytes (KB)" }, "expressions": [ - "meter_redis_net_input_bytes_total/1024", - "meter_redis_net_output_bytes_total/1024" + "aggregate_labels(meter_redis_net_input_bytes_total,sum)/1024", + "aggregate_labels(meter_redis_net_output_bytes_total,sum)/1024" ] }, { @@ -189,9 +189,9 @@ } ], "expressions": [ - "meter_redis_db_keys", - "meter_redis_evicted_keys_total", - "meter_redis_expired_keys_total" + "aggregate_labels(meter_redis_db_keys,sum)", + "aggregate_labels(meter_redis_evicted_keys_total,sum)", + "aggregate_labels(meter_redis_expired_keys_total,sum)" ] }, { @@ -211,7 +211,7 @@ "title": "Blocked Clients" }, "expressions": [ - "latest(meter_redis_blocked_clients)" + "latest(aggregate_labels(meter_redis_blocked_clients,sum))" ] }, { @@ -233,7 +233,7 @@ "title": "Total Time Spent by Command Trend (sec)" }, "expressions": [ - "meter_redis_commands_duration_seconds_total_rate" + "aggregate_labels(meter_redis_commands_duration_seconds_total_rate,sum(cmd))" ] }, { @@ -255,7 +255,7 @@ "title": "Average Time Spent by Command / sec" }, "expressions": [ - "meter_redis_average_time_spent_by_command" + "aggregate_labels(meter_redis_commands_duration,sum(cmd))/aggregate_labels(meter_redis_commands_total,sum(cmd))" ] } ] @@ -311,4 +311,4 @@ "isRoot": false } } -] +] \ No newline at end of file diff --git a/test/e2e-v2/cases/mariadb/mariadb-cases.yaml b/test/e2e-v2/cases/mariadb/mariadb-cases.yaml index 28bb2f4bf26a..62f1d18b548e 100644 --- a/test/e2e-v2/cases/mariadb/mariadb-cases.yaml +++ b/test/e2e-v2/cases/mariadb/mariadb-cases.yaml @@ -20,29 +20,29 @@ cases: - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls expected: expected/service.yml # service metrics - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_commands_select_rate --service-name=mysql::db + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_commands_select_rate,sum)' --service-name=mysql::db expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_commands_insert_rate --service-name=mysql::db + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_commands_insert_rate,sum)' --service-name=mysql::db expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_commands_update_rate --service-name=mysql::db + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_commands_update_rate,sum)' --service-name=mysql::db expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_commands_delete_rate --service-name=mysql::db + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_commands_delete_rate,sum)' --service-name=mysql::db expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_qps --service-name=mysql::db + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_qps,sum)' --service-name=mysql::db expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_tps --service-name=mysql::db + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_tps,sum)' --service-name=mysql::db expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_threads_connected --service-name=mysql::db + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_threads_connected,sum)' --service-name=mysql::db expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_threads_created --service-name=mysql::db + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_threads_created,sum)' --service-name=mysql::db expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_threads_running --service-name=mysql::db + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_threads_running,sum)' --service-name=mysql::db expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_connects_aborted --service-name=mysql::db + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_connects_aborted,sum)' --service-name=mysql::db expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_connects_available --service-name=mysql::db + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_max_connections,sum)-aggregate_labels(meter_mysql_status_thread_connected,sum)' --service-name=mysql::db expected: expected/metrics-has-value.yml # instance metrics - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_instance_uptime --service-name=mysql::db --instance-name=mariadb-service:9104 diff --git a/test/e2e-v2/cases/mysql/mysql-cases.yaml b/test/e2e-v2/cases/mysql/mysql-cases.yaml index 2a6fcb17b411..4d7c4fcdade0 100644 --- a/test/e2e-v2/cases/mysql/mysql-cases.yaml +++ b/test/e2e-v2/cases/mysql/mysql-cases.yaml @@ -20,29 +20,29 @@ cases: - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls expected: expected/service.yml # service metrics - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_commands_select_rate --service-name=mysql::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_commands_select_rate,sum)' --service-name=mysql::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_commands_insert_rate --service-name=mysql::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_commands_insert_rate,sum)' --service-name=mysql::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_commands_update_rate --service-name=mysql::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_commands_update_rate,sum)' --service-name=mysql::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_commands_delete_rate --service-name=mysql::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_commands_delete_rate,sum)' --service-name=mysql::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_qps --service-name=mysql::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_qps,sum)' --service-name=mysql::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_tps --service-name=mysql::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_tps,sum)' --service-name=mysql::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_threads_connected --service-name=mysql::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_threads_connected,sum)' --service-name=mysql::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_threads_created --service-name=mysql::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_threads_created,sum)' --service-name=mysql::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_threads_running --service-name=mysql::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_threads_running,sum)' --service-name=mysql::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_connects_aborted --service-name=mysql::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_connects_aborted,sum)' --service-name=mysql::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_connects_available --service-name=mysql::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_mysql_max_connections,sum)-aggregate_labels(meter_mysql_status_thread_connected,sum)' --service-name=mysql::root[root] expected: expected/metrics-has-value.yml # instance metrics - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mysql_instance_uptime --service-name=mysql::root[root] --instance-name=mysql-service:9104 diff --git a/test/e2e-v2/cases/postgresql/postgresql-cases.yaml b/test/e2e-v2/cases/postgresql/postgresql-cases.yaml index 8aeacbcfacd9..b309d318aa7b 100644 --- a/test/e2e-v2/cases/postgresql/postgresql-cases.yaml +++ b/test/e2e-v2/cases/postgresql/postgresql-cases.yaml @@ -20,21 +20,21 @@ cases: - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls expected: expected/service.yml # service metrics - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_pg_cache_hit_rate --service-name=postgresql::postgres:5432 - expected: expected/metrics-has-value-label.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_pg_fetched_rows_rate --service-name=postgresql::postgres:5432 - expected: expected/metrics-has-value-label.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_pg_inserted_rows_rate --service-name=postgresql::postgres:5432 - expected: expected/metrics-has-value-label.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_pg_updated_rows_rate --service-name=postgresql::postgres:5432 - expected: expected/metrics-has-value-label.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_pg_returned_rows_rate --service-name=postgresql::postgres:5432 - expected: expected/metrics-has-value-label.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_pg_deleted_rows_rate --service-name=postgresql::postgres:5432 - expected: expected/metrics-has-value-label.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="aggregate_labels(meter_pg_cache_hit_rate,sum)" --service-name=postgresql::postgres:5432 + expected: expected/metrics-has-value.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="aggregate_labels(meter_pg_fetched_rows_rate,sum)" --service-name=postgresql::postgres:5432 + expected: expected/metrics-has-value.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="aggregate_labels(meter_pg_inserted_rows_rate,sum)" --service-name=postgresql::postgres:5432 + expected: expected/metrics-has-value.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="aggregate_labels(meter_pg_updated_rows_rate,sum)" --service-name=postgresql::postgres:5432 + expected: expected/metrics-has-value.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="aggregate_labels(meter_pg_returned_rows_rate,sum)" --service-name=postgresql::postgres:5432 + expected: expected/metrics-has-value.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="aggregate_labels(meter_pg_deleted_rows_rate,sum)" --service-name=postgresql::postgres:5432 + expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_pg_active_sessions --service-name=postgresql::postgres:5432 - expected: expected/metrics-has-value-label.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="aggregate_labels(meter_pg_active_sessions,sum)" --service-name=postgresql::postgres:5432 + expected: expected/metrics-has-value.yml # instance metrics - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_pg_instance_shared_buffers --service-name=postgresql::postgres:5432 --instance-name=postgres-exporter:9187 expected: expected/metrics-has-value.yml diff --git a/test/e2e-v2/cases/redis/expected/metrics-single-value.yml b/test/e2e-v2/cases/redis/expected/metrics-single-value.yml new file mode 100644 index 000000000000..1a70151859c6 --- /dev/null +++ b/test/e2e-v2/cases/redis/expected/metrics-single-value.yml @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +type: SINGLE_VALUE +results: + {{- contains .results }} + - metric: + labels: [] + values: + {{- contains .values }} + - id: {{ notEmpty .id }} + value: {{ .value }} + traceid: null + {{- end}} + {{- end}} +error: null diff --git a/test/e2e-v2/cases/redis/redis-cases.yaml b/test/e2e-v2/cases/redis/redis-cases.yaml index bb7f8e59fa31..40ca06184cb3 100644 --- a/test/e2e-v2/cases/redis/redis-cases.yaml +++ b/test/e2e-v2/cases/redis/redis-cases.yaml @@ -20,21 +20,21 @@ cases: - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls expected: expected/service.yml # service metrics - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_redis_uptime --service-name=redis::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='latest(aggregate_labels(meter_redis_uptime,max))' --service-name=redis::root[root] + expected: expected/metrics-single-value.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='latest(aggregate_labels(meter_redis_connected_clients,sum))' --service-name=redis::root[root] + expected: expected/metrics-single-value.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='latest(aggregate_labels(meter_redis_memory_used_bytes,sum)/aggregate_labels(meter_redis_memory_max_bytes,sum))' --service-name=redis::root[root] + expected: expected/metrics-single-value.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_redis_hit_rate,sum)' --service-name=redis::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_redis_connected_clients --service-name=redis::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_redis_net_input_bytes_total,sum)' --service-name=redis::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_redis_memory_usage --service-name=redis::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_redis_net_output_bytes_total,sum)' --service-name=redis::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_redis_hit_rate --service-name=redis::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_redis_db_keys,sum)' --service-name=redis::root[root] expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_redis_net_input_bytes_total --service-name=redis::root[root] - expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_redis_net_output_bytes_total --service-name=redis::root[root] - expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_redis_db_keys --service-name=redis::root[root] - expected: expected/metrics-has-value.yml - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_redis_expired_keys_total --service-name=redis::root[root] + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression='aggregate_labels(meter_redis_expired_keys_total,sum)' --service-name=redis::root[root] expected: expected/metrics-has-value.yml - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_redis_instance_uptime --service-name=redis::root[root] --instance-name=redis_exporter_1:9121 expected: expected/metrics-has-value.yml