Request and response logging
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 763
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
It's sometimes unclear why some requests fail. When there would be a possibility to log all requests and response, that move between SDK and vCenter, would make debugging easier. Since the amount of data can be big and many requests aren't relevant, a way to filter (include or exclude requests/responses by name) would be appreciated.
Describe the solution you'd like
Standard python logging would be preferred. The solution should have a way to configure, which requests and responses are being logged (include or exclude by name)
Describe alternatives you've considered
If there would be a way to add custom hooks for pyVmomi.SoapAdapter.SoapStubAdapter.InvokeMethod, then user could decide how the logging is done. Those would be then passed on through the connection (ServiceInstance)
Example:
def InvokeMethod(self, mo, info, args, outerStub=None, request_logger=None, response_logger=None):
...
try:
request_logger(mo)
except:
...
req = self.SerializeRequest(mo, info, args)
...
conn.request('POST', self.path, req, headers)
resp = conn.getresponse()
try:
response_logger(resp)
except:
...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at pyVmomi.SoapAdapter.SoapStubAdapter.InvokeMethod and trace how the connection is passed through ServiceInstance. Define how standard Python logging, request/response name filters, and optional hooks should interact, then verify that selected traffic can be logged without requiring custom application changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100