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

Move to HTTP Inspector #2626

Merged
merged 17 commits into from Dec 18, 2022
Merged

Move to HTTP Inspector #2626

merged 17 commits into from Dec 18, 2022

Conversation

ahopkins
Copy link
Member

@ahopkins ahopkins commented Dec 13, 2022

Replace #2620 and #2618

This PR does the following:

  1. Moves the Inspector to a Sanic app from a simple TCP socket with a custom protocol
  2. Deprecates the --inspect commands so that we can nest them: sanic inspect ...
  3. Adds the ability to ping the inspector by host/port (remote access now possible)
  4. Adds TLS support
  5. Adds authentication
  6. Adds inspector_class to the Sanic instance similar to some other classes to allow for simple extendability

Because there is a simple pattern to extend, it is possible to add your own custom commands:

class CustomInspector(Inspector):
    async def foo(self, one):
        return "This value will be output back to terminal"


app = Sanic("TestApp", inspector=True, inspector_class=CustomInspector)
sanic inspect foo --one=1

This was referenced Dec 13, 2022
@ahopkins ahopkins marked this pull request as ready for review December 14, 2022 14:29
@ahopkins ahopkins requested a review from a team as a code owner December 14, 2022 14:29
@codecov
Copy link

codecov bot commented Dec 14, 2022

Codecov Report

Base: 88.622% // Head: 88.553% // Decreases project coverage by -0.068% ⚠️

Coverage data is based on head (7a12806) compared to base (bfb54b0).
Patch coverage: 93.589% of modified lines in pull request are covered.

Additional details and impacted files
@@              Coverage Diff              @@
##              main     #2626       +/-   ##
=============================================
- Coverage   88.622%   88.553%   -0.069%     
=============================================
  Files           81        81               
  Lines         6706      6701        -5     
  Branches      1143      1143               
=============================================
- Hits          5943      5934        -9     
- Misses         527       528        +1     
- Partials       236       239        +3     
Impacted Files Coverage Δ
sanic/http/tls/context.py 95.535% <66.666%> (-0.861%) ⬇️
sanic/worker/inspector.py 93.902% <93.846%> (-5.023%) ⬇️
sanic/app.py 89.818% <100.000%> (+0.018%) ⬆️
sanic/config.py 97.402% <100.000%> (+0.051%) ⬆️
sanic/mixins/startup.py 91.196% <100.000%> (+0.205%) ⬆️
sanic/worker/serve.py 91.428% <100.000%> (+0.252%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

sanic/cli/inspector.py Show resolved Hide resolved
sanic/cli/app.py Show resolved Hide resolved
sanic/cli/app.py Outdated Show resolved Hide resolved
sanic/cli/app.py Outdated Show resolved Hide resolved
sanic/cli/base.py Show resolved Hide resolved
sanic/worker/inspector.py Outdated Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
prryplatypus
prryplatypus previously approved these changes Dec 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants