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

connectors-qa: add check for 'maxSecondsBetweenMessages' presence in certified connectors metadata #36803

Merged

Conversation

DanyloGL
Copy link
Collaborator

@DanyloGL DanyloGL commented Apr 3, 2024

All certified source connectors must have maximum request rate limit reset time set in their metadata.yaml files.

What

Added QA check for presence of 'maxSecondsBetweenMessages' value in 'metadata.yaml' files for all certified source python and low-code connectors.

How

  • added new check to metadata.py file
  • added tests to test_metadata.py file
  • updated documents: qa-checks.md file

🚨 User Impact 🚨

No breaking changes

@DanyloGL DanyloGL requested a review from a team as a code owner April 3, 2024 16:47
Copy link

vercel bot commented Apr 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 22, 2024 8:57am

@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Apr 3, 2024
@DanyloGL DanyloGL requested review from lazebnyi and a team April 3, 2024 16:47
@DanyloGL DanyloGL requested a review from bazarnov April 3, 2024 17:01
@DanyloGL DanyloGL self-assigned this Apr 3, 2024
@@ -149,8 +149,33 @@ def _run(self, connector: Connector) -> CheckResult:
)


class CheckConnectorMaxSecondsBetweenMessagesValue(MetadataCheck):
name = "Certified connector must have a value filled out for maxSecondsBetweenMessages in metadata"
description = f"Certified connectors must have a value filled out for maxSecondsBetweenMessages in metadata. It must be set in the 'data' field in {consts.METADATA_FILE_NAME}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add more details about the purpose of this field, why its important etc.?

class CheckConnectorMaxSecondsBetweenMessagesValue(MetadataCheck):
name = "Certified connector must have a value filled out for maxSecondsBetweenMessages in metadata"
description = f"Certified connectors must have a value filled out for maxSecondsBetweenMessages in metadata. It must be set in the 'data' field in {consts.METADATA_FILE_NAME}"
applies_to_connector_languages = [ConnectorLanguage.PYTHON, ConnectorLanguage.LOW_CODE]
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it make sense to remove this line so that it runs for java connectors too?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good point

applies_to_connector_languages = [ConnectorLanguage.PYTHON, ConnectorLanguage.LOW_CODE]

@staticmethod
def check_connector_certified(connector: Connector) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this check should run on all connectors.

Copy link
Collaborator

@bazarnov bazarnov Apr 3, 2024

Choose a reason for hiding this comment

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

All certified should be covered, what is the purpose of having this for the community sources?

Copy link
Contributor

Choose a reason for hiding this comment

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

We want to enforce best practices on new community PRs too.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have a strong opinion. Say we run this on all community connectors — will their CI be red on all pull requests moving forward unless we add the field? We'd end up just adding the field with some dummy value, because knowing actual value requires tedious work of actually reading the API docs.

I'd say it should be a requirement to be published on Cloud, so perhaps certified is alright?

@DanyloGL DanyloGL removed their assignment Apr 3, 2024
Copy link
Contributor

@natikgadzhi natikgadzhi left a comment

Choose a reason for hiding this comment

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

Left some comments — I like the idea, but I'll let Augustin to support this through the review.

Either way, please add the changelog + version.

applies_to_connector_languages = [ConnectorLanguage.PYTHON, ConnectorLanguage.LOW_CODE]

@staticmethod
def check_connector_certified(connector: Connector) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have a strong opinion. Say we run this on all community connectors — will their CI be red on all pull requests moving forward unless we add the field? We'd end up just adding the field with some dummy value, because knowing actual value requires tedious work of actually reading the API docs.

I'd say it should be a requirement to be published on Cloud, so perhaps certified is alright?

@staticmethod
def check_connector_certified(connector: Connector) -> bool:
connector_sl_value = connector.metadata.get("ab_internal", {}).get("sl", 0)
return connector_sl_value >= 200
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if certified is the same as connector_sl_value being higher than 200.
I see what you did here — but do you really want that criteria vs perhaps this check should only run on connectors that are published to cloud registry instead? @alafanechere has a method to check for whether connector is in registry in a neighboring PR somewhere.

Copy link
Collaborator

@lazebnyi lazebnyi left a comment

Choose a reason for hiding this comment

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

lgtm

@staticmethod
def check_connector_certified(connector: Connector) -> bool:
connector_sl_value = connector.metadata.get("ab_internal", {}).get("sl", 0)
return connector_sl_value >= 200
Copy link
Contributor

Choose a reason for hiding this comment

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

You should use the supportLevel instead of the sl_value

Suggested change
return connector_sl_value >= 200
return connector.metadata.get("supportLevel") == "certified"

I think sl_value is not accurate as archived connector still have the sl_value set to 200

applies_to_connector_types = ["source"]

@staticmethod
def check_connector_certified(connector: Connector) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this method should move up to the Check abstract class and you should add a runs_on_certified_connectors property and change Check.run method to skip there if the connector is not certified. (same logic as if connector.language not in self.applies_to_connector_languages:)

Copy link
Collaborator

@lazebnyi lazebnyi left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!
Just a minor comment for maintainability.

@@ -21,6 +21,8 @@

ALL_TYPES = ["source", "destination"]

ALL_SUPPORT_LEVELS = ["certified", "community"]
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: if we add a new support level we would have to update this list.
We could make applies_to_connector_support_levels return None by default which would me "applies to all support levels"

DanyloGL and others added 3 commits April 18, 2024 19:06
…_maxSecondsBetweenMessages_value' into Danylo_GL/QA_check_metadata_file_maxSecondsBetweenMessages_value
…_maxSecondsBetweenMessages_value' into Danylo_GL/QA_check_metadata_file_maxSecondsBetweenMessages_value
@lazebnyi lazebnyi merged commit 17a374e into master Apr 25, 2024
35 checks passed
@lazebnyi lazebnyi deleted the Danylo_GL/QA_check_metadata_file_maxSecondsBetweenMessages_value branch April 25, 2024 12:17
FVidalCarneiro pushed a commit to AgiData/airbyte that referenced this pull request May 2, 2024
…certified connectors metadata (airbytehq#36803)

Co-authored-by: Natik Gadzhi <natik@respawn.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants