jmeter-prometheus-plugin icon indicating copy to clipboard operation
jmeter-prometheus-plugin copied to clipboard

pom.xml

Open BLOPESLO opened this issue 5 years ago • 3 comments

Hi, I execute the jmeter with Selenium in Java Class, is it possible to use this plugin integrated with this solution? what is the class/method to run the plugin and how is it configured?

Thanks

BLOPESLO avatar Mar 03 '20 14:03 BLOPESLO

Hi, I've never tried this setup before. I would point you to the PrometheusListener.java class and in particular, to the testStarted() function which is invoked by Jmeter when running the test. This function initializes the configuration and starts the exporter.

Most of the configuration actually sits inside the test script so it should not be fine. Hope this helps.

GiovanniPaoloGibilisco avatar Mar 04 '20 15:03 GiovanniPaoloGibilisco

Yea I also don't know how to do this, but a tip would be to use it like you would any other Listener. If you currently use, say a simple data writer, then it would use the same interface(s) as that.

If you're invoking the test to execute through jmeter, then simply having it defined and attached to the thread group would be enough (I think?).

johrstrom avatar Mar 04 '20 22:03 johrstrom

Hi, I am using the following code:

PrometheusListener teste=new PrometheusListener();
	teste.setProperty("prometheus.delay", "10");
	teste.setProperty("prometheus.ip", "ip server");
	teste.setProperty("prometheus.save.threads", "true");
	teste.addTestElement(testPlan);
	teste.testStarted();
	
	// Create TestPlan hash tree
	ListedHashTree testPlanHashTree = new ListedHashTree();
	testPlanHashTree.add(testPlan);

	// Add ThreadGroup to TestPlan hash tree
	testPlanHashTree.add(testPlan, headerManager);
	testPlanHashTree.add(testPlan, cacheManager);
	testPlanHashTree.add(testPlan, cookieManager);
	testPlanHashTree.add(testPlan, dnsManager);
	testPlanHashTree.add(testPlan, arguments);
	testPlanHashTree.add(testPlan, authManager);
	testPlanHashTree.add(testPlan, threadGroups);
	testPlanHashTree.add(teste);

Do you think it must be something like that?

Thanks

BLOPESLO avatar Mar 05 '20 13:03 BLOPESLO