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

Fix python packaging and running the snowflake integration on CF #188

Merged
merged 4 commits into from
Jul 28, 2023

Conversation

sarah-witt
Copy link
Contributor

@sarah-witt sarah-witt commented Dec 5, 2022

What does this PR do?

  • Instructs the agent to infer the correct python home instead of explicitly setting it

Previously, we were manually setting PYTHONHOME which did not fully set the path and thus made the snowflake check fail, which has a dependency that calls the platform.platform() standard library function which looks for the current executable:

2022-11-14 14:43:56 UTC | CORE | DEBUG | (pkg/collector/python/loader.go:150 in Load) | Unable to load python module - datadog_checks.snowflake: unable to import module 'datadog_checks.snowflake': Traceback (most recent call last):
  File "/var/vcap/jobs/dd-agent/packages/dd-agent/embedded/lib/python3.8/site-packages/datadog_checks/snowflake/__init__.py", line 14, in <module>
    from .check import SnowflakeCheck
  File "/var/vcap/jobs/dd-agent/packages/dd-agent/embedded/lib/python3.8/site-packages/datadog_checks/snowflake/check.py", line 6, in <module>
    import snowflake.connector as sf
  File "/var/vcap/jobs/dd-agent/packages/dd-agent/embedded/lib/python3.8/site-packages/snowflake/connector/__init__.py", line 15, in <module>
    from .connection import SnowflakeConnection
  File "/var/vcap/jobs/dd-agent/packages/dd-agent/embedded/lib/python3.8/site-packages/snowflake/connector/connection.py", line 34, in <module>
    from . import errors, proxy
  File "/var/vcap/jobs/dd-agent/packages/dd-agent/embedded/lib/python3.8/site-packages/snowflake/connector/errors.py", line 14, in <module>
    from .description import CLIENT_NAME, SNOWFLAKE_CONNECTOR_VERSION
  File "/var/vcap/jobs/dd-agent/packages/dd-agent/embedded/lib/python3.8/site-packages/snowflake/connector/description.py", line 17, in <module>
    PLATFORM = platform.platform()
  File "/var/vcap/jobs/dd-agent/packages/dd-agent/embedded/lib/python3.8/platform.py", line 1206, in platform
    libcname, libcversion = libc_ver(sys.executable)
  File "/var/vcap/jobs/dd-agent/packages/dd-agent/embedded/lib/python3.8/platform.py", line 193, in libc_ver
    with open(executable, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/opt/datadog-agent/embedded/bin/python3'

NOTE: this PR requires version agent 7.44.0 or higher for the snowflake integration to work

Description of the Change

Alternate Designs

Possible Drawbacks

Verification Process

Additional Notes

Release Notes

Review checklist (to be filled by reviewers)

  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
  • PR should not have do-not-merge/ label attached.
  • If Applicable, issue must have kind/ and severity/ labels attached at least.

@sarah-witt sarah-witt added the changelog/Fixed Fixed features results into a bug fix version bump label Dec 5, 2022
@sarah-witt sarah-witt marked this pull request as ready for review December 5, 2022 20:16
@sarah-witt sarah-witt requested a review from a team as a code owner December 5, 2022 20:16
NouemanKHAL
NouemanKHAL previously approved these changes Dec 16, 2022
@sarah-witt sarah-witt merged commit 042e74d into master Jul 28, 2023
@sarah-witt sarah-witt deleted the sarah/fix-python-path branch July 28, 2023 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/Fixed Fixed features results into a bug fix version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants