Skip to content

Commit b41c4b5

Browse files
authored
Merge pull request #111 from splitio/feature/disableIpAddress
Feature/disable ip address
2 parents 972089f + ed0d27b commit b41c4b5

File tree

11 files changed

+235
-83
lines changed

11 files changed

+235
-83
lines changed

CONTRIBUTORS-GUIDE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Contributing to the Split Java SDK
2+
3+
Split SDK is an open source project and we welcome feedback and contribution. The information below describes how to build the project with your changes, run the tests, and send the Pull Request(PR).
4+
5+
## Development
6+
7+
### Development process
8+
9+
1. Fork the repository and create a topic branch from `development` branch. Please use a descriptive name for your branch.
10+
2. While developing, use descriptive messages in your commits. Avoid short or meaningless sentences like "fix bug".
11+
3. Make sure to add tests for both positive and negative cases.
12+
4. Run the build script and make sure it runs with no errors.
13+
5. Run all tests and make sure there are no failures.
14+
6. `git push` your changes to GitHub within your topic branch.
15+
7. Open a Pull Request(PR) from your forked repo and into the `development` branch of the original repository.
16+
8. When creating your PR, please fill out all the fields of the PR template, as applicable, for the project.
17+
9. Check for conflicts once the pull request is created to make sure your PR can be merged cleanly into `development`.
18+
10. Keep an eye out for any feedback or comments from Split's SDK team.
19+
20+
### Building the SDK
21+
- `mvn clean build`
22+
23+
### Running tests
24+
- `mvn clean install`
25+
26+
# Contact
27+
28+
If you have any other questions or need to contact us directly in a private manner send us a note at sdks@split.io

Detailed-README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 77 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,79 @@
11
# Split Java SDK
22

3-
This SDK is designed to work with [Split](https://www.split.io), the platform for controlled rollouts, serving features to your users via the Split feature flag to manage your complete customer experience.
4-
5-
### Quick setup
6-
7-
For specific instructions on how to set up the Split SDK refer to our [Detailed-README](Detailed-README.md) or our [official SDK documentation](http://docs.split.io/docs/sdk-overview).
8-
9-
### Commitment to Quality:
10-
11-
Split’s SDKs are in active development and are constantly tested for quality. Unit tests are developed for each SDK based on the unique needs of that language, and integration tests, load and performance tests, and behavior consistency tests are running 24/7 via automated bots. In addition, monitoring instrumentation ensures that these SDKs behave under the expected parameters of memory, CPU, and I/O.
12-
13-
### About Split:
14-
15-
Split is the leading platform for feature experimentation, empowering businesses of all sizes to make smarter product decisions. Companies like Vevo, Twilio, and LendingTree rely on Split to securely release new features, target them to customers, and measure the impact of features on their customer experience metrics. Founded in 2015, Split's team comes from some of the most innovative enterprises in Silicon Valley, including Google, LinkedIn, Salesforce and Databricks. Split is based in Redwood City, California and backed by Accel Partners and Lightspeed Venture Partners.
16-
17-
Our platform is a unified solution for continuous delivery and full-stack experimentation. Split unifies DevOps and product management, helping agile engineering and product teams accelerate the pace of product delivery and make data-driven decisions, through our robust feature flagging and extensive experimentation capabilities. With Split, organizations can now accelerate time to value, mitigate risk, and drive better outcomes, all in a unified platform.
18-
19-
To learn more about Split, contact hello@split.io, or start a 14-day trial at https://www.split.io/signup/.
20-
21-
Split has built and maintains a SDKs for:
22-
23-
* Java [Github](https://github.com/splitio/java-client) [Docs](http://docs.split.io/docs/java-sdk-guide)
24-
* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](http://docs.split.io/docs/javascript-sdk-overview)
25-
* Node [Github](https://github.com/splitio/javascript-client) [Docs](http://docs.split.io/docs/nodejs-sdk-overview)
26-
* .NET [Github](https://github.com/splitio/.net-client) [Docs](http://docs.split.io/docs/net-sdk-overview)
27-
* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](http://docs.split.io/docs/ruby-sdk-overview)
28-
* PHP [Github](https://github.com/splitio/php-client) [Docs](http://docs.split.io/docs/php-sdk-overview)
29-
* Python [Github](https://github.com/splitio/python-client) [Docs](http://docs.split.io/docs/python-sdk-overview)
30-
* GO [Github](https://github.com/splitio/go-client) [Docs](http://docs.split.io/docs/go-sdk-overview)
31-
* Android [Github](https://github.com/splitio/android-client) [Docs](https://docs.split.io/docs/android-sdk-overview)
32-
* IOS [Github](https://github.com/splitio/ios-client) [Docs](https://docs.split.io/docs/ios-sdk-overview)
33-
34-
For a comprehensive list of opensource projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20).
35-
36-
**Learn more about Split:**
37-
38-
Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [docs.split.io](http://docs.split.io) for more detailed information.
39-
40-
**System Status:**
41-
42-
We use a status page to monitor the availability of Split’s various services. You can check the current status at [status.split.io](http://status.split.io).
3+
[![Build Status](https://api.travis-ci.com/splitio/java-client.svg?branch=master)](https://api.travis-ci.com/splitio/java-client)
4+
5+
## Overview
6+
This SDK is designed to work with Split, the platform for controlled rollouts, serving features to your users via the Split feature flag to manage your complete customer experience.
7+
8+
[![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=splitsoftware)
9+
10+
## Compatibility
11+
This SDK is compatible with Java 6 and higher.
12+
13+
## Getting started
14+
Below is a simple example that describes the instantiation and most basic usage of our SDK:
15+
16+
```java
17+
import io.split.client.SplitFactoryBuilder;
18+
import io.split.client.SplitClient;
19+
20+
public class App {
21+
22+
public static void main() {
23+
SplitClientConfig config = SplitClientConfig.builder()
24+
.setBlockUntilReadyTimeout(10000)
25+
.build();
26+
SplitFactory splitFactory = SplitFactoryBuilder.build("SDK_API_KEY", config);
27+
SplitClient client = splitFactory.client();
28+
try {
29+
client.blockUntilReady();
30+
} catch (TimeoutException | InterruptedException e) {
31+
// log & handle
32+
}
33+
34+
String treatment = client.getTreatment("CUSTOMER_ID", "SPLIT_NAME");
35+
if (treatment.equals("on")) {
36+
// Feature is enabled for this user!
37+
} else if (treatment.equals("off")) {
38+
// Feature is disabled for this user!
39+
} else {
40+
// Unable to perform evaluation.
41+
}
42+
}
43+
}
44+
```
45+
46+
## Submitting issues
47+
48+
The Split team monitors all issues submitted to this [issue tracker](https://github.com/splitio/java-client/issues). We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner.
49+
50+
## Contributing
51+
Please see [Contributors Guide](CONTRIBUTORS-GUIDE.md) to find all you need to submit a Pull Request (PR).
52+
53+
## License
54+
Licensed under the Apache License, Version 2.0. See: [Apache License](http://www.apache.org/licenses/).
55+
56+
## About Split
57+
58+
Split is the leading Feature Delivery Platform for engineering teams that want to confidently deploy features as fast as they can develop them. Split’s fine-grained management, real-time monitoring, and data-driven experimentation ensure that new features will improve the customer experience without breaking or degrading performance. Companies like Twilio, Salesforce, GoDaddy and WePay trust Split to power their feature delivery.
59+
60+
To learn more about Split, contact hello@split.io, or get started with feature flags for free at https://www.split.io/signup.
61+
62+
Split has built and maintains SDKs for:
63+
64+
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
65+
* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
66+
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
67+
* .NET [Github](https://github.com/splitio/.net-core-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
68+
* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
69+
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
70+
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
71+
* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
72+
* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
73+
* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
74+
75+
For a comprehensive list of open source projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20).
76+
77+
**Learn more about Split:**
78+
79+
Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](http://help.split.io) for more detailed information.

client/CHANGES.txt

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
11
CHANGES
2+
3.3.1 (Nov 1, 2019)
3+
- Allow client to disable sending the IP address & hostname.
24

3-
3.3.0 (Sept 23rd, 2019)
5+
3.3.0 (Sep 23, 2019)
46
- rename version.properties to splitversion.properties to avoid conflicts with other tools that use the former file name and causes this SDK to not properly report the version
57
- Adds New Relic Integration. Now if the New Relic agent is running, it will attach Impression data to the current transaction in New Relic,
68

7-
3.2.4
9+
3.2.4 (Sep 9, 2019)
810
- Fix small issue regarding traffic type validation on .track() calls.
911

10-
3.2.3
12+
3.2.3 (Aug 1, 2019)
1113
- allow to push impressions more often than one every 30 seconds and events flush rate is now customizable
1214

13-
3.2.2
15+
3.2.2
1416
- log warn and not error when Split doesn't exist in the environment
1517

16-
3.2.1
18+
3.2.1 (May 29, 2019)
1719
- Fix issue with events not forwarding the value when sending properties as well.
1820

19-
3.2.0
21+
3.2.0 (May 24, 2019)
2022
- Add ability to send events with properties
2123

22-
3.1.1
24+
3.1.1 (May 2, 2019)
2325
- Fix issue with locating localhost mode in windows
2426
- Fix issue when user falls out of traffic allocation and has config data
2527

26-
3.1.0
28+
3.1.0 (Apr 16, 2019)
2729
- Add Dynamic Configurations
2830
- Support Yaml files for localhost mode
2931

30-
3.0.9
32+
3.0.9 (Mar 21, 2019)
3133
- Validate split names on getTreatment and manager calls
3234
- Validate traffic type name when calling track
3335
- Check for multiple factories instantiated
3436

35-
3.0.8
37+
3.0.8 (Mar 7, 2019)
3638
- Ability to disable automatic destroy() on graceful shutdowns.
3739

3840
3.0.7
@@ -42,40 +44,40 @@ CHANGES
4244
3.0.6
4345
- Setting CookieSpec to Standard
4446

45-
3.0.5
47+
3.0.5 (Jan 5, 2019)
4648
- Adding input validation for fast feedback of incorrect use of the client.
4749

48-
3.0.4
50+
3.0.4 (Dec 14, 2018)
4951
- Fix potential race condition when segment wait for readiness before they are registered to the readiness gates
5052

51-
3.0.3
53+
3.0.3 (Dec 12, 2018)
5254
- Expose param to increase thread pool size for segments
5355

54-
3.0.2
56+
3.0.2 (Dec 12, 2018)
5557
- Fixed traffic allocation issue on 1%
5658

57-
3.0.1
59+
3.0.1
5860
- Fix Metric Counters when using Split Proxy.
5961

6062
3.0.0
6163
- Moving block until ready out of the factory into the split client and manager client
6264

63-
2.3.2
65+
2.3.2 (Jul 18, 2018)
6466
- Add support for handling different relative path in the endpoints of the Split Synchronizer
6567

66-
2.3.1
68+
2.3.1 (Apr 18, 2018)
6769
- Added support for key overrides in localhost mode
6870

69-
2.3.0
71+
2.3.0 (Jan 15, 2018)
7072
- Add support for .track()
7173

72-
2.2.2
74+
2.2.2 (Dec 22, 2017)
7375
- Patch for localhost mode to daemonize the thread which currently prevents the JVM from exiting.
7476

75-
2.2.1
77+
2.2.1 (Dec 22, 2017)
7678
- Transitioning from "no rule matched" to "default rule" and from "rules not found" to "definition not found"
7779

78-
2.2.0
80+
2.2.0 (Sep 22, 2017)
7981
- Patch DependencyMatcherData to not error out when dependencies are used
8082
- Default logging is less verbose now
8183
- Add support for Proxy
@@ -96,30 +98,30 @@ CHANGES
9698
2.0.1 (May 3rd, 2017)
9799
- Fix issue for Java 7 and compatibility with TLS1.2
98100

99-
2.0
101+
2.0 (Apr 26, 2017)
100102
- Transitioning to Murmur3 for key hashing
101103
- Hashing Algorithm dependent on Split algo field
102104

103-
1.1.7
105+
1.1.7 (Mar 31, 2017)
104106
- We can now specify a percentage of traffic that can be in the Split - i.e. traffic allocation.
105107
- You can now register your own ImpressionListener. SplitClientConfig#impressionListener.
106108
- You can no longer set any refresh rates to be less than 30 seconds.
107109

108-
1.1.6
110+
1.1.6 (Feb 27, 2017)
109111
- Allowing users to set the Off-The-Grid directory
110112
- Adding Live Reload of Split File in Off-The-Grid mode
111113

112-
1.1.5
114+
1.1.5 (Feb 8, 2017)
113115
- Introducing SplitClientForTest and SplitTestRunner for JUnit. More information at split.io/blog/feature-flag-testing
114116

115-
1.1.4
117+
1.1.4 (Feb 8, 2017)
116118
- Use less guava.
117119

118-
1.1.3
120+
1.1.3 (Jan 9, 2017)
119121
- Impression to include the changeNumber of the Split that served a getTreatment call.
120122
- expose disableLabels
121123

122-
1.1.2
124+
1.1.2 (Dec 19, 2016)
123125
- Adding SplitManager.splitNames() support to retrieve feature names.
124126
- Improving Java 1.7 compatibility for Hashcodes
125127

client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.split.client</groupId>
77
<artifactId>java-client-parent</artifactId>
8-
<version>3.3.0</version>
8+
<version>3.3.1</version>
99
</parent>
1010
<artifactId>java-client</artifactId>
1111
<packaging>jar</packaging>

client/src/main/java/io/split/client/SplitClientConfig.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class SplitClientConfig {
3030
private final int _numThreadsForSegmentFetch;
3131
private final boolean _debugEnabled;
3232
private final boolean _labelsEnabled;
33+
private final boolean _ipAddressEnabled;
3334
private final int _ready;
3435
private final int _waitBeforeShutdown;
3536
private final int _eventsQueueSize;
@@ -65,6 +66,7 @@ private SplitClientConfig(String endpoint,
6566
int ready,
6667
boolean debugEnabled,
6768
boolean labelsEnabled,
69+
boolean ipAddressEnabled,
6870
int waitBeforeShutdown,
6971
HttpHost proxy,
7072
String proxyUsername,
@@ -88,6 +90,7 @@ private SplitClientConfig(String endpoint,
8890
_ready = ready;
8991
_debugEnabled = debugEnabled;
9092
_labelsEnabled = labelsEnabled;
93+
_ipAddressEnabled = ipAddressEnabled;
9194
_waitBeforeShutdown = waitBeforeShutdown;
9295
_proxy = proxy;
9396
_proxyUsername = proxyUsername;
@@ -158,6 +161,8 @@ public boolean debugEnabled() {
158161

159162
public boolean labelsEnabled() { return _labelsEnabled;}
160163

164+
public boolean ipAddressEnabled() { return _ipAddressEnabled; }
165+
161166
public int blockUntilReady() {
162167
return _ready;
163168
}
@@ -219,6 +224,7 @@ public static final class Builder {
219224
private int _ready = -1; // -1 means no blocking
220225
private int _metricsRefreshRate = 60;
221226
private boolean _labelsEnabled = true;
227+
private boolean _ipAddressEnabled = true;
222228
private int _waitBeforeShutdown = 5000;
223229
private String _proxyHost = "localhost";
224230
private int _proxyPort = -1;
@@ -444,6 +450,10 @@ public Builder disableLabels() {
444450
return this;
445451
}
446452

453+
public Builder disableIPAddress() {
454+
_ipAddressEnabled = false;
455+
return this;
456+
}
447457

448458
/**
449459
* The SDK kicks off background threads to download data necessary
@@ -626,6 +636,7 @@ public SplitClientConfig build() {
626636
_ready,
627637
_debugEnabled,
628638
_labelsEnabled,
639+
_ipAddressEnabled,
629640
_waitBeforeShutdown,
630641
proxy(),
631642
_proxyUsername,

client/src/main/java/io/split/client/SplitFactoryImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public SplitFactoryImpl(String apiToken, SplitClientConfig config) throws URISyn
9898
.setConnectionManager(cm)
9999
.setDefaultRequestConfig(requestConfig)
100100
.setSSLSocketFactory(sslsf)
101-
.addInterceptorLast(AddSplitHeadersFilter.instance(apiToken))
101+
.addInterceptorLast(AddSplitHeadersFilter.instance(apiToken, config.ipAddressEnabled()))
102102
.addInterceptorLast(new GzipEncoderRequestInterceptor())
103103
.addInterceptorLast(new GzipDecoderResponseInterceptor());
104104

0 commit comments

Comments
 (0)