如何使用JMETER

问题描述

我有API作为响应返回唯一ID。

我正在尝试在JMETER中以100个线程数运行此服务,并确保id返回值。

API:

GET: https://localhost:8080/transaction?createrandomExpireQuotes=true

响应正文:

{
   "quotes_Id" :"Q82817Dwewiiao0@asdfs2Aas2fdsdfde"
}

我只有后端侦听器并配置了InfluxDb,并且还从响应中提取了上面的quotes_id。

但是我试图将上述quotes_id传递给Influx db,并希望以表格式在Grafana仪表板中显示该值。

这可能吗?有人可以帮助我实现这一目标。

解决方法

默认情况下,JMeter将following metrics发送到InfluxDB:

15.1.1 Thread/Virtual Users metrics

Thread metrics are the following:

<rootMetricsPrefix>test.minAT
    Min active threads
<rootMetricsPrefix>test.maxAT
    Max active threads
<rootMetricsPrefix>test.meanAT
    Mean active threads
<rootMetricsPrefix>test.startedT
    Started threads
<rootMetricsPrefix>test.endedT
    Finished threads

15.1.2 Response times metrics

Response related metrics are the following:

<rootMetricsPrefix><samplerName>.ok.count
    Number of successful responses for sampler name
<rootMetricsPrefix><samplerName>.h.count
    Server hits per seconds,this metric cumulates Sample Result and Sub results (if using Transaction Controller,"Generate parent sampler" should be unchecked)
<rootMetricsPrefix><samplerName>.ok.min
    Min response time for successful responses of sampler name
<rootMetricsPrefix><samplerName>.ok.max
    Max response time for successful responses of sampler name
<rootMetricsPrefix><samplerName>.ok.avg
    Average response time for successful responses of sampler name.
<rootMetricsPrefix><samplerName>.ok.pct<percentileValue>
    Percentile computed for successful responses of sampler name. There will be one metric for each calculated value.
<rootMetricsPrefix><samplerName>.ko.count
    Number of failed responses for sampler name
<rootMetricsPrefix><samplerName>.ko.min
    Min response time for failed responses of sampler name
<rootMetricsPrefix><samplerName>.ko.max
    Max response time for failed responses of sampler name
<rootMetricsPrefix><samplerName>.ko.avg
    Average response time for failed responses of sampler name.
<rootMetricsPrefix><samplerName>.ko.pct<percentileValue>
    Percentile computed for failed responses of sampler name. There will be one metric for each calculated value.
<rootMetricsPrefix><samplerName>.a.count
    Number of responses for sampler name (sum of ok.count and ko.count)
<rootMetricsPrefix><samplerName>.sb.bytes
    Sent Bytes
<rootMetricsPrefix><samplerName>.rb.bytes
    Received Bytes
<rootMetricsPrefix><samplerName>.a.min
    Min response time for responses of sampler name (min of ok.count and ko.count)
<rootMetricsPrefix><samplerName>.a.max
    Max response time for responses of sampler name (max of ok.count and ko.count)
<rootMetricsPrefix><samplerName>.a.avg
    Average response time for responses of sampler name (avg of ok.count and ko.count)
<rootMetricsPrefix><samplerName>.a.pct<percentileValue>
    Percentile computed for responses of sampler name. There will be one metric for each calculated value. (calculated on the totals for OK and failed samples)

要发送除此以外的任何内容,您将需要扩展现有的Backend Listener实现或create your own listener