Skip to content

Commit

Permalink
Bump SD exporter to 0.7.1 for release (#749)
Browse files Browse the repository at this point in the history
  • Loading branch information
c24t authored Aug 6, 2019
1 parent 8dd76d9 commit 7395e37
Show file tree
Hide file tree
Showing 34 changed files with 262 additions and 66 deletions.
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.7.1
Released 2019-08-05

- Added `set_status` to `span`
([#738](https://github.com/census-instrumentation/opencensus-python/pull/738))
- Update released stackdriver exporter version

## 0.7.0
Released 2019-07-31

Expand Down
5 changes: 3 additions & 2 deletions contrib/opencensus-ext-django/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
## 0.7.0
Released 2019-07-31

- Updated span attributes to include some missing attributes listed [here](https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/HTTP.md#attributes)
([#735](https://github.com/census-instrumentation/opencensus-python/pull/735))
- Updated span attributes to include some missing attributes listed
[here](https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/HTTP.md#attributes)
([#735](https://github.com/census-instrumentation/opencensus-python/pull/735))

## 0.3.2
Released 2019-07-26
Expand Down
10 changes: 8 additions & 2 deletions contrib/opencensus-ext-flask/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

## Unreleased

## 0.7.1
Released 2019-08-05

- Update for core library changes

## 0.7.0
Released 2019-07-31

- Make ProbabilitySampler default
- Updated span attributes to include some missing attributes listed [here](https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/HTTP.md#attributes)
([#735](https://github.com/census-instrumentation/opencensus-python/pull/735))
- Updated span attributes to include some missing attributes listed
[here](https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/HTTP.md#attributes)
([#735](https://github.com/census-instrumentation/opencensus-python/pull/735))

## 0.3.0
Released 2019-04-24
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.7.0, < 1.0.0',
'opencensus >= 0.7.1, < 1.0.0',
],
extras_require={},
license='Apache-2.0',
Expand Down
12 changes: 8 additions & 4 deletions contrib/opencensus-ext-flask/tests/test_flask_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,10 @@ def test_teardown_include_exception(self):
exported_spandata = mock_exporter.export.call_args[0][0][0]
self.assertIsInstance(exported_spandata, span_data.SpanData)
self.assertIsInstance(exported_spandata.status, status.Status)
self.assertEqual(exported_spandata.status.code, code_pb2.UNKNOWN)
self.assertEqual(exported_spandata.status.message, 'error')
self.assertEqual(
exported_spandata.status.canonical_code, code_pb2.UNKNOWN
)
self.assertEqual(exported_spandata.status.description, 'error')

def test_teardown_include_exception_and_traceback(self):
mock_exporter = mock.MagicMock()
Expand All @@ -331,8 +333,10 @@ def test_teardown_include_exception_and_traceback(self):
exported_spandata = mock_exporter.export.call_args[0][0][0]
self.assertIsInstance(exported_spandata, span_data.SpanData)
self.assertIsInstance(exported_spandata.status, status.Status)
self.assertEqual(exported_spandata.status.code, code_pb2.UNKNOWN)
self.assertEqual(exported_spandata.status.message, 'error')
self.assertEqual(
exported_spandata.status.canonical_code, code_pb2.UNKNOWN
)
self.assertEqual(exported_spandata.status.description, 'error')
self.assertIsInstance(
exported_spandata.stack_trace, stack_trace.StackTrace
)
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.7.0'
__version__ = '0.7.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.7.1
Released 2019-08-05

- Update for core library changes

## 0.3.0
Released 2019-05-31

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.7.0, < 1.0.0',
'opencensus >= 0.7.1, < 1.0.0',
],
extras_require={},
license='Apache-2.0',
Expand Down
6 changes: 4 additions & 2 deletions contrib/opencensus-ext-grpc/tests/test_server_interceptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ def test_intercept_handler_exception(self):

# check that the status obj is attached to the current span
self.assertIsNotNone(current_span.status)
self.assertEqual(current_span.status.code, code_pb2.UNKNOWN)
self.assertEqual(current_span.status.message, 'Test')
self.assertEqual(
current_span.status.canonical_code, code_pb2.UNKNOWN
)
self.assertEqual(current_span.status.description, 'Test')

@mock.patch(
'opencensus.trace.execution_context.get_opencensus_tracer')
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.3.0'
__version__ = '0.7.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.7.1
Released 2019-08-05

- Update for core library changes

## 0.2.2
Released 2019-05-31

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ def translate_to_jaeger(self, span_datas):
tags.append(jaeger.Tag(
key='status.code',
vType=jaeger.TagType.LONG,
vLong=status.code))
vLong=status.canonical_code))

tags.append(jaeger.Tag(
key='status.message',
vType=jaeger.TagType.STRING,
vStr=status.message))
vStr=status.description))

refs = _extract_refs_from_span(span)
logs = _extract_logs_from_span(span)
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.7.0, < 1.0.0',
'opencensus >= 0.7.1, < 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.2'
__version__ = '0.7.1'
11 changes: 8 additions & 3 deletions contrib/opencensus-ext-ocagent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

## Unreleased

## 0.7.1
Released 2019-08-05

- Update for core library changes

## 0.4.0
Released 2019-05-31

- Remove well_known_types.Error and well_known_types.ParseError.
Note this could be a breaking change if you depend on an older
version of protobuf and use ParseError.
- Remove well_known_types.Error and well_known_types.ParseError. Note this
could be a breaking change if you depend on an older version of protobuf and
use ParseError.

## 0.3.0
Released 2019-04-24
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ def translate_to_trace_proto(span_data):
span_data.start_time),
end_time=ocagent_utils.proto_ts_from_datetime_str(span_data.end_time),
status=trace_pb2.Status(
code=span_data.status.code,
message=span_data.status.message)
code=span_data.status.canonical_code,
message=span_data.status.description,
)
if span_data.status is not None else None,
same_process_as_parent_span=BoolValue(
value=span_data.same_process_as_parent_span)
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.7.0, < 1.0.0',
'opencensus >= 0.7.1, < 1.0.0',
'opencensus-proto >= 0.1.0, < 1.0.0',
],
extras_require={},
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.4.0'
__version__ = '0.7.1'
8 changes: 8 additions & 0 deletions contrib/opencensus-ext-pymongo/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Unreleased

## 0.7.1
Released 2019-08-05

- Changed attributes names to make it compatible with
[OpenTelemetry](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-semantic-conventions.md),
maintaining OpenCensus specs fidelity
([#738](https://github.com/census-instrumentation/opencensus-python/pull/738))

## 0.1.3
Released 2019-05-31

Expand Down
45 changes: 32 additions & 13 deletions contrib/opencensus-ext-pymongo/opencensus/ext/pymongo/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@

from pymongo import monitoring

from google.rpc import code_pb2

from opencensus.trace import execution_context
from opencensus.trace import span as span_module
from opencensus.trace import status as status_module


log = logging.getLogger(__name__)
Expand All @@ -34,7 +37,6 @@ def trace_integration(tracer=None):


class MongoCommandListener(monitoring.CommandListener):

def __init__(self, tracer=None):
self._tracer = tracer

Expand All @@ -44,30 +46,47 @@ def tracer(self):

def started(self, event):
span = self.tracer.start_span(
name='{}.{}.{}.{}'.format(MODULE_NAME,
event.database_name,
event.command.get(event.command_name),
event.command_name))
name='{}.{}.{}.{}'.format(
MODULE_NAME,
event.database_name,
event.command.get(event.command_name),
event.command_name,
)
)
span.span_kind = span_module.SpanKind.CLIENT

self.tracer.add_attribute_to_current_span('component', 'mongodb')
self.tracer.add_attribute_to_current_span('db.type', 'mongodb')
self.tracer.add_attribute_to_current_span(
'db.instance', event.database_name
)
self.tracer.add_attribute_to_current_span(
'db.statement', event.command.get(event.command_name)
)

for attr in COMMAND_ATTRIBUTES:
_attr = event.command.get(attr)
if _attr is not None:
self.tracer.add_attribute_to_current_span(attr, str(_attr))

self.tracer.add_attribute_to_current_span(
'request_id', event.request_id)
'request_id', event.request_id
)

self.tracer.add_attribute_to_current_span(
'connection_id', str(event.connection_id))
'connection_id', str(event.connection_id)
)

def succeeded(self, event):
self._stop('succeeded')
self._stop(code_pb2.OK)

def failed(self, event):
self._stop('failed')

def _stop(self, status):
self.tracer.add_attribute_to_current_span('status', status)

self._stop(code_pb2.UNKNOWN, 'MongoDB error', event.failure)

def _stop(self, code, message='', details=None):
span = self.tracer.current_span()
status = status_module.Status(
code=code, message=message, details=details
)
span.set_status(status)
self.tracer.end_span()
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-pymongo/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.7.0, < 1.0.0',
'opencensus >= 0.7.1, < 1.0.0',
'pymongo >= 3.1.0',
],
extras_require={},
Expand Down
Loading

0 comments on commit 7395e37

Please sign in to comment.