diff --git a/docs/trace b/docs/trace new file mode 120000 index 000000000000..a2361d0f9a55 --- /dev/null +++ b/docs/trace @@ -0,0 +1 @@ +../trace/docs \ No newline at end of file diff --git a/docs/trace/apis.rst b/docs/trace/apis.rst deleted file mode 100644 index ffd9160bd41d..000000000000 --- a/docs/trace/apis.rst +++ /dev/null @@ -1,20 +0,0 @@ -API Reference -============= - -APIs ----- - -.. autosummary:: - -.. :toctree:: - - google.cloud.trace_v1.gapic.trace_service_client - - -API types -~~~~~~~~~ - -.. autosummary:: -.. :toctree:: - - google.cloud.trace_v1.gapic.enums diff --git a/docs/trace/changelog.md b/docs/trace/changelog.md deleted file mode 120000 index a1284e432347..000000000000 --- a/docs/trace/changelog.md +++ /dev/null @@ -1 +0,0 @@ -../../trace/CHANGELOG.md \ No newline at end of file diff --git a/docs/trace/conf.py b/docs/trace/conf.py deleted file mode 100644 index 5eead079b01c..000000000000 --- a/docs/trace/conf.py +++ /dev/null @@ -1,311 +0,0 @@ -# -*- coding: utf-8 -*- -# -# google-cloud-trace documentation build configuration file -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys -import os -import shlex - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('..')) - -__version__ = '0.15.4' - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.autosummary', - 'sphinx.ext.intersphinx', - 'sphinx.ext.coverage', - 'sphinx.ext.napoleon', - 'sphinx.ext.viewcode', -] - -# autodoc/autosummary flags -autoclass_content = 'both' -autodoc_default_flags = ['members'] -autosummary_generate = True - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' - -# The encoding of source files. -#source_encoding = 'utf-8-sig' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'google-cloud-trace' -copyright = u'2017, Google' -author = u'Google APIs' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The full version, including alpha/beta/rc tags. -release = __version__ -# The short X.Y version. -version = '.'.join(release.split('.')[0:2]) - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ['_build'] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -#default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = 'sphinx_rtd_theme' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -#html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -#html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -#html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -# html_static_path = [] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -#html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -#html_domain_indices = True - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -#html_split_index = False - -# If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -#html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -#html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -#html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = 'google-cloud-trace-doc' - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - #'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - #'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - #'preamble': '', - - # Latex figure (float) alignment - #'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - (master_doc, 'google-cloud-trace.tex', - u'google-cloud-trace Documentation', author, 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# If true, show page references after internal links. -#latex_show_pagerefs = False - -# If true, show URL addresses after external links. -#latex_show_urls = False - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_domain_indices = True - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [(master_doc, 'google-cloud-trace', - u'google-cloud-trace Documentation', [author], 1)] - -# If true, show URL addresses after external links. -#man_show_urls = False - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'google-cloud-trace', - u'google-cloud-trace Documentation', author, - 'google-cloud-trace', - 'GAPIC library for the {metadata.shortName} v1 service', 'APIs'), -] - -# Documents to append as an appendix to all manuals. -#texinfo_appendices = [] - -# If false, no module index is generated. -#texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = { - 'python': ('http://python.readthedocs.org/en/latest/', None), - 'gax': ('https://gax-python.readthedocs.org/en/latest/', None), -} - -# Napoleon settings -napoleon_google_docstring = True -napoleon_numpy_docstring = True -napoleon_include_private_with_doc = False -napoleon_include_special_with_doc = True -napoleon_use_admonition_for_examples = False -napoleon_use_admonition_for_notes = False -napoleon_use_admonition_for_references = False -napoleon_use_ivar = False -napoleon_use_param = True -napoleon_use_rtype = True diff --git a/docs/trace/index.rst b/docs/trace/index.rst deleted file mode 100644 index e711d27f8894..000000000000 --- a/docs/trace/index.rst +++ /dev/null @@ -1,43 +0,0 @@ -.. gapic-google-cloud-trace-v1 sphinx documentation master file - -:orphan: - -GAPIC library for the Stackdriver Trace API -============================================================================================================= - -This is the API documentation for ``gapic-google-cloud-trace-v1``. - -gapic-google-cloud-trace-v1 uses google-gax_ (Google API extensions) to provide an -easy-to-use client library for the `Stackdriver Trace API`_ (v1) defined in the googleapis_ git repository - - -.. _`google-gax`: https://github.com/googleapis/gax-python -.. _`googleapis`: https://github.com/googleapis/googleapis/tree/master/google/devtools/cloudtrace/v1 -.. _`Stackdriver Trace API`: https://developers.google.com/apis-explorer/?hl=en_US#p/cloudtrace/v1/ - - -APIs ----- - -.. autosummary:: - - google.cloud.trace_v1.gapic.trace_service_client - - -Contents --------- - -.. toctree:: - - self - starting - apis - changelog - - -Indices and tables ------------------- - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/docs/trace/starting.rst b/docs/trace/starting.rst deleted file mode 100644 index 0fbd7c108048..000000000000 --- a/docs/trace/starting.rst +++ /dev/null @@ -1,93 +0,0 @@ -Getting started -=============== - -google-cloud-trace will allow you to connect to the `Stackdriver Trace API`_ and access all its methods. In order to achieve this, you need to set up authentication as well as install the library locally. - -.. _`Stackdriver Trace API`: https://developers.google.com/apis-explorer/?hl=en_US#p/cloudtrace/v1/ - - -Installation ------------- - - -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. - -With `virtualenv`_, it's possible to install this library without needing system -install permissions, and without clashing with the installed system -dependencies. - -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ - - -Mac/Linux -~~~~~~~~~~ - -.. code-block:: console - - pip install virtualenv - virtualenv - source /bin/activate - /bin/pip install google-cloud-trace - -Windows -~~~~~~~ - -.. code-block:: console - - pip install virtualenv - virtualenv - \Scripts\activate - \Scripts\pip.exe install google-cloud-trace - - -Using the API -------------- - - -Authentication -~~~~~~~~~~~~~~ - -To authenticate all your API calls, first install and setup the `Google Cloud SDK`_. -Once done, you can then run the following command in your terminal: - -.. code-block:: console - - $ gcloud beta auth application-default login - -or - -.. code-block:: console - - $ gcloud auth login - -Please see `gcloud beta auth application-default login`_ document for the difference between these commands. - -.. _Google Cloud SDK: https://cloud.google.com/sdk/ -.. _gcloud beta auth application-default login: https://cloud.google.com/sdk/gcloud/reference/beta/auth/application-default/login -.. code-block:: console - -At this point you are all set to continue. - - -Examples -~~~~~~~~ - -.. code-block:: python - - from google.cloud.trace import client - - client = client.Client(project_id='your_project_id') - - # Patch traces, traces should be a dict - client.patch_traces(traces=traces) - - # Get trace - client.get_trace(trace_id='your_trace_id') - - # List traces - traces = client.list_traces() - - for trace in traces: - print(trace) diff --git a/trace/README.rst b/trace/README.rst index d1192be8db1d..7069b316d7b9 100644 --- a/trace/README.rst +++ b/trace/README.rst @@ -1,12 +1,21 @@ Python Client for Stackdriver Trace API (`Alpha`_) -================================================================================================== +================================================== -Idiomatic Python client for `Stackdriver Trace API`_ +|alpha| |pypi| |versions| + +The `Stackdriver Trace API`_ sends application trace data to Stackdriver Trace +for viewing. Trace data is collected for all App Engine applications by +default. Trace data from other applications can be provided using this API. - `Client Library Documentation`_ - `Product Documentation`_ .. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst +.. |alpha| image:: https://img.shields.io/badge/status-alpha-orange.svg +.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-trace.svg + :target: https://pypi.org/project/google-cloud-trace/ +.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-trace.svg + :target: https://pypi.org/project/google-cloud-trace/ .. _Stackdriver Trace API: https://cloud.google.com/trace .. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/trace/starting.html .. _Product Documentation: https://cloud.google.com/trace @@ -65,42 +74,26 @@ to `Python Development Environment Setup Guide`_ for Google Cloud Platform. .. _Python Development Environment Setup Guide: https://cloud.google.com/python/setup -Preview -~~~~~~~ - -TraceServiceClient -^^^^^^^^^^^^^^^^^^^^^^ +Example Usage +~~~~~~~~~~~~~ .. code-block:: python from google.cloud.gapic.trace.v1 import trace_service_client - from google.gax import CallOptions - from google.gax import INITIAL_PAGE client = trace_service_client.TraceServiceClient() - project_id = '' + project_id = 'your-project-123' # Iterate over all results for element in client.list_traces(project_id): # process element pass - # Or iterate over results one page at a time - options = CallOptions(page_token=INITIAL_PAGE) - for page in client.list_traces(project_id, options=options): - for element in page: - # process element - pass - Next Steps ~~~~~~~~~~ - Read the `Client Library Documentation`_ for Stackdriver Trace API - API to see other available methods on the client. -- Read the `Stackdriver Trace API Product documentation`_ to learn - more about the product and see How-to Guides. -- View this `repository’s main README`_ to see the full list of Cloud - APIs that we cover. - -.. _Stackdriver Trace API Product documentation: https://cloud.google.com/trace -.. _repository’s main README: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst + to see other available methods on the client. +- Read the `Product documentation`_ to learn more about the product and see + How-to Guides. + diff --git a/trace/docs/changelog.md b/trace/docs/changelog.md new file mode 120000 index 000000000000..04c99a55caae --- /dev/null +++ b/trace/docs/changelog.md @@ -0,0 +1 @@ +../CHANGELOG.md \ No newline at end of file diff --git a/trace/docs/index.rst b/trace/docs/index.rst index 83532c6a5257..99925354c6d1 100644 --- a/trace/docs/index.rst +++ b/trace/docs/index.rst @@ -1,102 +1,34 @@ -Python Client for Stackdriver Trace API (`Alpha`_) -================================================== +.. include:: /../trace/README.rst -`Stackdriver Trace API`_: Sends application trace data to Stackdriver Trace for viewing. Trace data is -collected for all App Engine applications by default. Trace data from other -applications can be provided using this API. -- `Client Library Documentation`_ -- `Product Documentation`_ - -.. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst -.. _Stackdriver Trace API: https://cloud.google.com/trace -.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/trace/usage.html -.. _Product Documentation: https://cloud.google.com/trace - -Quick Start ------------ - -In order to use this library, you first need to go through the following steps: - -1. `Select or create a Cloud Platform project.`_ -2. `Enable billing for your project.`_ -3. `Enable the Stackdriver Trace API.`_ -4. `Setup Authentication.`_ - -.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project -.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project -.. _Enable the Stackdriver Trace API.: https://cloud.google.com/trace -.. _Setup Authentication.: https://googlecloudplatform.github.io/google-cloud-python/latest/core/auth.html - -Installation -~~~~~~~~~~~~ - -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. - -With `virtualenv`_, it's possible to install this library without needing system -install permissions, and without clashing with the installed system -dependencies. - -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ - - -Mac/Linux -^^^^^^^^^ - -.. code-block:: console - - pip install virtualenv - virtualenv - source /bin/activate - /bin/pip install google-cloud-trace - - -Windows -^^^^^^^ - -.. code-block:: console - - pip install virtualenv - virtualenv - \Scripts\activate - \Scripts\pip.exe install google-cloud-trace - -Preview -~~~~~~~ +API Reference +------------- -TraceServiceClient -^^^^^^^^^^^^^^^^^^ +The current version of the API is ``v2``: -.. code:: py +.. toctree:: + :maxdepth: 2 - from google.cloud import trace_v2 + gapic/v2/api + gapic/v2/types - client = trace_v2.TraceServiceClient() +Support for the previous API release, ``v1``, is provided for code previously +written against it. In order to use this release, you will want to import from +e.g. ``google.cloud.trace_v1`` in lieu of ``google.cloud.trace_v2``. - name = client.project_path('[PROJECT]') - spans = [] +.. toctree:: + :maxdepth: 2 - client.batch_write_spans(name, spans) + gapic/v1/api + gapic/v1/types -Next Steps -~~~~~~~~~~ -- Read the `Client Library Documentation`_ for Stackdriver Trace API - API to see other available methods on the client. -- Read the `Stackdriver Trace API Product documentation`_ to learn - more about the product and see How-to Guides. -- View this `repository’s main README`_ to see the full list of Cloud - APIs that we cover. +Changelog +--------- -.. _Stackdriver Trace API Product documentation: https://cloud.google.com/trace -.. _repository’s main README: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst +For a list of all ``google-cloud-trace`` releases: -Api Reference -------------- .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - gapic/v2/api - gapic/v2/types + changelog diff --git a/trace/google/cloud/trace_v1/gapic/trace_service_client.py b/trace/google/cloud/trace_v1/gapic/trace_service_client.py index 14088633c570..c8743f70a2db 100644 --- a/trace/google/cloud/trace_v1/gapic/trace_service_client.py +++ b/trace/google/cloud/trace_v1/gapic/trace_service_client.py @@ -293,41 +293,25 @@ def list_traces(self, Multiple terms are ANDed. Syntax: * ``root:NAME_PREFIX`` or ``NAME_PREFIX``: Return traces where any root - :: - span starts with `NAME_PREFIX`. * ``+root:NAME`` or ``+NAME``: Return traces where any root span's name is - :: - exactly `NAME`. * ``span:NAME_PREFIX``: Return traces where any span starts with - :: - `NAME_PREFIX`. * ``+span:NAME``: Return traces where any span's name is exactly - :: - `NAME`. * ``latency:DURATION``: Return traces whose overall latency is - :: - greater or equal to than `DURATION`. Accepted units are nanoseconds (`ns`), milliseconds (`ms`), and seconds (`s`). Default is `ms`. For example, `latency:24ms` returns traces whose overall latency is greater than or equal to 24 milliseconds. * ``label:LABEL_KEY``: Return all traces containing the specified - :: - label key (exact match, case-sensitive) regardless of the key:value pair's value (including empty values). * ``LABEL_KEY:VALUE_PREFIX``: Return all traces containing the specified - :: - label key (exact match, case-sensitive) whose value starts with `VALUE_PREFIX`. Both a key and a value must be specified. * ``+LABEL_KEY:VALUE``: Return all traces containing a key:value pair - :: - exactly matching the specified text. Both a key and a value must be specified. * ``method:VALUE``: Equivalent to ``/http/method:VALUE``. @@ -338,8 +322,6 @@ def list_traces(self, * ``trace_id`` * ``name`` (``name`` field of root span in the trace) * ``duration`` (difference between ``end_time`` and ``start_time`` fields of - :: - the root span) * ``start`` (``start_time`` field of the root span)