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

[5889] Bmoric/add application name [2/3] #7267

Closed

Conversation

benmoriceau
Copy link
Contributor

What

Introduce a new interface which will allow to get an application name.

It will then be use in #5889 to log which application produce a log.

@benmoriceau benmoriceau added type/refactoring Focused on refactoring. area/platform issues related to the platform 2021-q4-platform labels Oct 21, 2021
@github-actions github-actions bot added the area/worker Related to worker label Oct 21, 2021
@benmoriceau
Copy link
Contributor Author

I have added 2 reviewers since it is a potentially impactful change.

@benmoriceau benmoriceau changed the base branch from master to bmoric/mdc-manipulation-tools October 21, 2021 22:45
@@ -86,4 +86,7 @@ public void cancel() {
WorkerUtils.cancelProcess(process);
}

@Override public String getApplicationName() {
return "airbyte-connection-checker";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return "airbyte-connection-checker";
return "check-connection-worker";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -81,4 +81,7 @@ public void cancel() {
WorkerUtils.cancelProcess(process);
}

@Override public String getApplicationName() {
return "airbyte-catalog-discovery";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return "airbyte-catalog-discovery";
return "discover-worker";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -81,4 +81,7 @@ public void cancel() {
WorkerUtils.cancelProcess(process);
}

@Override public String getApplicationName() {
return "airbyte-spec-getter";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return "airbyte-spec-getter";
return "get-spec-worker";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -82,4 +82,7 @@ public void cancel() {
}
}

@Override public String getApplicationName() {
return "airbyte-normalization";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return "airbyte-normalization";
return "normalization-worker";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -77,4 +77,7 @@ public void cancel() {
}
}

@Override public String getApplicationName() {
return "airbyte-dbt-transformation-worker";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return "airbyte-dbt-transformation-worker";
return "dbt-worker";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -142,4 +142,7 @@ public boolean isFinished() {
return Optional.ofNullable(messageIterator.hasNext() ? messageIterator.next() : null);
}

@Override public String getApplicationName() {
return "airbyte-destination";
Copy link
Contributor

Choose a reason for hiding this comment

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

Even this level is a bit misleading. To a user in the UI, "destination" would likely make it seem like something running on the destination pod/container, not the destination class within the sync worker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 I have removed it.

@@ -129,4 +128,7 @@ public void cancel() throws Exception {
}
}

@Override public String getApplicationName() {
Copy link
Contributor

Choose a reason for hiding this comment

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

same 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.

Done

@@ -89,4 +87,7 @@ private void internalLog(final AirbyteLogMessage logMessage) {
}
}

@Override public String getApplicationName() {
Copy link
Contributor

Choose a reason for hiding this comment

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

same 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.

Done

@@ -56,4 +55,7 @@ public void cancel() throws Exception {
// no op.
}

@Override public String getApplicationName() {
Copy link
Contributor

Choose a reason for hiding this comment

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

same 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.

Done

@@ -97,4 +96,7 @@ private static String transformStreamName(final String streamName, final String
}
}

@Override public String getApplicationName() {
Copy link
Contributor

Choose a reason for hiding this comment

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

same 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.

Done

@benmoriceau benmoriceau temporarily deployed to more-secrets October 22, 2021 00:06 Inactive
@benmoriceau benmoriceau temporarily deployed to more-secrets October 22, 2021 00:14 Inactive
import java.util.Optional;
import java.util.function.Consumer;

public interface MessageTracker<T> extends Consumer<T> {
public interface MessageTracker<T> extends Consumer<T>, Application {
Copy link
Contributor

@michel-tricot michel-tricot Oct 22, 2021

Choose a reason for hiding this comment

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

this doesn't seem right. Message Tracker isn't an Application. I wonder if the way to track name is wrong or just the naming of this interface. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that we need make sure that I properly understand how granular we want to log. My initial thought was that we have a different prefix within the same application (a different prefix per step). So if we want to go in this direction we will probably need to rename the interface. If not I should remove the Application interface and move this method to the worker interface.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree the iface name should change.

Will follow up offline, but I'm am not understanding the granularity we are going for right now. The issue is focused on distinguishing source, destination, and platform logs from each other. This PR is focused on distinguishing worker logs from each other, and I'm a little less clear on why that is valuable.

Copy link
Contributor Author

@benmoriceau benmoriceau Oct 22, 2021

Choose a reason for hiding this comment

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

I sync up offline with Michel on that. I will abandon the interface and this review for something more suited to what is needed.

@benmoriceau benmoriceau temporarily deployed to more-secrets October 22, 2021 00:33 Inactive
Copy link
Contributor

@cgardens cgardens left a comment

Choose a reason for hiding this comment

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

a couple questions on the scope of what we are doing here. going to follow up offline.

Comment on lines +9 to +13
default String getApplicationName() {
// This value should only be used in the U-Test, it is an empty string instead of airbyte-test in
// order to avoid displaying airbyte-test in prod
return "";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

By convention, we do not usually use a default in an interface if the default implementation is for testing only. The reason for this is that with this default, it is easy for a developer to make a mistake using this interface because the compiler won't warn them that they need to override method. If they fail to do that, then test code will accidentally run in production. Instead we would usually structure it something like this, so that the compiler complains if the developer makes a mistake.

Suggested change
default String getApplicationName() {
// This value should only be used in the U-Test, it is an empty string instead of airbyte-test in
// order to avoid displaying airbyte-test in prod
return "";
}
String getApplicationName();
class TestApplication implements Application {
@Override
public String getApplicationName() {
// This value should only be used in the U-Test, it is an empty string instead of airbyte-test in
// order to avoid displaying airbyte-test in prod
return "";
}
}

import java.util.Optional;
import java.util.function.Consumer;

public interface MessageTracker<T> extends Consumer<T> {
public interface MessageTracker<T> extends Consumer<T>, Application {
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree the iface name should change.

Will follow up offline, but I'm am not understanding the granularity we are going for right now. The issue is focused on distinguishing source, destination, and platform logs from each other. This PR is focused on distinguishing worker logs from each other, and I'm a little less clear on why that is valuable.

@swyxio swyxio deleted the bmoric/add-application-name branch October 12, 2022 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform issues related to the platform area/worker Related to worker type/refactoring Focused on refactoring.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants