You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Tong Sun <su...@gmail.com> on 2022/08/05 13:35:20 UTC
Any ways to change the request response time?
Hi,
Is it possible to change the request response time (via jsr223)?
I need to fetch one important number, and instead of trying to create a way
to report it somehow, I'm thinking the easiest way to report and track it
is to set the fetched number as the request's response time.
thanks
Re: Any ways to change the request response time?
Posted by Tong Sun <su...@gmail.com>.
Thanks,
Any ways to update the percentiles as well, those of 50;90;etc that
InfluxDb Backend influxdbMetricsSender uses and sends to the server please?
On Fri, Aug 5, 2022 at 10:21 AM Dmitri T <gl...@live.com> wrote:
> * Add JSR223 PostProcessor
> <
> https://jmeter.apache.org/usermanual/component_reference.html#JSR223_PostProcessor
> >
> as a child of the request which response time you want to modify
>
> * Put the following code into "Script" area:
>
>
> org.apache.commons.lang3.reflect.FieldUtils.writeField(prev,'elapsedTime',5L,true)
>
> * Replace *42* with the desired response time value
>
> * ....
>
> * Profit?
>
> In the above example *prev *stands for the *prev*ious SampleResult
> <
> https://jmeter.apache.org/api/org/apache/jmeter/samplers/SampleResult.html>,
>
> see Top 8 JMeter Java Classes You Should Be Using with Groovy
> <https://www.blazemeter.com/blog/jmeter-java-classes> article for more
> information on this and other JMeter API shorthands available for the
> JSR223 Test Elements
>
>
> On 8/5/2022 3:35 PM, Tong Sun wrote:
> > Hi,
> >
> > Is it possible to change the request response time (via jsr223)?
> >
> > I need to fetch one important number, and instead of trying to create a
> way
> > to report it somehow, I'm thinking the easiest way to report and track it
> > is to set the fetched number as the request's response time.
> >
> > thanks
> >
Re: Any ways to change the request response time?
Posted by Tong Sun <su...@gmail.com>.
On Fri, Aug 5, 2022 at 10:21 AM Dmitri T wrote:
> * Add JSR223 PostProcessor
> <
> https://jmeter.apache.org/usermanual/component_reference.html#JSR223_PostProcessor
> >
> as a child of the request which response time you want to modify
>
> * Put the following code into "Script" area:
>
>
> org.apache.commons.lang3.reflect.FieldUtils.writeField(prev,'elapsedTime',5L,true)
>
> * Replace *42* with the desired response time value
>
Thanks Dmitri.
By *42* you meant the "5L" in above jsr223 code, or there is another line?
Thanks
> * ....
>
> * Profit?
>
> In the above example *prev *stands for the *prev*ious SampleResult
> <
> https://jmeter.apache.org/api/org/apache/jmeter/samplers/SampleResult.html>,
>
> see Top 8 JMeter Java Classes You Should Be Using with Groovy
> <https://www.blazemeter.com/blog/jmeter-java-classes> article for more
> information on this and other JMeter API shorthands available for the
> JSR223 Test Elements
>
>
> On 8/5/2022 3:35 PM, Tong Sun wrote:
> > Hi,
> >
> > Is it possible to change the request response time (via jsr223)?
> >
> > I need to fetch one important number, and instead of trying to create a
> way
> > to report it somehow, I'm thinking the easiest way to report and track it
> > is to set the fetched number as the request's response time.
> >
> > thanks
> >
Re: Any ways to change the request response time?
Posted by Dmitri T <gl...@live.com>.
* Add JSR223 PostProcessor
<https://jmeter.apache.org/usermanual/component_reference.html#JSR223_PostProcessor>
as a child of the request which response time you want to modify
* Put the following code into "Script" area:
org.apache.commons.lang3.reflect.FieldUtils.writeField(prev,'elapsedTime',5L,true)
* Replace *42* with the desired response time value
* ....
* Profit?
In the above example *prev *stands for the *prev*ious SampleResult
<https://jmeter.apache.org/api/org/apache/jmeter/samplers/SampleResult.html>,
see Top 8 JMeter Java Classes You Should Be Using with Groovy
<https://www.blazemeter.com/blog/jmeter-java-classes> article for more
information on this and other JMeter API shorthands available for the
JSR223 Test Elements
On 8/5/2022 3:35 PM, Tong Sun wrote:
> Hi,
>
> Is it possible to change the request response time (via jsr223)?
>
> I need to fetch one important number, and instead of trying to create a way
> to report it somehow, I'm thinking the easiest way to report and track it
> is to set the fetched number as the request's response time.
>
> thanks
>