Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main 4 #2236

Merged
merged 9 commits into from
Oct 25, 2021
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
# Otherwise, set variable to the commit of your branch on
# opentelemetry-python-contrib which is compatible with these Core repo
# changes.
CONTRIB_REPO_SHA: c2e674983a265e54c5eb14e376459a992498aae6
CONTRIB_REPO_SHA: a7c054b257225948c68a9dccb3f2973537d9b4ec
# This is needed because we do not clone the core repo in contrib builds anymore.
# When running contrib builds as part of core builds, we use actions/checkout@v2 which
# does not set an environment variable (simply just runs tox), which is different when
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.6.0-0.25b0...HEAD)
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.6.1-0.25b1...HEAD)

## [1.6.2-0.25b2](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.6.2-0.25b2) - 2021-10-19

## [1.6.1-0.25b1](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.6.1-0.25b1) - 2021-10-18

- Fix ReadableSpan property types attempting to create a mapping from a list
([#2215](https://github.com/open-telemetry/opentelemetry-python/pull/2215))
- Upgrade GRPC/protobuf related dependency and regenerate otlp protobufs
([#2201](https://github.com/open-telemetry/opentelemetry-python/pull/2201))
- Propagation: only warn about oversized baggage headers when headers exist
Expand All @@ -16,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#2153](https://github.com/open-telemetry/opentelemetry-python/pull/2153))
- Add metrics API
([#1887](https://github.com/open-telemetry/opentelemetry-python/pull/1887))
- Fix parental trace relationship for opentracing `follows_from` reference
([#2180](https://github.com/open-telemetry/opentelemetry-python/pull/2180))

## [1.6.0-0.25b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.6.0-0.25b0) - 2021-10-13

Expand All @@ -31,6 +39,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#2071](https://github.com/open-telemetry/opentelemetry-python/pull/2071))
- Add entry point for exporters with default protocol
([#2093](https://github.com/open-telemetry/opentelemetry-python/pull/2093))
- Renamed entrypoints `otlp_proto_http_span`, `otlp_proto_grpc_span`, `console_span` to remove
redundant `_span` suffix.
([#2093](https://github.com/open-telemetry/opentelemetry-python/pull/2093))
- Do not skip sequence attribute on decode error
([#2097](https://github.com/open-telemetry/opentelemetry-python/pull/2097))
- `opentelemetry-test`: Add `HttpTestBase` to allow tests with actual TCP sockets
Expand All @@ -52,6 +63,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add name to `BatchSpanProcessor` worker thread
([#2186](https://github.com/open-telemetry/opentelemetry-python/pull/2186))


## [1.5.0-0.24b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.5.0-0.24b0) - 2021-08-26


Expand Down
4 changes: 2 additions & 2 deletions eachdist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sortfirst=
exporter/*

[stable]
version=1.6.0
version=1.6.2

packages=
opentelemetry-sdk
Expand All @@ -30,7 +30,7 @@ packages=
opentelemetry-api

[prerelease]
version=0.25b0
version=0.25b2

packages=
opentelemetry-opentracing-shim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "1.6.0"
__version__ = "1.6.2"
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "1.6.0"
__version__ = "1.6.2"
4 changes: 2 additions & 2 deletions exporter/opentelemetry-exporter-jaeger/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ python_requires = >=3.6

packages=find_namespace:
install_requires =
opentelemetry-exporter-jaeger-proto-grpc == 1.6.0
opentelemetry-exporter-jaeger-thrift == 1.6.0
opentelemetry-exporter-jaeger-proto-grpc == 1.6.2
opentelemetry-exporter-jaeger-thrift == 1.6.2

[options.extras_require]
test =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "1.6.0"
__version__ = "1.6.2"
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.25b0"
__version__ = "0.25b2"
2 changes: 1 addition & 1 deletion exporter/opentelemetry-exporter-otlp-proto-grpc/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ install_requires =
googleapis-common-protos ~= 1.52
opentelemetry-api ~= 1.3
opentelemetry-sdk ~= 1.3
opentelemetry-proto == 1.6.0
opentelemetry-proto == 1.6.2
backoff ~= 1.10.0

[options.extras_require]
Expand Down
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__ = "1.6.0"
__version__ = "1.6.2"
2 changes: 1 addition & 1 deletion exporter/opentelemetry-exporter-otlp-proto-http/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ install_requires =
googleapis-common-protos ~= 1.52
opentelemetry-api ~= 1.3
opentelemetry-sdk ~= 1.3
opentelemetry-proto == 1.6.0
opentelemetry-proto == 1.6.2
backoff ~= 1.10.0

[options.extras_require]
Expand Down
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__ = "1.6.0"
__version__ = "1.6.2"
4 changes: 2 additions & 2 deletions exporter/opentelemetry-exporter-otlp/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ classifiers =
python_requires = >=3.6
packages=find_namespace:
install_requires =
opentelemetry-exporter-otlp-proto-grpc == 1.6.0
opentelemetry-exporter-otlp-proto-http == 1.6.0
opentelemetry-exporter-otlp-proto-grpc == 1.6.2
opentelemetry-exporter-otlp-proto-http == 1.6.2

[options.entry_points]
opentelemetry_traces_exporter =
Expand Down
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__ = "1.6.0"
__version__ = "1.6.2"
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__ = "1.6.0"
__version__ = "1.6.2"
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ install_requires =
requests ~= 2.7
opentelemetry-api ~= 1.3
opentelemetry-sdk ~= 1.3
opentelemetry-exporter-zipkin-json == 1.6.0
opentelemetry-exporter-zipkin-json == 1.6.2

[options.packages.find]
where = src
Expand Down
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__ = "1.6.0"
__version__ = "1.6.2"
4 changes: 2 additions & 2 deletions exporter/opentelemetry-exporter-zipkin/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ classifiers =
python_requires = >=3.6
packages=find_namespace:
install_requires =
opentelemetry-exporter-zipkin-json == 1.6.0
opentelemetry-exporter-zipkin-proto-http == 1.6.0
opentelemetry-exporter-zipkin-json == 1.6.2
opentelemetry-exporter-zipkin-proto-http == 1.6.2

[options.extras_require]
test =
Expand Down
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__ = "1.6.0"
__version__ = "1.6.2"
2 changes: 1 addition & 1 deletion opentelemetry-api/src/opentelemetry/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__ = "1.6.0"
__version__ = "1.6.2"
5 changes: 5 additions & 0 deletions opentelemetry-proto/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ OpenTelemetry Python Proto
.. |pypi| image:: https://badge.fury.io/py/opentelemetry-proto.svg
:target: https://pypi.org/project/opentelemetry-proto/

This library contains the generated code for OpenTelemetry protobuf data model. The code in the current
package was generated using the v0.9.0 release_ of opentelemetry-proto.

.. _release: https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v0.9.0

Installation
------------

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-proto/src/opentelemetry/proto/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__ = "1.6.0"
__version__ = "1.6.2"
4 changes: 2 additions & 2 deletions opentelemetry-sdk/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ packages=find_namespace:
zip_safe = False
include_package_data = True
install_requires =
opentelemetry-api == 1.6.0
opentelemetry-semantic-conventions == 0.25b0
opentelemetry-api == 1.6.2
opentelemetry-semantic-conventions == 0.25b2

[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from opentelemetry.sdk.trace.id_generator import IdGenerator

_EXPORTER_OTLP = "otlp"
_EXPORTER_OTLP_SPAN = "otlp_proto_grpc_span"
_EXPORTER_OTLP_SPAN = "otlp_proto_grpc"

_RANDOM_ID_GENERATOR = "random"
_DEFAULT_ID_GENERATOR = _RANDOM_ID_GENERATOR
Expand Down
6 changes: 3 additions & 3 deletions opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def __init__(
parent: Optional[trace_api.SpanContext] = None,
resource: Resource = Resource.create({}),
attributes: types.Attributes = None,
events: Sequence[Event] = None,
events: Sequence[Event] = (),
links: Sequence[trace_api.Link] = (),
kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL,
instrumentation_info: InstrumentationInfo = None,
Expand Down Expand Up @@ -426,11 +426,11 @@ def attributes(self) -> types.Attributes:

@property
def events(self) -> Sequence[Event]:
return MappingProxyType(self._events)
return tuple(event for event in self._events)

@property
def links(self) -> Sequence[trace_api.Link]:
return MappingProxyType(self._links)
return tuple(link for link in self._links)

@property
def resource(self) -> Resource:
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/opentelemetry/sdk/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__ = "1.6.0"
__version__ = "1.6.2"
23 changes: 23 additions & 0 deletions opentelemetry-sdk/tests/trace/test_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,29 @@ def test_surplus_span_attributes(self):
self.assertEqual(len(root.attributes), max_attrs)


class TestReadableSpan(unittest.TestCase):
def test_links(self):
span = trace.ReadableSpan()
self.assertEqual(span.links, ())

span = trace.ReadableSpan(
links=[trace_api.Link(context=trace_api.INVALID_SPAN_CONTEXT)] * 2,
)
self.assertEqual(len(span.links), 2)
for link in span.links:
self.assertFalse(link.context.is_valid)

def test_events(self):
span = trace.ReadableSpan()
self.assertEqual(span.events, ())
events = [
trace.Event("foo1", {"bar1": "baz1"}),
trace.Event("foo2", {"bar2": "baz2"}),
]
span = trace.ReadableSpan(events=events)
self.assertEqual(span.events, tuple(events))


class TestSpan(unittest.TestCase):
# pylint: disable=too-many-public-methods

Expand Down
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.25b0"
__version__ = "0.25b2"
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__ = "1.6.0"
__version__ = "1.6.2"
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__ = "1.6.0"
__version__ = "1.6.2"
2 changes: 2 additions & 0 deletions scripts/proto_codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ python -m grpc_tools.protoc \
--mypy_out=. \
--grpc_python_out=. \
$service_protos

echo "Please update ./opentelemetry-proto/README.rst to include the updated version."
2 changes: 1 addition & 1 deletion shim/opentelemetry-opentracing-shim/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ install_requires =

[options.extras_require]
test =
opentelemetry-test == 0.25b0
opentelemetry-test == 0.25b2
opentracing ~= 2.2.0

[options.packages.find]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,10 @@ def start_active_span(

current_span = get_current_span()

if child_of is None and current_span is not INVALID_SPAN_CONTEXT:
if (
child_of is None
and current_span.get_span_context() is not INVALID_SPAN_CONTEXT
):
child_of = SpanShim(None, None, current_span)

span = self.start_span(
Expand Down Expand Up @@ -649,12 +652,16 @@ def start_span(
if isinstance(parent, OtelSpanContext):
parent = NonRecordingSpan(parent)

parent_span_context = set_span_in_context(parent)

links = []
valid_links = []
if references:
for ref in references:
links.append(Link(ref.referenced_context.unwrap()))
if ref.referenced_context.unwrap() is not INVALID_SPAN_CONTEXT:
valid_links.append(Link(ref.referenced_context.unwrap()))

if valid_links and parent is None:
parent = NonRecordingSpan(valid_links[0].context)

parent_span_context = set_span_in_context(parent)

# The OpenTracing API expects time values to be `float` values which
# represent the number of seconds since the epoch. OpenTelemetry
Expand All @@ -666,7 +673,7 @@ def start_span(
span = self._otel_tracer.start_span(
operation_name,
context=parent_span_context,
links=links,
links=valid_links,
attributes=tags,
start_time=start_time_ns,
)
Expand Down
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.25b0"
__version__ = "0.25b2"
18 changes: 18 additions & 0 deletions shim/opentelemetry-opentracing-shim/tests/test_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,24 @@ def test_references(self):
parent.context.unwrap(),
)

def test_follows_from_references(self):
"""Test span creation using the `references` argument with a follows from relationship."""

with self.shim.start_span("ParentSpan") as parent:
ref = opentracing.follows_from(parent.context)

with self.shim.start_active_span(
"FollowingSpan", references=[ref]
) as child:
self.assertEqual(
child.span.unwrap().links[0].context,
parent.context.unwrap(),
)
self.assertEqual(
child.span.unwrap().parent,
parent.context.unwrap(),
)

def test_set_operation_name(self):
"""Test `set_operation_name()` method."""

Expand Down
Loading