Skip to content

[improve][io] Improve kinesis connector config.#21004

Merged
Technoboy- merged 2 commits intoapache:masterfrom
shibd:improve_io_kinesis
Aug 22, 2023
Merged

[improve][io] Improve kinesis connector config.#21004
Technoboy- merged 2 commits intoapache:masterfrom
shibd:improve_io_kinesis

Conversation

@shibd
Copy link
Copy Markdown
Member

@shibd shibd commented Aug 16, 2023

Motivation

Improve kinesis connector some config.

Modifications

For the kinesis sink connector

  1. Add cloudwatchEndpoint config, Because the AWS Kinesis producer will periodically send log metrics to CloudWatch.

The current user can set awsRegion or awsEndpoint, but if the user just sets awsEndpoint, he will encounter an error:

2023-08-08T21:16:36,307+0800 [kpl-daemon-0003] ERROR com.amazonaws.services.kinesis.producer.LogInputStreamReader - [2023-08-08 21:16:36.302919] [0x00007725][0x0000000201a76280] [error] [main.cc:268] Could not configure the region. It was not given in the config and we were unable to retrieve it from EC2 metadata.
2023-08-08T21:16:37,316+0800 [kpl-daemon-0000] ERROR com.amazonaws.services.kinesis.producer.KinesisProducer - Error in child process
com.amazonaws.services.kinesis.producer.IrrecoverableError: Child process exited with code 1
	at com.amazonaws.services.kinesis.producer.Daemon.fatalError(Daemon.java:537) ~[amazon-kinesis-producer-0.14.0.jar:?]
	at com.amazonaws.services.kinesis.producer.Daemon.fatalError(Daemon.java:509) ~[amazon-kinesis-producer-0.14.0.jar:?]

For the kinesis source connector

  1. Change applicationName default value is pulsar-kinesis, If you use the original default values(Apache Pulsar IO Connector), you will encounter an error:
Caused by: software.amazon.awssdk.services.dynamodb.model.DynamoDbException: 1 validation error detected: Value 'Apache Pulsar IO Connector' at 'tableName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z0-9_.-]+ (Service: DynamoDb, Status Code: 400, Request ID: FPG9PKE3V9TMEPUFBFFF7PGFEBVV4KQNSO5AEMVJF66Q9ASUAAJG)
	at software.amazon.awssdk.services.dynamodb.model.DynamoDbException$BuilderImpl.build(DynamoDbException.java:95) ~[dynamodb-2.10.56.jar:?]
	at software.amazon.awssdk.services.dynamodb.model.DynamoDbException$BuilderImpl.build(DynamoDbException.java:55) ~[dynamodb-2.10.56.jar:?]

For some refactor code:

  1. Add a KinesisSinkConfig.load() method, and move the param verify logic to it.
  2. Add a KinesisSourceConfig.load() method, and move the param verify logic to it.
  3. Remove duplicate validation logic and useless tests
  4. Remove AwsCredentialProviderPlugin, AwsDefaultProviderChainPlugin and STSAssumeRoleProviderPlugin class, These classes have long been deprecated, and there is no place to use them.

Verifying this change

  • Add missCloudWatchEndpointTest to cover awsRegion and cloudwatchEndpoint is empty.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

@shibd shibd added this to the 3.2.0 milestone Aug 16, 2023
@shibd shibd self-assigned this Aug 16, 2023
@shibd shibd requested review from freeznet and nlu90 August 16, 2023 07:40
@github-actions github-actions Bot added the doc-required Your PR changes impact docs and you will update later. label Aug 16, 2023
@shibd shibd requested a review from JooHyukKim August 16, 2023 13:28
@Technoboy- Technoboy- closed this Aug 20, 2023
@Technoboy- Technoboy- reopened this Aug 20, 2023
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 20, 2023

Codecov Report

❌ Patch coverage is 50.00000% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.97%. Comparing base (9127d89) to head (2e3bfa6).
⚠️ Report is 1742 commits behind head on master.

Files with missing lines Patch % Lines
.../apache/pulsar/io/kinesis/KinesisSourceConfig.java 37.50% 1 Missing and 4 partials ⚠️
...java/org/apache/pulsar/io/kinesis/KinesisSink.java 40.00% 1 Missing and 2 partials ⚠️
...rg/apache/pulsar/io/kinesis/KinesisSinkConfig.java 75.00% 0 Missing and 1 partial ⚠️
...va/org/apache/pulsar/io/kinesis/KinesisSource.java 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #21004       +/-   ##
=============================================
+ Coverage     34.80%   72.97%   +38.16%     
- Complexity    12102    32310    +20208     
=============================================
  Files          1698     1873      +175     
  Lines        129852   140705    +10853     
  Branches      14161    15684     +1523     
=============================================
+ Hits          45201   102679    +57478     
+ Misses        78646    29866    -48780     
- Partials       6005     8160     +2155     
Flag Coverage Δ
inttests 24.22% <ø> (?)
systests 25.08% <0.00%> (-0.10%) ⬇️
unittests 72.29% <50.00%> (+40.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...rg/apache/pulsar/io/kinesis/BaseKinesisConfig.java 85.71% <100.00%> (+85.71%) ⬆️
...rg/apache/pulsar/io/kinesis/KinesisSinkConfig.java 80.76% <75.00%> (+80.76%) ⬆️
...va/org/apache/pulsar/io/kinesis/KinesisSource.java 0.00% <0.00%> (ø)
...java/org/apache/pulsar/io/kinesis/KinesisSink.java 54.61% <40.00%> (+54.61%) ⬆️
.../apache/pulsar/io/kinesis/KinesisSourceConfig.java 37.25% <37.50%> (+37.25%) ⬆️

... and 1449 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

help = "Cloudwatch end-point url. It can be found at "
+ "https://docs.aws.amazon.com/general/latest/gr/rande.html"
)
private String cloudwatchEndpoint = "";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

·cloudWatchEndpoint` ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@shibd shibd requested a review from Technoboy- August 21, 2023 08:52
@lhotari
Copy link
Copy Markdown
Member

lhotari commented Jul 17, 2025

not cherry-picking since #24495 isn't required for 3.0.x anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-required Your PR changes impact docs and you will update later. ready-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants