Skip to content

Conversation

@daniel-sanche
Copy link
Contributor

When client_info is not given to a new client, it now defaults to the values used by self._connection._client_info, rather than using None. This will allow the expected headers to be populated when using the grpc transport

Also added tests to ensure client_info is always set as expected in all classes

Fixes #680

@daniel-sanche daniel-sanche requested review from a team as code owners December 2, 2022 01:53
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: logging Issues related to the googleapis/python-logging API. labels Dec 2, 2022


def test_logging_default_client_info_headers():
import re
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like repeated code - can you create one function controlled/operated by parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah unfortunately a lot of these test files contain mostly repeated test code pointed at different services. I considered making a different file for just these tests that could share more logic, but then decided to follow the existing conventions instead. Let me know if you think that makes sense

Copy link
Contributor

Choose a reason for hiding this comment

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

If you not plan to fix it in tests now, I guess lets open a bug and solve it later - lets keep a good standard to avoid code duplication

Copy link
Contributor

@losalex losalex left a comment

Choose a reason for hiding this comment

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

LGTM. Please open a bug for code duplication cleanup

@daniel-sanche daniel-sanche merged commit b74d2a8 into main Dec 5, 2022
@daniel-sanche daniel-sanche deleted the fix_headers branch December 5, 2022 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: logging Issues related to the googleapis/python-logging API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: client_info is not being properly set in client init

2 participants