Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Proxy parameters are ignored on sending requests to the Backend #15

Open
ReiMueh opened this issue Feb 7, 2022 · 2 comments
Open

Proxy parameters are ignored on sending requests to the Backend #15

ReiMueh opened this issue Feb 7, 2022 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ReiMueh
Copy link

ReiMueh commented Feb 7, 2022

When I try to send Requests to our Dynatrace instance, the Backendlistener fails to send them. I added "setProxy()" to the creation of the httpClient in the MintMetricSender Class. After doing that, sending the requests worked.

@christian-inzko-dt
Copy link
Contributor

Hi @ReiMueh
can you please provide more details to this? Are you using a proxy in your setup where you have started the JMeter test?
Is the proxy already configured somewhere in the JMeter config so that it can be reused here?
Maybe you can provide code snippet or pull request with your changes?

@ReiMueh
Copy link
Author

ReiMueh commented Feb 9, 2022

Hi @christian-inzko-dt

I just added a line to create the proxy from the properties
and that I use in your creation of the HttpAsyncClientBuilder

public synchronized void setup(String name, String mintIngestUrl, String mintIngestToken) throws Exception {
		this.url = new URL(mintIngestUrl);
		this.token = mintIngestToken;
		this.name = name;
		HttpHost proxy = new HttpHost(JMeterUtils.getJMeterProperties().getProperty("proxy"), Integer.parseInt(JMeterUtils.getJMeterProperties().getProperty("proxyport")));

		IOReactorConfig ioReactorConfig = IOReactorConfig.custom().setIoThreadCount(MAX_THREADS).setConnectTimeout(CONNECT_TIMEOUT)
				.setSoTimeout(SOCKET_TIMEOUT)
				.build();
		ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(ioReactorConfig);
		PoolingNHttpClientConnectionManager connManager = new PoolingNHttpClientConnectionManager(ioReactor);
		httpClient = HttpAsyncClientBuilder.create().setConnectionManager(connManager).setMaxConnPerRoute(MAX_CONNECTIONS)
				.setMaxConnTotal(MAX_CONNECTIONS).setProxy(proxy)
				.setUserAgent("ApacheJMeter 5").disableCookieManagement().disableConnectionState().build();
		httpRequest = createRequest(this.url, this.token);
		httpClient.start();
}

@christian-inzko-dt christian-inzko-dt added enhancement New feature or request good first issue Good for newcomers labels Feb 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants