johrstrom / jmeter-prometheus-plugin

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

[Question] Re-use of existing metrics for single test plan with multiple TG's #89

Open winstondz opened 4 years ago

winstondz commented 4 years ago

I am having issues getting all the metrics in the grafana dashboard. Here is my current setup: Grafana (docker) v 7.1.5 Prometheus (docker) v2.21.0

I have an existing JMeter test plan which is structured as such: Test Plan | Reusable Test Fragments ----|Samplers | TG1 ----| Simple Controller --------|SamplerA |Prometheus Listener1 |TG2 ----|SimpleController1 --------|SamplerA ----|SimpleController2 --------|SamplerB --------|SamplerC |Prometheus Listener2

Prometheus Listener 1 and Prometheus Listener 2 are the exact same components (with the same metric names) defined for each TG

In Grafana, I see only the metrics related to Sampler A (I dont have additional filtering in the PROM query), but I dont see any from Samplers B and C. I am not sure whether I am using it the right way or if there's a better way to use it?

I am using api_count_total with the legend {{label}}

johrstrom commented 4 years ago

It's got to do with the internals of the prometheus library. Basically once you "register" a metric, you can't register another with the same name. This is why the 2nd listener is useless, it can't register anything.

I'd suggest just moving them to a single global listener outside of the thread groups if you can. Otherwise you'll have to rename the metrics in one of the listeners.

sriram474 commented 4 years ago

Hi Jeff ohrstrom,

Do you have any plugins for the testng as well to extract the metrics from testng suite to prometheus db. Appreciate your reply.

Regards Ramakrishna sriram474@gmail.com

johrstrom commented 4 years ago

@sriram474 Not sure I follow. You want to pull the metrics from prometheus and put them into a csv so jmeter can read them?

sriram474 commented 4 years ago

I am expecting the other way, like Just in case if we have any plugin like testng-prometheus-plugin and then pushes the required metrics to prometheus in order to view them in the grafana dashboard.

Regards Ramakrishna(RK)

Thanks & Regards

Ramakrishna.Telapolu,

On Mon, Sep 28, 2020 at 7:12 PM Jeff Ohrstrom notifications@github.com wrote:

@sriram474 https://github.com/sriram474 Not sure I follow. You want to pull the metrics from prometheus and put them into a csv so jmeter can read them?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/johrstrom/jmeter-prometheus-plugin/issues/89#issuecomment-700014663, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYNXEZ25IRE6ESTFXCTORLSICHCXANCNFSM4RV5JFGQ .