Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
command: |
if [ -n "$GOOGLE_APPLICATION_CREDENTIALS" ]; then
openssl aes-256-cbc -d -a -k "$GOOGLE_CREDENTIALS_PASSPHRASE" \
-in trace/tests/system/credentials.json.enc \
-out trace/$GOOGLE_APPLICATION_CREDENTIALS
-in tests/system/trace/credentials.json.enc \
-out $GOOGLE_APPLICATION_CREDENTIALS
else
echo "No credentials. System tests will not run."
fi
- run:
name: Run tests - opencensus.trace
name: Run tests - opencensus
command: |
nox -f trace/nox.py
nox -f nox.py
File renamed without changes.
20 changes: 10 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ Installation & basic usage

1. Install the opencensus-trace package using `pip`_ or `pipenv`_:

::
::

pip install opencensus-trace
pipenv install opencensus-trace
pip install opencensus-trace
pipenv install opencensus-trace

2. Initialize a tracer for application:

.. code:: python
.. code:: python

from opencensus.trace import request_tracer
from opencensus.trace import request_tracer

tracer = request_tracer.RequestTracer()
tracer = request_tracer.RequestTracer()

.. _pip: https://pip.pypa.io
.. _pipenv: https://docs.pipenv.org/
.. _pip: https://pip.pypa.io
.. _pipenv: https://docs.pipenv.org/

Usage
-----
Expand Down Expand Up @@ -306,10 +306,10 @@ to ``trace_integrations`` using ``'postgresql'``.
SQLAlchemy
~~~~~~~~~~

You can trace usage of `SQLAlchemy`_, regardless of the underlying database, by
You can trace usage of `sqlalchemy package`_, regardless of the underlying database, by
specifying ``'sqlalchemy'`` to ``trace_integrations``.

.. _SQLAlchemy: https://pypi.org/project/SQLAlchemy
.. _SQLAlchemy package: https://pypi.org/project/SQLAlchemy

.. note:: If you enable tracing of SQLAlchemy and the underlying database
driver, you will get duplicate spans. Instead, just trace SQLAlchemy.
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
setuptools >= 36.4.0
sphinx >= 1.6.3

trace/
.
20 changes: 10 additions & 10 deletions docs/trace/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ Installation & basic usage

1. Install the opencensus-trace package using `pip`_ or `pipenv`_:

::
::

pip install opencensus-trace
pipenv install opencensus-trace
pip install opencensus-trace
pipenv install opencensus-trace

2. Initialize a tracer for application:

.. code:: python
.. code:: python

from opencensus.trace import request_tracer
from opencensus.trace import request_tracer

tracer = request_tracer.RequestTracer()
tracer = request_tracer.RequestTracer()

.. _pip: https://pip.pypa.io
.. _pipenv: https://docs.pipenv.org/
.. _pip: https://pip.pypa.io
.. _pipenv: https://docs.pipenv.org/

Usage
-----
Expand Down Expand Up @@ -306,10 +306,10 @@ to ``trace_integrations`` using ``'postgresql'``.
SQLAlchemy
~~~~~~~~~~

You can trace usage of `SQLAlchemy`_, regardless of the underlying database, by
You can trace usage of `sqlalchemy package`_, regardless of the underlying database, by
specifying ``'sqlalchemy'`` to ``trace_integrations``.

.. _SQLAlchemy: https://pypi.org/project/SQLAlchemy
.. _SQLAlchemy package: https://pypi.org/project/SQLAlchemy

.. note:: If you enable tracing of SQLAlchemy and the underlying database
driver, you will get duplicate spans. Instead, just trace SQLAlchemy.
Expand Down
93 changes: 92 additions & 1 deletion nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,99 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
from __future__ import absolute_import

import nox
import os


@nox.session
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
def unit(session, py):
"""Run the unit test suite."""

# Run unit tests against all supported versions of Python.
session.interpreter = 'python{}'.format(py)

# Install all test dependencies, then install this package in-place.
session.install('-r', 'requirements-test.txt')

session.install('-e', '.')

# Run py.test against the unit tests.
session.run(
'py.test',
'--quiet',
'--cov=opencensus.trace',
'--cov-append',
'--cov-config=.coveragerc',
'--cov-report=',
'--cov-fail-under=97',
'tests/unit/',
*session.posargs
)


@nox.session
@nox.parametrize('py', ['2.7', '3.6'])
def system(session, py):
"""Run the system test suite."""

# Sanity check: Only run system tests if the environment variable is set.
if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
session.skip('Credentials must be set via environment variable.')

# Run the system tests against latest Python 2 and Python 3 only.
session.interpreter = 'python{}'.format(py)

# Set the virtualenv dirname.
session.virtualenv_dirname = 'sys-' + py

# Install all test dependencies, then install this package into the
# virutalenv's dist-packages.
session.install('-r', 'requirements-test.txt')
session.install('.')

# Run py.test against the system tests.
session.run(
'py.test',
'-s',
'tests/system/',
*session.posargs
)


@nox.session
def lint(session):
"""Run flake8.
Returns a failure if flake8 finds linting errors or sufficiently
serious code quality issues.
"""
session.interpreter = 'python3.6'
session.install('flake8')
session.install('.')
session.run('flake8', 'opencensus/trace')


@nox.session
def lint_setup_py(session):
"""Verify that setup.py is valid (including RST check)."""
session.interpreter = 'python3.6'
session.install('docutils', 'pygments')
session.run(
'python', 'setup.py', 'check', '--restructuredtext', '--strict')


@nox.session
def cover(session):
"""Run the final coverage report.
This outputs the coverage report aggregating coverage from the unit
test runs (not system test runs), and then erases coverage data.
"""
session.interpreter = 'python3.6'
session.install('coverage', 'pytest-cov')
session.run('coverage', 'report', '--show-missing', '--fail-under=100')
session.run('coverage', 'erase')


@nox.session
Expand All @@ -34,3 +124,4 @@ def docs(session):
# Build the docs!
session.run(
'bash', os.path.join('.', 'scripts', 'update_docs.sh'))

File renamed without changes.
File renamed without changes.
15 changes: 9 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@

"""A setup module for Open Source Census Instrumentation Library"""

import io
from setuptools import setup, find_packages

install_requires = []
install_requires = [
'google-cloud-trace>=0.16.0, <0.17dev',
]

setup(
name='opencensus',
version='0.0.1',
author='OpenCensus Contributors',
author_email='opencensus-io@googlegroups.com',
version='0.1.0',
author='OpenCensus Authors',
author_email='census-developers@googlegroups.com',
classifiers=[
'Intended Audience :: Developers',
'Development Status :: 2 - Pre-Alpha',
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
Expand All @@ -34,7 +37,7 @@
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: 3.6',
],
description='A stats collection and distributed tracing framework',
include_package_data=True,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def generate_header():

def run_application():
"""Start running the django application."""
cmd = 'python tests/system/django/manage.py runserver {}'.format(HOST_PORT)
cmd = 'python tests/system/trace/django/manage.py runserver {}'.format(HOST_PORT)
process = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def generate_header():

def run_application():
"""Start running the flask application."""
cmd = 'python tests/system/flask/main.py'
cmd = 'python tests/system/trace/flask/main.py'
process = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
Expand Down
12 changes: 0 additions & 12 deletions trace/README.rst

This file was deleted.

108 changes: 0 additions & 108 deletions trace/nox.py

This file was deleted.

2 changes: 0 additions & 2 deletions trace/setup.cfg

This file was deleted.

Loading