Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Comments

Implement trace, trace_span, span_context and reporters#1

Merged
liyanhui1228 merged 4 commits intocensus-instrumentation:masterfrom
liyanhui1228:trace
Jul 26, 2017
Merged

Implement trace, trace_span, span_context and reporters#1
liyanhui1228 merged 4 commits intocensus-instrumentation:masterfrom
liyanhui1228:trace

Conversation

@liyanhui1228
Copy link
Contributor

@liyanhui1228 liyanhui1228 commented Jul 25, 2017

Mostly reviewed in google-cloud-python repository, just changed the namespace to opencensus.trace and added unit tests and reporters.

trace/.gitignore Outdated
@@ -0,0 +1,66 @@
*.py[cod]
Copy link

Choose a reason for hiding this comment

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

Can we get rid of this file since it's the same as the .gitignore at the top level?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

trace/file_name Outdated
@@ -0,0 +1 @@
{} No newline at end of file
Copy link

Choose a reason for hiding this comment

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

Spurious file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@@ -0,0 +1,12 @@
OpenCensus - A stats collection and distributed tracing framework
Copy link

Choose a reason for hiding this comment

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

Can we merge this with the top-level README.rst?

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 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.
Copy link

Choose a reason for hiding this comment

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

Spurious file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

:returns: Traces printed.
"""
print(traces)
return traces
Copy link

Choose a reason for hiding this comment

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

Why return anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's for unit testing this function, to assert the content it prints.

Copy link

Choose a reason for hiding this comment

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

That's fine. If we move to pytest there is an easier way.

self.from_header = False
return generate_trace_id()

except TypeError:
Copy link

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


"""TraceSpan for sending traces to the Stackdriver Trace API."""

from datetime import datetime
Copy link

Choose a reason for hiding this comment

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

Import ordering

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

# See the License for the specific language governing permissions and
# limitations under the License.

"""Trace for interacting with the Stackdriver Trace API."""
Copy link

Choose a reason for hiding this comment

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

Can you update this comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

# See the License for the specific language governing permissions and
# limitations under the License.

"""TraceSpan for sending traces to the Stackdriver Trace API."""
Copy link

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@@ -0,0 +1,2 @@
googleapis-common-protos>=1.5.2, <2.0dev
Copy link

Choose a reason for hiding this comment

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

These aren't required right now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@liyanhui1228 liyanhui1228 merged commit e007e5d into census-instrumentation:master Jul 26, 2017
@liyanhui1228 liyanhui1228 deleted the trace branch July 28, 2017 17:31
kcooperstein added a commit that referenced this pull request Jun 4, 2018
Creating stats "bare bone" prototype
@Gamecock Gamecock mentioned this pull request Dec 16, 2020
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.

2 participants