-
Notifications
You must be signed in to change notification settings - Fork 249
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
Added set_status to span, updated pymongo integration #738
Merged
c24t
merged 11 commits into
census-instrumentation:master
from
victoraugustolls:feature/span-status-mongo
Aug 2, 2019
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8dc3217
Added set_status to span and tracer, including tests
victoraugustolls 37ea11e
Modified attribute keys to open telemetry recommended ones
victoraugustolls f918a24
Updated CHANGELOG's
victoraugustolls 984c341
Fixed quotes
victoraugustolls 5cf60d9
Fixed pymongo tests variable name
victoraugustolls 14314d5
Removed set_status_to_current_span from tracer, used directly on span…
victoraugustolls ac6e92c
Updated span set_status method signature
victoraugustolls 4c0fa97
Updated CHANGELOG
victoraugustolls c7a9fa6
Updated Status to be closer to specs
victoraugustolls 1cf8d0f
Merge branch 'master' into feature/span-status-mongo
victoraugustolls 6663574
Update pymongo changelog and revert property names on status
victoraugustolls File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,17 +39,31 @@ class Status(object): | |
See: https://cloud.google.com/trace/docs/reference/v2/ | ||
rest/v2/Status#FIELDS.details | ||
""" | ||
def __init__(self, code, message, details=None): | ||
self.code = code | ||
self.message = message | ||
def __init__(self, code, message=None, details=None): | ||
self._code = code | ||
self._message = message | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes to add |
||
self.details = details | ||
|
||
@property | ||
def canonical_code(self): | ||
return self._code | ||
|
||
@property | ||
def description(self): | ||
return self._message | ||
|
||
@property | ||
def is_ok(self): | ||
return self._code == code_pb2.OK | ||
|
||
def format_status_json(self): | ||
"""Convert a Status object to json format.""" | ||
status_json = {} | ||
|
||
status_json['code'] = self.code | ||
status_json['message'] = self.message | ||
status_json['code'] = self._code | ||
|
||
if self._message is not None: | ||
status_json['message'] = self._message | ||
|
||
if self.details is not None: | ||
status_json['details'] = self.details | ||
|
@@ -62,3 +76,9 @@ def from_exception(cls, exc): | |
code=code_pb2.UNKNOWN, | ||
message=str(exc) | ||
) | ||
|
||
@classmethod | ||
def as_ok(cls): | ||
return cls( | ||
code=code_pb2.OK, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We shouldn't link to the OT spec here.
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 have slightly different opinion on this.
I agree that OpenCensus Python should follow OpenCensus spec. Following OpenTelemetry spec is not the goal here, but it is nice to have if:
With these, I think having a link to OT spec is similar like saying "we are supporting W3C CorrelationContext version 2" - not something required in OC spec, but a nice to have feature.
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 agree with all that, I'm just concerned about putting a link to the OT spec in something as public as the release notes. There's already a lot of confusion around OC/OT, linking the OT spec here might invite more.