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

Bq sink connector using depot repo. #168

Merged
merged 11 commits into from
May 18, 2022
Merged

Conversation

lavkesh
Copy link
Member

@lavkesh lavkesh commented May 9, 2022

BQ sink using odpf/depot

@lavkesh lavkesh changed the base branch from main to feature-sink-depot May 11, 2022 08:39
@@ -1,8 +1,8 @@
package io.odpf.firehose.message;


import io.odpf.firehose.error.ErrorInfo;
import io.odpf.firehose.error.ErrorType;
import io.odpf.depot.error.ErrorInfo;
Copy link
Contributor

Choose a reason for hiding this comment

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

as I understand the scope of this PR is to introduce depot library for only bigquery sink first, but here we are introducing errortype from depot in message.java which is used across all sink. Which basically means we are affecting all the sinks in firehose.

Copy link
Member Author

Choose a reason for hiding this comment

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

This Error info is sink related. Common changes are a pre-requisite.

* <p>
* Handle logging and metric capturing.
*/
public class FirehoseInstrumentation extends Instrumentation {
Copy link
Contributor

Choose a reason for hiding this comment

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

FirehoseInstrumentation extends Instrumentation which is in depot library,
this change is propagated to all sinks instead of just bigquery sink in this PR

Copy link
Member Author

@lavkesh lavkesh May 12, 2022

Choose a reason for hiding this comment

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

Yes. It is intentional.

this.config = addAdditionalConfigs(System.getenv());
}

private Map<String, String> addAdditionalConfigs(Map<String, String> env) {
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion to rename function to addAdditionalConfigs to addAdditionalDepotSinkConnectorConfigs

case BIGQUERY:
bigQuerySinkFactory = new BigQuerySinkFactory(config, statsDReporter);
config.put("SINK_BIGQUERY_METADATA_COLUMNS_TYPES",
Copy link
Contributor

Choose a reason for hiding this comment

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

we are adding couple configs here and in addAdditionalConfigs function , lets add test for for this. might have to use powermock to validate constructor called

Copy link
Member Author

Choose a reason for hiding this comment

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

I will keep additional functions out of factory. So that they will be testable separately.


Assert.assertTrue(Arrays.equals((byte[]) expectedMessage2.getLogKey(), (byte[]) actualMessage2.getLogKey()));
Assert.assertTrue(Arrays.equals((byte[]) expectedMessage2.getLogMessage(), (byte[]) actualMessage2.getLogMessage()));
Assert.assertEquals(expectedMessage2.getMetadata(), actualMessage2.getMetadata());
Copy link
Contributor

Choose a reason for hiding this comment

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

can we stick to common convetion in the project of using static import from org.junit.Assert and org.mockito.Mockito.
Given we frequently access to static members from these two classes. By using static import, the syntax is more concise and my test is more readable.

Copy link
Member Author

@lavkesh lavkesh May 12, 2022

Choose a reason for hiding this comment

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

I am not sure we are following any standard. I don't really like static import. Using full function name is more readable for me.

@lavkesh lavkesh changed the title Bq sink connector Bq sink connector using depot repo. May 12, 2022
@kevinbheda
Copy link
Contributor

new changes pushed after the review LGTM

@lavkesh lavkesh merged commit f8a54c6 into feature-sink-depot May 18, 2022
@lavkesh lavkesh deleted the bq-sink-connector branch May 18, 2022 04:31
lavkesh added a commit that referenced this pull request Jun 27, 2022
* feat: adding odpf/depot depedencies

* feat: add github maven repo for odpf/depot

* feat: add github auth

* chore: depenedencies

* chore: version bump

* chore: version bump

* refactor: move common code to seperate class
lavkesh added a commit that referenced this pull request Jun 30, 2022
* feat: adding odpf/depot depedencies

* feat: add github maven repo for odpf/depot

* feat: add github auth

* chore: depenedencies

* chore: version bump

* chore: version bump

* refactor: move common code to seperate class
ravisuhag pushed a commit that referenced this pull request Aug 5, 2022
* feat: adding odpf/depot depedencies

* feat: add github maven repo for odpf/depot

* feat: add github auth

* chore: depenedencies

* chore: version bump

* chore: version bump

* refactor: move common code to seperate class
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.

2 participants