jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <philippe.moua...@gmail.com>
Subject Re: Amending HTTP Header for embedded resources
Date Tue, 04 Mar 2014 21:27:13 GMT
On Thu, Feb 27, 2014 at 3:35 PM, Dan Ledgard <dan@ledgards.co.uk> wrote:

> Thanks for the ideas Sebb
>
> I tried the pre-processor approach, the only way I could see to set the
> header was on a header manager. This resulted in the header being present
> on the main request and embedded resources, I guess they all share the same
> header manager so therefore get the header. I had also explored this
> previously to see if it was possible to have pre-processor logic execute
> just for the sub samples, obviously without success.
>

Preprocessor approach will not work, because it runs before the download
threads are triggered.
Header manager is not really shared but cloned on creation of Callable that
will handle download.

>
> So it looks like I may have to fall back on switching off the embedded
> resources and adding separate samplers for them. I was trying to avoid this
> as there are some pages with a large number and I was hoping to use the
> concurrent pool to simulate browser interaction more accurately.
>
> If I get time I'll explore extending the sampler but at the moment that's
> not a luxury I have.
>
> thanks again
>
> Dan
>
>
> On 26 February 2014 15:47, sebb <sebbaz@gmail.com> wrote:
>
> > On 26 February 2014 08:50, Dan Ledgard <dan@ledgards.co.uk> wrote:
> > > Thanks for the response unfortunately it is not what I was looking for,
> > > maybe my question was not clear enough
> > >
> > > What I am looking to do is use an HTTP Request sampler with retrieve
> all
> > > embedded resources enabled and setting a custom header. The value of
> this
> > > custom header needs to be different for the webpage request and
> resource
> > > requests, but can be the same for all resource requests.
> > >
> > > The APM is instrumenting the app under test so the header values need
> to
> > be
> > > different on the actual requests, post processing or manipulating
> JMeter
> > > output files will not work unfortunately.
> >
> > OK, in that case there are some other things you could try:
> > - use a Pre-Processor to add the header to the intial request. I have
> > not tried this, so I don't know if it will also affect subsequent
> > samples.
> > - disable the auto-download of embedded resources, and add separate
> > samples for them.
> > You can create the samples with the Recorder - or just look at what
> > resources are downloaded currently.
> >
> > If the Pre-Processor does not work, and you want to use auto-download,
> > then I think it will probably require code changes to the sampler.
> > In your particiular case you could just skip the X-APM-Header for
> > sub-samples. That would probably be the simplest, but least flexible.
> >
> > A more general solution would require either flagging headers as being
> > for the initial sample only.
> > Or establishing a way to intercept the embedded processing sequence.
> > At present the Pre- and Post- Processors apply to the main sample only.
> > Assertions can apply to sub-samples, but these operate on the sample
> > result collection, so the same approach won't work.
> > But if a processor could be invoked between the main and subsamples,
> > this would allow adjustment of headers etc.
> >
> > > e.g.
> > > GET /news/ HTTP/1.1
> > > X-APM-Header: News Page
> > >
> > > GET /resources/style/main.css HTTP/1.1
> > > X-APM-Header: News resources
> > >
> > > GET /resources/script/widjets.js HTTP/1.1
> > > X-APM-Header: News resources
> > >
> > >
> > > thanks
> > >
> > > Dan
> > >
> > >
> > > On 26 February 2014 02:41, sebb <sebbaz@gmail.com> wrote:
> > >
> > >> On 24 February 2014 14:32, Dan Ledgard <dan.ledgard@googlemail.com>
> > wrote:
> > >> > Hi
> > >> >
> > >> > I am using JMeter for loading a system under test that is monitored
> > by an
> > >> > APM solution. This uses an HTTP header to identify webpages or web
> > >> service
> > >> > requests.
> > >> >
> > >> > I currently have an HTTP Request sampler with retrieve all embedded
> > >> > resources enabled and a child
> > >> > HTTP Header Manager defining the header. Unfortunately this results
> in
> > >> the
> > >> > main request and all embedded resource requests having this header,
> > with
> > >> > the APM then aggregating response times across all of these.
> > >> >
> > >> > Ideally I am looking for the main requests to be aggregated
> > separately to
> > >> > the embedded resources and so would like to set the header to a
> > different
> > >> > value.
> > >> >
> > >> > I cannot see a way to do this with the current components, does
> anyone
> > >> know
> > >> > the best way to approach this. Would I need to look at extending the
> > HTTP
> > >> > Request sampler?
> > >>
> > >> You can save subsample details when using XML format.
> > >> It should then be possible to extract the information that you want.
> > >>
> > >> It may also be possible to write a PostProcessor to massage the
> > >> results to remove the headers that are not wanted.
> > >>
> > >> > thanks
> > >> >
> > >> > Dan
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> > >> For additional commands, e-mail: user-help@jmeter.apache.org
> > >>
> > >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> > For additional commands, e-mail: user-help@jmeter.apache.org
> >
> >
>



-- 
Cordialement.
Philippe Mouawad.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message