Fix issue 434: Add connector level proxy configurations#436
Conversation
|
Hi @wojtekzyla @VihasMakwana Thanks. |
|
Hi @wangshu3000 sure I'll review this |
2498574 to
c6b8471
Compare
|
@wojtekzyla Not sure if you got chance to review my change, i have updated the description based on your suggestion. Could you please have a review? Thanks. |
|
@wojtekzyla I wonder if you could help review this one when you have a chance? |
|
Could you add some empty commit to restart the workflow? |
Signed-off-by: Wang, Shu <shu.wang@fmr.com>
c6b8471 to
b45a55d
Compare
|
Thanks @wojtekzyla for your approval, i have retriggered the CI Build Test, could you please approve the flow? Thanks. |
Unit Test Results175 tests 175 ✅ 38s ⏱️ Results for commit b45a55d. |
|
Thanks @wojtekzyla |
Yes, if you could do that it would be helpful. You could also add it to PR description |
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #434 by adding connector-level HTTP proxy configuration for the Splunk HEC client, allowing a specific connector to use a dedicated outbound proxy instead of relying solely on JVM-wide proxy settings.
Changes:
- Added new connector configs
splunk.hec.http.proxy.host/splunk.hec.http.proxy.portand plumbed them through toHecConfig. - Updated the HEC HTTP client construction to apply a per-connector proxy via Apache HttpClient
RequestConfig. - Added/updated unit tests and documentation, and refreshed the JaCoCo coverage report artifacts.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| target/site/jacoco/jacoco.csv | Updates committed coverage metrics after code/test changes. |
| src/test/java/com/splunk/kafka/connect/UnitUtil.java | Adds proxy settings into generated test task configs. |
| src/test/java/com/splunk/kafka/connect/SplunkSinkConnectorConfigTest.java | Adds a unit test asserting proxy config is propagated into HecConfig. |
| src/test/java/com/splunk/kafka/connect/ConfigProfile.java | Extends test config profiles with proxy fields and string representation updates. |
| src/test/java/com/splunk/hecclient/HttpClientBuilderTest.java | Adds a smoke test ensuring HttpClientBuilder can be built with proxy inputs. |
| src/test/java/com/splunk/hecclient/HecConfigTest.java | Extends getter/setter coverage for new proxy fields on HecConfig. |
| src/main/java/com/splunk/kafka/connect/SplunkSinkConnectorConfig.java | Introduces new connector config keys/docs and passes proxy settings into HecConfig. |
| src/main/java/com/splunk/hecclient/HttpClientBuilder.java | Adds proxy fields/setters and applies proxy in RequestConfig when configured. |
| src/main/java/com/splunk/hecclient/HecConfig.java | Adds new proxy host/port fields with getters/setters. |
| src/main/java/com/splunk/hecclient/Hec.java | Plumbs HecConfig proxy settings into HTTP client creation paths. |
| README.md | Documents the new connector properties and defaults. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .build(); | ||
| RequestConfig.Builder requestConfigBuilder = RequestConfig.custom() | ||
| .setCookieSpec(CookieSpecs.STANDARD); | ||
| if (StringUtils.isNotEmpty(this.httpProxyHost) && this.httpProxyPort != 0) { |
| sourcetypes = getString(SOURCETYPE_CONF); | ||
| sources = getString(SOURCE_CONF); | ||
| httpKeepAlive = getBoolean(HTTP_KEEPALIVE_CONF); | ||
| httpProxyHost = getString(HTTP_PROXY_HOST_CONF); | ||
| httpProxyPort = getInt(HTTP_PROXY_PORT_CONF); |
| return new HttpClientBuilder().setDisableSSLCertVerification(config.getDisableSSLCertVerification()) | ||
| .setMaxConnectionPoolSizePerDestination(poolSizePerDest) | ||
| .setMaxConnectionPoolSize(poolSizePerDest * config.getUris().size()) | ||
| .setHttpProxyHost(config.getHttpProxyHost()) | ||
| .setHttpProxyPort(config.getHttpProxyPort()) | ||
| .build(); |
| | `splunk.hec.http.proxy.host` | This setting is the http proxy server hostname. Configure it to use connector level proxy when connecting to HEC endpoint, otherwise, it'll use JVM level proxy setting in JVM_OPTS. | `""` | | ||
| | `splunk.hec.http.proxy.port` | This setting is the http proxy server port. Configure it to use connector level proxy when connecting to HEC endpoint, otherwise, it'll use JVM level proxy setting in JVM_OPTS. | `0` | |
|
|
||
| @Override public String toString() { | ||
| return "ConfigProfile{" + "topics='" + topics + '\'' + ", topics.regex='" + topicsRegex + '\'' + ", token='" + token + '\'' + ", uri='" + uri + '\'' + ", raw=" + raw + ", ack=" + ack + ", indexes='" + indexes + '\'' + ", sourcetypes='" + sourcetypes + '\'' + ", sources='" + sources + '\'' + ", httpKeepAlive=" + httpKeepAlive + ", validateCertificates=" + validateCertificates + ", hasTrustStorePath=" + hasTrustStorePath + ", trustStorePath='" + trustStorePath + '\'' + ", trustStoreType='" + trustStoreType + '\'' + ", trustStorePassword='" + trustStorePassword + '\'' + ", eventBatchTimeout=" + eventBatchTimeout + ", ackPollInterval=" + ackPollInterval + ", ackPollThreads=" + ackPollThreads + ", maxHttpConnPerChannel=" + maxHttpConnPerChannel + ", totalHecChannels=" + totalHecChannels + ", socketTimeout=" + socketTimeout + ", enrichements='" + enrichements + '\'' + ", enrichementMap=" + enrichementMap + ", trackData=" + trackData + ", maxBatchSize=" + maxBatchSize + ", numOfThreads=" + numOfThreads + '}'; | ||
| return "ConfigProfile{" + "topics='" + topics + '\'' + ", topics.regex='" + topicsRegex + '\'' + ", token='" + token + '\'' + ", uri='" + uri + '\'' + ", raw=" + raw + ", ack=" + ack + ", indexes='" + indexes + '\'' + ", sourcetypes='" + sourcetypes + '\'' + ", sources='" + sources + '\'' + ", httpKeepAlive=" + httpKeepAlive + ", httpProxyHost=" + httpProxyHost + ", httpProxyPort=" + httpProxyPort + ", validateCertificates=" + validateCertificates + ", hasTrustStorePath=" + hasTrustStorePath + ", trustStorePath='" + trustStorePath + '\'' + ", " + "trustStoreType='" + trustStoreType + '\'' + ", trustStorePassword='" + trustStorePassword + '\'' + ", eventBatchTimeout=" + eventBatchTimeout + ", ackPollInterval=" + ackPollInterval + ", ackPollThreads=" + ackPollThreads + ", maxHttpConnPerChannel=" + maxHttpConnPerChannel + ", totalHecChannels=" + totalHecChannels + ", socketTimeout=" + socketTimeout + ", enrichements='" + enrichements + '\'' + ", enrichementMap=" + enrichementMap + ", trackData=" + trackData + ", maxBatchSize=" + maxBatchSize + ", numOfThreads=" + numOfThreads + '}'; |
This is a PR to fix issue: #434
In this PR, i added 2 parameters to the connector configurations.
splunk.hec.http.proxy.host - The proxy host
splunk.hec.http.proxy.port - The proxy port
This proxy is setup at the connector level, the splunk connector can use it's own proxy.
If these 2 parameters were configured, it'll use this proxy when connecting to HEC endpoint.
Otherwise, it'll use the JVM level proxy setting in JVM_OPTS.
This provides us the capability to use a different proxy for this connector. No matter how the global JVM_OPTS proxy was configured.