Skip to content

Conversation

@pratyakshs
Copy link
Contributor

@pratyakshs pratyakshs commented Mar 16, 2023

What

Slack APIs are heavily rate limited, and this minor change improves the performance of this connector by 10x with no impact to quality.

How

It updates the page size of the connector

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the connector is published, connector added to connector index as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here
Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub and connector version bumped by running the /publish command described here
Connector Generator
  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed

Slack APIs are heavily rate limited, and this minor change improves the performance of this connector by 10x with no impact to quality.
@CLAassistant
Copy link

CLAassistant commented Mar 16, 2023

CLA assistant check
All committers have signed the CLA.

@pratyakshs pratyakshs changed the title Update page size for slack requests to 999 Source Slack: Increase page_size/limit param for API calls Mar 16, 2023
url_base = "https://slack.com/api/"
primary_key = "id"
page_size = 100
page_size = 999
Copy link
Contributor

Choose a reason for hiding this comment

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

Where did you read in Slack documentation saying the limit is 999?

Copy link
Contributor

Choose a reason for hiding this comment

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

I found this documentation saying the limit is 1000 https://api.slack.com/docs/pagination

Copy link
Contributor

@marcosmarxm marcosmarxm Mar 16, 2023

Choose a reason for hiding this comment

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

I triggered tests to validate the change.

@marcosmarxm
Copy link
Contributor

marcosmarxm commented Mar 16, 2023

/test connector=connectors/source-slack

🕑 connectors/source-slack https://github.com/airbytehq/airbyte/actions/runs/4440645148
❌ connectors/source-slack https://github.com/airbytehq/airbyte/actions/runs/4440645148
🐛 https://gradle.com/s/vrmgtzjfrijsk

Build Failed

Test summary info:

	 =========================== short test summary info ============================
	 FAILED unit_tests/test_source.py::test_streams[config0-True] - requests_mock....
	 FAILED unit_tests/test_source.py::test_streams[config1-True] - requests_mock....
	 FAILED unit_tests/test_source.py::test_streams[config2-True] - requests_mock....
	 FAILED unit_tests/test_source.py::test_check_connection[200-response0-True-None]
	 FAILED unit_tests/test_source.py::test_check_connection[400-Bad request-False-Got an exception while trying to set up the connection: 400 Client Error: None for url: https:/slack.com/api/users.list?limit=100. Most probably, there are no users in the given Slack instance or your token is incorrect]
	 FAILED unit_tests/test_source.py::test_check_connection[403-Forbidden-False-Got an exception while trying to set up the connection: 403 Client Error: None for url: https:/slack.com/api/users.list?limit=100. Most probably, there are no users in the given Slack instance or your token is incorrect]
	 FAILED unit_tests/test_streams.py::test_threads_stream_slices[2020-01-01T00:00:00Z-2020-01-02T00:00:00Z-messages0-stream_state0-expected_result0]
	 FAILED unit_tests/test_streams.py::test_threads_stream_slices[2020-01-02T00:00:00Z-2020-01-01T00:00:00Z-messages1-stream_state1-expected_result1]
	 FAILED unit_tests/test_streams.py::test_threads_stream_slices[2020-01-01T00:00:00Z-2020-01-02T00:00:00Z-messages2-stream_state2-expected_result2]
	 �[31m=================== �[31m�[1m9 failed�[0m, �[32m7 passed�[0m, �[33m81 warnings�[0m�[31m in 1.43s�[0m�[31m ===================�[0m

@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Mar 20, 2023
@marcosmarxm
Copy link
Contributor

marcosmarxm commented Mar 20, 2023

/test connector=connectors/source-slack

🕑 connectors/source-slack https://github.com/airbytehq/airbyte/actions/runs/4471873324
✅ connectors/source-slack https://github.com/airbytehq/airbyte/actions/runs/4471873324
Python tests coverage:

Name                       Stmts   Miss  Cover
----------------------------------------------
source_slack/__init__.py       2      0   100%
source_slack/source.py       225     19    92%
----------------------------------------------
TOTAL                        227     19    92%

Build Passed

Test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/connector_acceptance_test/tests/test_core.py:100: The previous and actual specifications are identical.
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/connector_acceptance_test/tests/test_core.py:509: The previous and actual discovered catalogs are identical.
================== 37 passed, 2 skipped in 4045.29s (1:07:25) ==================

@marcosmarxm marcosmarxm requested a review from davydov-d March 20, 2023 19:01
@marcosmarxm
Copy link
Contributor

@davydov-d can you check this change? From Slack documentation

The limit parameter sets a maximum number of results to return per call.
Provide sensible limit values. We recommend 100-200 results at a time.
The limit parameter maximum is 1000 and subject to change and may vary per method.

The tests works with 1000 limit... should we update it?

@marcosmarxm
Copy link
Contributor

marcosmarxm commented Mar 20, 2023

/publish connector=connectors/source-slack

🕑 Publishing the following connectors:
connectors/source-slack
https://github.com/airbytehq/airbyte/actions/runs/4472780909


Connector Did it publish? Were definitions generated?
connectors/source-slack

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@marcosmarxm marcosmarxm enabled auto-merge (squash) March 21, 2023 00:08
@marcosmarxm marcosmarxm merged commit 0cf36ed into airbytehq:master Mar 21, 2023
erohmensing pushed a commit that referenced this pull request Mar 22, 2023
* Update page size for slack requests to 999

Slack APIs are heavily rate limited, and this minor change improves the performance of this connector by 10x with no impact to quality.

* update page_size limit to 1000

* bump connector version

* auto-bump connector version

---------

Co-authored-by: Marcos Marx <marcosmarxm@users.noreply.github.com>
Co-authored-by: marcosmarxm <marcosmarxm@gmail.com>
Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
erohmensing pushed a commit that referenced this pull request Mar 22, 2023
* Update page size for slack requests to 999

Slack APIs are heavily rate limited, and this minor change improves the performance of this connector by 10x with no impact to quality.

* update page_size limit to 1000

* bump connector version

* auto-bump connector version

---------

Co-authored-by: Marcos Marx <marcosmarxm@users.noreply.github.com>
Co-authored-by: marcosmarxm <marcosmarxm@gmail.com>
Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/connectors Connector related issues area/documentation Improvements or additions to documentation bounty community connectors/source/slack

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants