Skip to content

Commit

Permalink
Prepare for 0.4.0 release (#604)
Browse files Browse the repository at this point in the history
Release opencensus-0.4.0 and multiple new versions of ext packages. This
release includes breaking changes related to the context API and stats/metrics
exporters. It also adds a dependency on the new opencensus-context package.
  • Loading branch information
c24t authored Apr 9, 2019
1 parent 1da32f6 commit 11d1527
Show file tree
Hide file tree
Showing 81 changed files with 307 additions and 187 deletions.
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
branch = True
omit =
# Test cases
context/*/tests/*
contrib/*/tests/*
# Auto generated files
contrib/opencensus-ext-jaeger/opencensus/ext/jaeger/trace_exporter/gen/*
Expand All @@ -19,6 +20,8 @@ exclude_lines =
# Ignore debug-only repr
def __repr__
omit =
# Test cases
context/*/tests/*
# Side-effect introduced by namespace packages
contrib/*/opencensus/__init__.py
contrib/*/opencensus/ext/__init__.py
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Unreleased

## 0.4.0
Released 2019-04-08

- Multiple bugfixes
- Use separate context package instead of threadlocals for execution context
([#573](https://github.com/census-instrumentation/opencensus-python/pull/573))

## 0.3.0
Released 2019-03-11

Expand Down
5 changes: 3 additions & 2 deletions context/opencensus-context/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

## Unreleased
## 0.1.0
Released 2019-04-08

- Add this changelog.
- Initial version
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

try:
import contextvars
except ImportError:
contextvars = None

import threading

__all__ = ['RuntimeContext']
Expand Down Expand Up @@ -132,7 +137,6 @@ class _AsyncRuntimeContext(_RuntimeContext):

class Slot(object):
def __init__(self, name, default):
import contextvars
self.name = name
self.contextvar = contextvars.ContextVar(name)
self.default = default if callable(default) else (lambda: default)
Expand Down Expand Up @@ -169,6 +173,5 @@ def register_slot(cls, name, default=None):


RuntimeContext = _ThreadLocalRuntimeContext()

if sys.version_info >= (3, 7):
if contextvars:
RuntimeContext = _AsyncRuntimeContext()
7 changes: 5 additions & 2 deletions context/opencensus-context/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@
description='OpenCensus Runtime Context',
include_package_data=True,
long_description=open('README.rst').read(),
install_requires=[],
install_requires=[
# contextvars backport for Python 3.6
'contextvars ; python_version >= "3.6" and python_version < "3.7"',
],
extras_require={},
license='Apache-2.0',
packages=find_packages(exclude=('examples', 'tests',)),
namespace_packages=[],
url='https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-context', # noqa: E501
url='https://github.com/census-instrumentation/opencensus-python/tree/master/context/opencensus-context', # noqa: E501
zip_safe=False,
)
36 changes: 36 additions & 0 deletions context/opencensus-context/tests/test_runtime_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,39 @@ def test_register_duplicate(self):
RuntimeContext.register_slot('dup'),
RuntimeContext.register_slot('dup'),
])

def test_get_non_existing(self):
self.assertRaises(AttributeError, lambda: RuntimeContext.non_existing)

def test_set_non_existing(self):
def set_non_existing():
RuntimeContext.non_existing = 1

self.assertRaises(AttributeError, set_non_existing)

def test_clear(self):
RuntimeContext.register_slot('baz')
RuntimeContext.baz = 123
self.assertEqual(RuntimeContext.baz, 123)
RuntimeContext.clear()
self.assertEqual(RuntimeContext.baz, None)

def test_with_current_context(self):
from threading import Thread

RuntimeContext.register_slot('operation_id')

def work(name):
self.assertEqual(RuntimeContext.operation_id, 'foo')
RuntimeContext.operation_id = name
self.assertEqual(RuntimeContext.operation_id, name)

RuntimeContext.operation_id = 'foo'
thread = Thread(
target=RuntimeContext.with_current_context(work),
args=('bar'),
)
thread.start()
thread.join()

self.assertEqual(RuntimeContext.operation_id, 'foo')
2 changes: 1 addition & 1 deletion context/opencensus-context/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.1.dev0'
__version__ = '0.1.0'
2 changes: 1 addition & 1 deletion contrib/opencensus-correlation/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.2.dev0'
__version__ = '0.1.0'
5 changes: 5 additions & 0 deletions contrib/opencensus-ext-dbapi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## 0.1.1
Released 2019-04-08

- Cosmetic changes

## 0.1.0
Released 2019-03-19

Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-dbapi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
include_package_data=True,
long_description=open('README.rst').read(),
install_requires=[
'opencensus >= 0.4.dev0, < 1.0.0',
'opencensus >= 0.3.0, < 1.0.0',
],
extras_require={},
license='Apache-2.0',
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-dbapi/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.2.dev0'
__version__ = '0.1.1'
5 changes: 5 additions & 0 deletions contrib/opencensus-ext-django/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## 0.2.0
Released 2019-04-08

- Update for package changes in core library

## 0.1.0
Released 2019-03-19

Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-django/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
long_description=open('README.rst').read(),
install_requires=[
'Django >= 1.11.0, <= 1.11.20',
'opencensus >= 0.4.dev0, < 1.0.0',
'opencensus >= 0.4.0, < 1.0.0',
],
extras_require={},
license='Apache-2.0',
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-django/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.2.dev0'
__version__ = '0.2.0'
5 changes: 5 additions & 0 deletions contrib/opencensus-ext-flask/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## 0.2.0
Released 2019-04-08

- Update for package changes in core library

## 0.1.0
Released 2019-03-19

Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-flask/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
long_description=open('README.rst').read(),
install_requires=[
'flask >= 0.12.3, < 2.0.0',
'opencensus >= 0.4.dev0, < 1.0.0',
'opencensus >= 0.4.0, < 1.0.0',
],
extras_require={},
license='Apache-2.0',
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-flask/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.2.dev0'
__version__ = '0.2.0'
5 changes: 5 additions & 0 deletions contrib/opencensus-ext-google-cloud-clientlibs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## 0.1.1
Released 2019-04-08

- Cosmetic changes

## 0.1.0
Released 2019-03-19

Expand Down
6 changes: 3 additions & 3 deletions contrib/opencensus-ext-google-cloud-clientlibs/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
include_package_data=True,
long_description=open('README.rst').read(),
install_requires=[
'opencensus >= 0.4.dev0, < 1.0.0',
'opencensus-ext-grpc >= 0.2.dev0, < 1.0.0',
'opencensus-ext-requests >= 0.2.dev0, < 1.0.0',
'opencensus >= 0.3.0, < 1.0.0',
'opencensus-ext-grpc >= 0.1.0, < 1.0.0',
'opencensus-ext-requests >= 0.1.0, < 1.0.0',
],
extras_require={},
license='Apache-2.0',
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-google-cloud-clientlibs/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.2.dev0'
__version__ = '0.1.1'
5 changes: 5 additions & 0 deletions contrib/opencensus-ext-grpc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## 0.1.1
Released 2019-04-08

- Cosmetic changes

## 0.1.0
Released 2019-03-19

Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-grpc/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
long_description=open('README.rst').read(),
install_requires=[
'grpcio >= 1.0.0, < 2.0.0',
'opencensus >= 0.4.dev0, < 1.0.0',
'opencensus >= 0.3.0, < 1.0.0',
],
extras_require={},
license='Apache-2.0',
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-grpc/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.2.dev0'
__version__ = '0.1.1'
5 changes: 5 additions & 0 deletions contrib/opencensus-ext-httplib/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## 0.1.1
Released 2019-04-08

- Cosmetic changes

## 0.1.0
Released 2019-03-19

Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-httplib/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
include_package_data=True,
long_description=open('README.rst').read(),
install_requires=[
'opencensus >= 0.4.dev0, < 1.0.0',
'opencensus >= 0.3.0, < 1.0.0',
],
extras_require={},
license='Apache-2.0',
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-httplib/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.2.dev0'
__version__ = '0.1.1'
5 changes: 5 additions & 0 deletions contrib/opencensus-ext-jaeger/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## 0.2.0
Released 2019-04-08

- Update for package changes in core library

## 0.1.0
Released 2019-03-19

Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-jaeger/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
include_package_data=True,
long_description=open('README.rst').read(),
install_requires=[
'opencensus >= 0.4.dev0, < 1.0.0',
'opencensus >= 0.4.0, < 1.0.0',
'thrift >= 0.10.0',
],
extras_require={},
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-jaeger/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.2.dev0'
__version__ = '0.2.0'
5 changes: 5 additions & 0 deletions contrib/opencensus-ext-mysql/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## 0.1.1
Released 2019-04-08

- Cosmetic changes

## 0.1.0
Released 2019-03-19

Expand Down
4 changes: 2 additions & 2 deletions contrib/opencensus-ext-mysql/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
long_description=open('README.rst').read(),
install_requires=[
'mysql-connector >= 2.1.6, < 3.0.0',
'opencensus >= 0.4.dev0, < 1.0.0',
'opencensus-ext-dbapi >= 0.2.dev0, < 1.0.0',
'opencensus >= 0.3.0, < 1.0.0',
'opencensus-ext-dbapi >= 0.1.0, < 1.0.0',
],
extras_require={},
license='Apache-2.0',
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-mysql/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.2.dev0'
__version__ = '0.1.1'
7 changes: 7 additions & 0 deletions contrib/opencensus-ext-ocagent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Unreleased

## 0.2.0
Released 2019-04-08

- Update for package changes in core library
- Update generated protos
- Fix UTC timestamp reporting bug

## 0.1.0
Released 2019-03-19

Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-ocagent/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
long_description=open('README.rst').read(),
install_requires=[
'grpcio >= 1.0.0, < 2.0.0',
'opencensus >= 0.4.dev0, < 1.0.0',
'opencensus >= 0.4.0, < 1.0.0',
],
extras_require={},
license='Apache-2.0',
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-ocagent/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.2.dev0'
__version__ = '0.2.0'
Loading

0 comments on commit 11d1527

Please sign in to comment.