-
Notifications
You must be signed in to change notification settings - Fork 251
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
Add ability to pass auxiliary attributes to set on GRPC trace #371
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I have just signed the CLA |
CLAs look good, thanks! |
+1 for this, I'd rename those to |
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.
A few comments, but it look good otherwise. What's the motivation for the change?
# Add user defined auxiliary attributes to span | ||
if type(self.aux_attributes) is dict: | ||
for attr_key, attr_value in self.aux_attributes.items(): | ||
if type(attr_key) is not str and type(attr_value) is not str: |
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.
Not or
?
@@ -86,6 +87,16 @@ def _start_client_span(self, client_call_details): | |||
attribute_key=attributes_helper.GRPC_ATTRIBUTES.get(GRPC_METHOD), | |||
attribute_value=str(client_call_details.method)) | |||
|
|||
# Add user defined auxiliary attributes to span | |||
if type(self.aux_attributes) is dict: |
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.
Nit, but you might want isinstance(dict)
here so e.g. defaultdict
s work here too.
if type(self.aux_attributes) is dict: | ||
for attr_key, attr_value in self.aux_attributes.items(): | ||
if type(attr_key) is not str and type(attr_value) is not str: | ||
continue |
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.
It looks like you're missing some coverage here: ...98% 94, 91->100, 93->94
.
You can run coverage report -m -i $(git diff --name-only master)
after running the tests with --cov=opencensus
to check uncovered lines.
Overview
Support an optional
aux_attributes
parameter toOpenCensusClientInterceptor
constructor in order to allow users to specify arbitrary tags on GRPC method trace spans.