Mats Johansson
Mats Johansson

Reputation: 87

How to log "server exec time" = (latency - connect time)

How can I log (by using sample_variables=...,...) jdbc/server exec time which we define as (latency - connect time)?

We would like to use the metric for a custom graph in the Jmeter Reporting module.

Upvotes: 0

Views: 80

Answers (1)

Dmitri T
Dmitri T

Reputation: 168122

  1. Add the next line to user.properties file:

    sample_variables=execTime
    

    See Sample Variables user manual entry for more information

  2. Add JSR223 PostProcessor as a child of the request which "exec time" you want to measure or put it at the same level as other JDBC Request samplers (see JMeter Scoping Rules - The Ultimate Guide article for details)

    Put the following code into "Script" area:

    vars.putObject('execTime', prev.getLatency() - prev.getConnectTime())
    

    it will subtract connect time from latency and store the value into execTime JMeter Variable

  3. Now you should be able to follow instructions from Generating customs graphs over time JMeter user manual chapter

Upvotes: 2

Related Questions