-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added EU endpoint support and Unit tests in SenderConfiguration and the BatchSenders for all data types. #276
Conversation
… for each data type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great! A few more tests, now that user can override region with endpoint
return endpointRegion; | ||
} | ||
|
||
public boolean isUserProvideEndpoint() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick spelling - isUserProvidedEnpoint()
} | ||
} else if (userRegion.equals("EU")) { | ||
try { | ||
url = new URL(EUROPEAN_URL + METRICS_PATH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make the creation of the Default URL be simple and consistent with the creation of the European Url?
* | ||
* @param endpoint A full {@link URL}, including the path. | ||
* @return this builder. | ||
*/ | ||
public SenderConfigurationBuilder endpoint(URL endpoint) { | ||
SenderConfiguration.userProvidedEndpoint = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please provide a test that userProvidedEndpoint will be set to true
boolean isCustomEndpoint = configuration.isUserProvideEndpoint(); | ||
|
||
URL url = null; | ||
if (isCustomEndpoint == true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a test in each BatchSender to confirm custom endpoint will override region
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a few items left. Thank you!
* @return this builder | ||
*/ | ||
public SenderConfigurationBuilder setRegion(String region) throws IllegalArgumentException { | ||
// Add IllegalArgumentException if region isn't US or EU |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this comment plz
} | ||
|
||
@Test | ||
void defaultEndpointAsStringTest() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test just confirms toString()
works? If. so, this test can be removed.
} | ||
|
||
@Test | ||
void userEndpointAsStringTest() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for this test, I think it can be removed
EventBatchSender: Default (to US Prod, US License Key): Successful MetricBatchSender: Default (to US Prod, US License Key): Successful LogBatchSender: Default (to US Prod, US License Key): Successful SpanBatchSender: Default (to US Prod, US License Key): Successful |
This looks great @yamnihcg and thank you for persistently chipping away at this! 🚀 🚀 |
The following PR adds the .setRegion() method to the SenderConfigurationBuilder API. This method allows you to define a region (US or EU) so that the appropriate production endpoint (corresponding to that region) is used. The default endpoint is the US production endpoint.
If you want to use an endpoint other than the US / EU production endpoints, use the existing .endpoint() method in the SenderConfigurationBuilder API.
Below are some examples on how to use the new API. In these examples, we use the MetricBatchSender / MetricBatchSenderFactory.
US Production
Note: Since the default endpoint is the US production endpoint, we did not use .setRegion() in this example. Also, a US license key is needed to send data to this endpoint.
EU Production
Note: An EU license key is needed to send data to this endpoint.
Staging / Setting Your Own URL