Skip to content
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

HttpSink Plugin Functionality for #874. #3036

Merged

Conversation

mallikagogoi7
Copy link
Contributor

Description

HttpSink Plugin Functionality for #874.

Issues Resolved

#874

Check List

  • New functionality includes testing.
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: mallikagogoi7 <mallikagogoi7@gmail.com>
@@ -240,4 +248,12 @@ public String getDlqFile() {
public PluginModel getDlq() {
return dlq;
}

public boolean isValidAWSUrl() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of this code? I also don't see it in use. Why does AWS have a special case here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @dlvenable , this AWS url validation check is done before attaching the AWS Sigv4.

}

if(Objects.nonNull(httpSinkConfiguration.getCustomHeaderOptions()))
addSageMakerHeaders(classicRequestBuilder,httpSinkConfiguration.getCustomHeaderOptions());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does setting "custom_headers" create Sage Maker options?

Custom header should be a Map<String, List<String>> which allows users to define any headers they want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @dlvenable , changed the custom header to Map<String, List

" http_method: \"POST\"\n" +
" auth_type: \"http_basic\"\n" +
private static final String SINK_YAML =
" url: \"https://httpbin.org/post\"\n" +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please test with a localhost address instead of this webpage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @dlvenable , changed the url to localhost:8080.

final String proxyUrlString = httpSinkConfiguration.getProxy();
final ClassicRequestBuilder classicRequestBuilder = buildRequestByHTTPMethodType(httpMethod).setUri(httpSinkConfiguration.getUrl());

if(httpSinkConfiguration.isAwsSigv4() && httpSinkConfiguration.isValidAWSUrl()){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's split all of this AWS code into its own class. It is too tightly coupling the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @dlvenable , the AWS code is moved to a new class.

if (ThresholdValidator.checkThresholdExceed(currentBuffer, maxEvents, maxBytes, maxCollectionDuration)) {
final HttpEndPointResponse failedHttpEndPointResponses = pushToEndPoint(getCurrentBufferData(currentBuffer));
if (failedHttpEndPointResponses != null) {
logFailedData(failedHttpEndPointResponses, getCurrentBufferData(currentBuffer));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be releaseEventHandle(false) if it fails to push to Http and no DLQ is configured OR DLQ configured but failed to write to DLQ

@kkondaka kkondaka merged commit f236af9 into opensearch-project:main Aug 1, 2023
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants