johrstrom / jmeter-prometheus-plugin

A Prometheus Listener for Apache JMeter that exposes results in an http API
Apache License 2.0
164 stars 109 forks source link

Metrics for embedded resources #105

Open NathanVss opened 2 years ago

NathanVss commented 2 years ago

First, huge thank you for this amazing plugin that helps me everyday !

I need to collect metrics for embedded resources in a HTTP Sampler, but the plugin does not seem to apply specific labels for each embedded resources, so I can't collect metrics specific to each resources, only for the top request.

Here here the configuration of my JMX file

Screen Shot 2022-04-13 at 13 35 54 Screen Shot 2022-04-13 at 13 36 09

And what Prometheus collects:

Screen Shot 2022-04-13 at 13 40 55

( I am running the test with two slaves and federating, that's why each sampler appears two times, but nothing to do with my subject here )

My goal is to have a different label for each sub request for embedded resources like:

{...label="Home"...} {...label="Home/css/home.css"...} {...label="Home/js/home.js"...} {...label="Home_/img/welcome.png"...}

{...label="Billing"...} {...label="Billing/css/billing.css"...} {...label="Billing/js/billing.js"...}

and so on .. you get the idea.

Any idea on how to be able to do that ?

Thank you !

johrstrom commented 2 years ago

Hi, thank you for the feedback!

I don't know if this is possible with this plugin at this time.

I have to admit that this codebase isn't active anymore because I don't use jmeter at my job anymore. A quick spot check on the jmeter API suggests we'd have to pull subResults from https://jmeter.apache.org/api/org/apache/jmeter/samplers/SampleResult.html#getSubResults-- and record those, which I'm sure this do not do now by default.

Happy to evaluate a pull request if you're interested in fixing this!