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

feat: Add logging for ssh tunneling test_connection attempts #22625

Merged
merged 12 commits into from
Jan 12, 2023
Merged

Conversation

hughhhh
Copy link
Member

@hughhhh hughhhh commented Jan 6, 2023

SUMMARY

With ssh tunneling being rolled out, we want to start instrument and verify these connections are successful. To do this i've created a new function to append context of the ssh tunneling to the action field so ETL can parse this accordingly.

Another approach is creating a new column specifically to annotate whether this connection has ssh tunnel enabled.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Jan 6, 2023

Codecov Report

Merging #22625 (71cb19a) into master (5399365) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #22625      +/-   ##
==========================================
+ Coverage   67.07%   67.12%   +0.05%     
==========================================
  Files        1869     1869              
  Lines       71591    72128     +537     
  Branches     7822     7822              
==========================================
+ Hits        48018    48418     +400     
- Misses      21544    21681     +137     
  Partials     2029     2029              
Flag Coverage Δ
hive 52.97% <20.00%> (+0.37%) ⬆️
javascript 53.90% <ø> (ø)
mysql 78.00% <90.00%> (+<0.01%) ⬆️
postgres 78.07% <90.00%> (+<0.01%) ⬆️
presto 52.88% <20.00%> (+0.39%) ⬆️
python 81.19% <100.00%> (-0.11%) ⬇️
sqlite 76.44% <90.00%> (+<0.01%) ⬆️
unit 51.69% <100.00%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/db_engine_specs/impala.py 44.87% <ø> (ø)
superset/databases/commands/test_connection.py 94.50% <100.00%> (+0.52%) ⬆️
superset/models/helpers.py 38.02% <100.00%> (ø)
superset/embedded/view.py 44.44% <0.00%> (-4.05%) ⬇️
superset/models/core.py 86.60% <0.00%> (-3.89%) ⬇️
superset/db_engine_specs/base.py 86.39% <0.00%> (-2.88%) ⬇️
superset/connectors/sqla/models.py 86.78% <0.00%> (-2.59%) ⬇️
superset/views/dashboard/views.py 65.59% <0.00%> (-0.69%) ⬇️
superset/config.py 91.08% <0.00%> (-0.66%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pull-request-size pull-request-size bot added size/M and removed size/S labels Jan 6, 2023
@pull-request-size pull-request-size bot added size/S and removed size/M labels Jan 11, 2023
@pull-request-size pull-request-size bot added size/M and removed size/S labels Jan 11, 2023
@@ -105,7 +117,7 @@ def run(self) -> None: # pylint: disable=too-many-statements
ssh_tunnel = SSHTunnel(**ssh_tunnel)

event_logger.log_with_context(
action="test_connection_attempt",
action=get_log_connection_action("test_connection_attempt", ssh_tunnel),
Copy link
Member

Choose a reason for hiding this comment

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

Are there tests for these?

engine=database.db_engine_spec.__name__,
)
# bubble up the exception to return a 408
raise ex
except Exception as ex:
event_logger.log_with_context(
action=f"test_connection_error.{ex.__class__.__name__}",
action=get_log_connection_action("test_connection_error", ssh_tunnel),
Copy link
Member

Choose a reason for hiding this comment

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

add param for exc

@hughhhh hughhhh merged commit 2de19f1 into master Jan 12, 2023
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
@mistercrunch mistercrunch deleted the ssh-logging branch March 26, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants