Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Remove debug flag; Allow passing tags to start methods; Add Span.add_tags() method #3

Merged
merged 1 commit into from
Jan 8, 2016

Conversation

yurishkuro
Copy link
Contributor

No description provided.

- Allow passing tags to start methods
- Add Span.add_tags() method
@yurishkuro
Copy link
Contributor Author

@bensigelman

@@ -135,7 +146,7 @@ def is_debug(self):
return self.trace_context.flags & DEBUG_FLAG == DEBUG_FLAG

def __str__(self):
from .encoding import TraceContextEncoder
from .marshaling import TraceContextEncoder

Choose a reason for hiding this comment

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

from an offline discussion w/ @bensigelman I thought we were going with...

Proposal:
%s/Marshaler/Encoder/g (etc)
%s/​Unmarshaler/Decoder/g (etc)
trace_context_(from|to)_(binary|text) in python, TraceContext(From|To)(Binary|Text) in golang

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, I assume this is just a rebase/merge issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh -- right. this is the zipkin dir. did I miss a file rename, maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was just to fix that was left after renaming. We should rename the .py file itself

@codefromthecrypt
Copy link

non-blocking observation about the marshaling thing. otherwise LGTM

yurishkuro added a commit that referenced this pull request Jan 8, 2016
Remove debug flag; Allow passing tags to start methods; Add Span.add_tags() method
@yurishkuro yurishkuro merged commit d34dda7 into master Jan 8, 2016
@@ -63,18 +62,17 @@ def __exit__(self, exc_type, exc_val, exc_tb):
'tb': exc_tb})
self.finish()

def start_child(self, operation_name):
def start_child(self, operation_name, tags=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

stating the obvious here, but there's both

  child_span = parent_span.start_child("op").add_tags(tags)

and

  child_span = parent_span.start_child("op", tags)

Since it's easier to add surface area than remove surface area, I'd vote for keeping the former (more general) and removing the latter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this might be the case where language differences may result in minor divergence in the APIs. Accepting optional tags would be ugly in Go, but elegant in Python since the arg is not required. There are also performance reasons to prefer the second form when available - one less function call, one less mutex lock, and possibly one less memory allocation for the dictionary.

We actually haven't talked about memory allocation, I had a comment somewhere that by passing a dictionary to some call, the caller gives up ownership of that dictionary. We can either emphasize safety by requiring tracer to always take copies of passed collections if it wants to store them, or emphasize performance by telling the caller that it must always give up ownership of collections.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Booked opentracing/opentracing-python#4 to continue this particular discussion.

@yurishkuro yurishkuro deleted the remove-debug-add-tags branch January 8, 2016 04:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants