| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| # limitations under the License. | ||
|
|
||
| from pkg_resources import get_distribution | ||
| __version__ = get_distribution('google-cloud-trace').version |
|
|
||
| """GAX Wrapper for interacting with the Stackdriver Trace API.""" | ||
|
|
||
| from google.cloud.gapic.trace.v1.trace_service_client import ( |
| self, | ||
| name, | ||
| kind=Enum.SpanKind.SPAN_KIND_UNSPECIFIED, | ||
| parent_span_id=None, |
| from google.cloud.trace.trace_span import TraceSpan | ||
|
|
||
|
|
||
| __all__ = ['_TraceAPI', 'Client', 'Trace', 'TraceSpan'] |
|
|
||
| """GAX Wrapper for interacting with the Stackdriver Trace API.""" | ||
|
|
||
| from google.cloud.gapic.trace.v1.trace_service_client import ( |
| return GAXIterator(self.client, page_iter, item_to_value) | ||
|
|
||
|
|
||
| def _parse_trace_pb(trace_pb): |
| raise | ||
|
|
||
|
|
||
| def _item_to_mapping(iterator, trace_pb): |
| @@ -0,0 +1,65 @@ | |||
| # Copyright 2017 Google Inc. | |||
| return int(span_id) | ||
|
|
||
|
|
||
| def format_span_json(span): |
| :returns: Identifier for the span. Must be a 64-bit integer other | ||
| than 0 and unique within a trace. Converted to string. | ||
| """ | ||
| span_id = str(random.getrandbits(64)) |
|
|
||
| from datetime import datetime | ||
|
|
||
| PROJECT = 'PROJECT' |
| None, None, None, None, None, None, None)) | ||
|
|
||
|
|
||
| class _DummyTraceAPI(object): |
| self.assertIs(trace_api.client, client) | ||
|
|
||
|
|
||
| class _GAXTraceAPI(_GAXBaseAPI): |
|
Ready for another review. |
Sorry, something went wrong.
| return GAXIterator(self.client, page_iter, item_to_value) | ||
|
|
||
|
|
||
| def _parse_trace_pb(trace_pb): |
| raise | ||
|
|
||
|
|
||
| def _item_to_mapping(iterator, trace_pb): |
| def __init__(self, client, project_id=None, trace_id=None): | ||
| self.client = client | ||
|
|
||
| if project_id is None: |
|
@lukesneeringer @dhermes this mostly looks good to me. I have a few outstanding questions for you two and I would like one of y'all to do a final review. |
Sorry, something went wrong.
| @@ -1,5 +1,6 @@ | |||
| include README.rst LICENSE | |||
| global-include *.json | |||
| recursive-include unit_tests * | |||
| :rtype: str | ||
| :returns: 32 digits randomly generated trace ID. | ||
| """ | ||
| trace_id = str(uuid.uuid4()).replace('-', '') |
| :returns: Identifier for the span. Must be a 64-bit integer other | ||
| than 0 and unique within a trace. Converted to string. | ||
| """ | ||
| span_id = uuid.uuid4().int & (1 << 64)-1 |
| return self._get_target_class()(*args, **kw) | ||
|
|
||
|
|
||
| class Test__TraceAPI(_Base, unittest.TestCase): |
| self.assertIs(trace_api.client, client) | ||
|
|
||
|
|
||
| class _GAXTraceAPI(_GAXBaseAPI): |
|
@duggelz Should be the first one, actually the order doesn't matter. As long as we patch a list of spans to the trace API, the cloud trace console will show the trace graph according to the parent_span_id in each span. |
Sorry, something went wrong.
|
Ready for another review. |
Sorry, something went wrong.
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate. |
Sorry, something went wrong.
|
CLAs look good, thanks! |
Sorry, something went wrong.
|
@lukesneeringer Can I merge this to the auto-gen branch now? Or wait for the autogen code to be updated? |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Implemented the veneer layer of the trace library based on the auto-generated code. This will provide the trace and span context managers and simplify the API for users who want to manually instrument their code. Sample usage in the gist: https://gist.github.com/liyanhui1228/20ac515d74e134ea39b0e63a9d0524bf