Implement trace, trace_span, span_context and reporters#1
Implement trace, trace_span, span_context and reporters#1liyanhui1228 merged 4 commits intocensus-instrumentation:masterfrom
Conversation
trace/.gitignore
Outdated
| @@ -0,0 +1,66 @@ | |||
| *.py[cod] | |||
There was a problem hiding this comment.
Can we get rid of this file since it's the same as the .gitignore at the top level?
trace/file_name
Outdated
| @@ -0,0 +1 @@ | |||
| {} No newline at end of file | |||
| @@ -0,0 +1,12 @@ | |||
| OpenCensus - A stats collection and distributed tracing framework | |||
There was a problem hiding this comment.
Can we merge this with the top-level README.rst?
There was a problem hiding this comment.
This file is for opencensus-trace, and the top level is for opencensus overall. I'll add sample usage after merging the tracers stuff.
trace/nox.py~
Outdated
| @@ -0,0 +1,79 @@ | |||
| # Copyright 2016 Google Inc. | |||
| :returns: Traces printed. | ||
| """ | ||
| print(traces) | ||
| return traces |
There was a problem hiding this comment.
It's for unit testing this function, to assert the content it prints.
There was a problem hiding this comment.
That's fine. If we move to pytest there is an easier way.
| self.from_header = False | ||
| return generate_trace_id() | ||
|
|
||
| except TypeError: |
There was a problem hiding this comment.
I'd prefer that a type be an assertion failure than implicitly creating a new trace id, because it indicates a bug in someone's code.
trace/opencensus/trace/trace_span.py
Outdated
|
|
||
| """TraceSpan for sending traces to the Stackdriver Trace API.""" | ||
|
|
||
| from datetime import datetime |
trace/opencensus/trace/trace.py
Outdated
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """Trace for interacting with the Stackdriver Trace API.""" |
trace/opencensus/trace/trace_span.py
Outdated
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """TraceSpan for sending traces to the Stackdriver Trace API.""" |
There was a problem hiding this comment.
Can you remove the reference to Stackdriver? You describe what a TraceSpan is in the class, so maybe this comment isn't needed at all.
trace/requirements.txt
Outdated
| @@ -0,0 +1,2 @@ | |||
| googleapis-common-protos>=1.5.2, <2.0dev | |||
Creating stats "bare bone" prototype
Mostly reviewed in google-cloud-python repository, just changed the namespace to opencensus.trace and added unit tests and reporters.