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

Implement Logging Levels for Supportability, Fixes for Prerecorded Response Types #194

Merged

Conversation

davidvonthenen
Copy link
Contributor

@davidvonthenen davidvonthenen commented Nov 30, 2023

This implements:

  • multiple verbosity levels of logging
  • adds trace statements throughout the code base

During logging implementation, I found the following issues in the prerecorded/v1/response.py classes, causing parsing failures in certain rare situations. The class and properties layout mimic the Go SDK for optional parameters with default values required by dataclasses_json.

Tested to make sure all examples work as expected.
examples/manage/balances and examples/prerecorded/file show examples of how to enable the highest level of verbosity for logging (SPAM).

TODO: Need to figure out a way to reduce the output... the issue is the blah.blah.blah notation causes 3 invocations of accessing the property a single time.

Example output for balances:

(deepgram-python-sdk) vonthd@vonthds-MacBook-Pro-2:balances$ python main.py 
Version.v ENTER
Version.v ENTER
version: 1
version: 1
path: deepgram.clients.manage.v1.client
path: deepgram.clients.manage.v1.client
className: ManageClient
className: ManageClient
Version.v succeeded
Version.v succeeded
Version.v LEAVE
Version.v LEAVE
ManageClient.get_projects ENTER
result: ProjectsResponse(projects=[Project(project_id='add416e2-894f-4fdd-ac54-1da089726fc7', name="David's Project")])
get_projects succeeded
ManageClient.get_projects LEAVE
ListProjects() - ID: add416e2-894f-4fdd-ac54-1da089726fc7, Name: David's Project
Version.v ENTER
Version.v ENTER
Version.v ENTER
version: 1
version: 1
version: 1
path: deepgram.clients.manage.v1.client
path: deepgram.clients.manage.v1.client
path: deepgram.clients.manage.v1.client
className: ManageClient
className: ManageClient
className: ManageClient
Version.v succeeded
Version.v succeeded
Version.v succeeded
Version.v LEAVE
Version.v LEAVE
Version.v LEAVE
ManageClient.get_balances ENTER
ManageClient.get_balances ENTER
result: BalancesResponse(balances=[Balance(balance_id='4af429aa-27e2-4a91-86cc-b1b6c9a2f5bf', amount='198.1015995', units='usd', purchase_order_id='c16bc77f-b483-4d70-9431-f104eba80a86')])
result: BalancesResponse(balances=[Balance(balance_id='4af429aa-27e2-4a91-86cc-b1b6c9a2f5bf', amount='198.1015995', units='usd', purchase_order_id='c16bc77f-b483-4d70-9431-f104eba80a86')])
get_balances succeeded
get_balances succeeded
ManageClient.get_balances LEAVE
ManageClient.get_balances LEAVE
GetBalance() - Name: 4af429aa-27e2-4a91-86cc-b1b6c9a2f5bf, Amount: 198.1015995
Version.v ENTER
Version.v ENTER
Version.v ENTER
Version.v ENTER
version: 1
version: 1
version: 1
version: 1
path: deepgram.clients.manage.v1.client
path: deepgram.clients.manage.v1.client
path: deepgram.clients.manage.v1.client
path: deepgram.clients.manage.v1.client
className: ManageClient
className: ManageClient
className: ManageClient
className: ManageClient
Version.v succeeded
Version.v succeeded
Version.v succeeded
Version.v succeeded
Version.v LEAVE
Version.v LEAVE
Version.v LEAVE
Version.v LEAVE
ManageClient.get_balance ENTER
ManageClient.get_balance ENTER
ManageClient.get_balance ENTER
result: Balance(balance_id='4af429aa-27e2-4a91-86cc-b1b6c9a2f5bf', amount='198.1015995', units='usd', purchase_order_id='c16bc77f-b483-4d70-9431-f104eba80a86')
result: Balance(balance_id='4af429aa-27e2-4a91-86cc-b1b6c9a2f5bf', amount='198.1015995', units='usd', purchase_order_id='c16bc77f-b483-4d70-9431-f104eba80a86')
result: Balance(balance_id='4af429aa-27e2-4a91-86cc-b1b6c9a2f5bf', amount='198.1015995', units='usd', purchase_order_id='c16bc77f-b483-4d70-9431-f104eba80a86')
get_balance succeeded
get_balance succeeded
get_balance succeeded
ManageClient.get_balance LEAVE
ManageClient.get_balance LEAVE
ManageClient.get_balance LEAVE
GetBalance() - Name: 4af429aa-27e2-4a91-86cc-b1b6c9a2f5bf, Amount: 198.1015995

@davidvonthenen davidvonthenen changed the title Implement Logging Levels for Supportability Implement Logging Levels for Supportability, Fixes for Prerecorded Response Types Nov 30, 2023
@davidvonthenen davidvonthenen merged commit f1f94df into deepgram:main Nov 30, 2023
1 check passed
@davidvonthenen davidvonthenen deleted the logging-verbosity-support branch November 30, 2023 23:30
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.

2 participants