-
Notifications
You must be signed in to change notification settings - Fork 69
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 debug log when creating client #2265
base: main
Are you sure you want to change the base?
Conversation
bccb525
to
323df6d
Compare
@@ -243,6 +251,9 @@ class {{ service.async_client_name }}: | |||
|
|||
) | |||
|
|||
if CLIENT_LOGGING_SUPPORTED: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should have an extra line at each logging site to check the logging enablement. Rather, I suggest something like what I propose in prototype R-0 in in go/cloudsdk-python-logging-performant, to abstract away any checking we may want to do while providing an interface (only used by us, not our users) that is parallel to the standard loggers.
gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2
Outdated
Show resolved
Hide resolved
gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2
Outdated
Show resolved
Hide resolved
@@ -243,6 +251,9 @@ class {{ service.async_client_name }}: | |||
|
|||
) | |||
|
|||
if CLIENT_LOGGING_SUPPORTED: | |||
_LOGGER.debug(" {{ service.async_client_name }} client is successfully constructed.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ruby logs include information about which credentials will be used with the client which should be included here as well.
I, [2024-09-30T16:52:15.809067 #1917313] INFO -- google-cloud-secret_manager-v1: Created client for google.cloud.secretmanager.v1.SecretManagerService -- {"clientId":3220,"system":"google-cloud-secret_manager-v1","serviceName":"google.cloud.secretmanager.v1.SecretManagerService","credentialsId":3260,"credentialsType":"Google::Auth::ServiceAccountCredentials","credentialsScope":["https://www.googleapis.com/auth/cloud-platform"],"useSelfSignedJWT":false,"universeDomain":"googleapis.com"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the ruby debug log in #2265 (comment), we're missing the serviceName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added logging for serviceName
via a715854 but it only appears when using structured logging
{"timestamp": "2024-11-28 19:30:07,202", "severity": "DEBUG", "name": "google.showcase_v1beta1.services.echo.client", "message": "Created client `google.showcase_v1beta1.EchoClient`.", "serviceName": "google.showcase.v1beta1.Echo"}
DEBUG:google.showcase_v1beta1.services.echo.client:Created client `google.showcase_v1beta1.EchoClient`.
No description provided.