You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

适配Gatling 3.9.0、Grafana 9.2.1的Grafana仪表盘是否存在?

适配Gatling 3.9.0 + Grafana 9.2.1 + InfluxDB 1.7.10的仪表盘解决方案

一、修改旧仪表盘适配当前环境

Grafana官网的旧仪表盘大多针对Gatling 2.x或更早版本,核心问题是InfluxDB的metrics字段、tag命名和结构变化。你可以选下载量较高的旧仪表盘(比如ID 1152)导入后调整:

  • 替换字段名:Gatling 3.x输出到InfluxDB的measurement统一为gatling,metrics通过metric tag区分(比如requestsPerSecond、responseTime),旧查询里的gatling_requests_per_second这类独立measurement要改成gatling + 对应metric过滤条件。
  • 调整tag变量:把仪表盘里的simulation变量替换为simulationName(Gatling 3.x的默认tag),确保下拉筛选能匹配数据。
  • 示例查询修改:
    旧RPS查询:SELECT mean("value") FROM "gatling_requests_per_second" WHERE $timeFilter GROUP BY time($__interval), "simulation"
    修改后:SELECT mean("requestsPerSecond") FROM "gatling" WHERE $timeFilter AND "metric"='requestsPerSecond' GROUP BY time($__interval), "simulationName", "requestName"

二、手动搭建核心指标仪表盘

如果修改旧仪表盘太麻烦,直接基于以下核心指标构建更高效:

  • 每秒请求数(RPS):
    SELECT mean("requestsPerSecond") FROM "gatling" WHERE $timeFilter AND "metric"='requestsPerSecond' GROUP BY time($__interval), "simulationName", "requestName"
    
  • 响应时间分位值(p50/p95/p99):
    SELECT percentile("responseTime", 95) FROM "gatling" WHERE $timeFilter AND "metric"='responseTime' GROUP BY time($__interval), "simulationName", "requestName"
    
  • 请求成功率:
    SELECT (sum("successfulRequests") / sum("totalRequests")) * 100 FROM "gatling" WHERE $timeFilter AND "metric"='requestsSummary' GROUP BY time($__interval), "simulationName"
    
  • 活跃用户数:
    SELECT mean("activeUsers") FROM "gatling" WHERE $timeFilter AND "metric"='activeUsers' GROUP BY time($__interval), "simulationName"
    
  • 错误统计:
    SELECT sum("failedRequests") FROM "gatling" WHERE $timeFilter AND "metric"='requestsSummary' GROUP BY time($__interval), "simulationName", "requestName"
    

三、先验证Gatling的InfluxDB输出配置

确保数据能正确写入InfluxDB,避免仪表盘无数据:

  1. 检查gatling.conf里的InfluxDB配置:
    data {
      writers = [console, file, influxdb]
      influxdb {
        url = "http://localhost:8086"
        database = "gatling"
        retentionPolicy = "autogen"
        writeInterval = 1
        tags {
          simulationName = "${simulationName}"
        }
      }
    }
    
  2. 用InfluxDB客户端确认数据:
    influx -database 'gatling' -execute 'SHOW MEASUREMENTS'
    influx -database 'gatling' -execute 'SELECT * FROM "gatling" LIMIT 10'
    
    确认能看到simulationName、requestName等tag,以及requestsPerSecond、responseTime等field。

四、社区适配版本参考

部分GitHub用户会fork旧仪表盘并更新适配Gatling 3.x,你可以搜索相关仓库获取调整后的JSON导入使用,但建议自己修改更可控,避免依赖第三方版本的兼容性问题。

内容的提问来源于stack exchange,提问作者perf_tester

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 03:27:39