Skip to content

Commit

Permalink
upgrade OTel python to 0.17b0, small fixes (#101)
Browse files Browse the repository at this point in the history
* upgrade OTel python to 0.17b0, small fixes

* allow "OpenTelemetry Authors"
  • Loading branch information
aabmass authored Feb 4, 2021
1 parent 0ae0685 commit 32ed6a7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/header-checker-lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
allowedLicenses:
- Apache-2.0
allowedCopyrightHolders:
- Google
- OpenTelemetry Authors
sourceFileExtensions:
- py
- sh
4 changes: 2 additions & 2 deletions dev-constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ Sphinx==3.1.2
# development before GA. After GA, we will build against specific releases.
# Bump the commit frequently during development whenever you are missing
# changes from upstream.
opentelemetry-api~=0.16b1
opentelemetry-sdk~=0.16b1
opentelemetry-api~=0.17b0
opentelemetry-sdk~=0.17b0
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,9 @@ def _extract_attributes(
add_agent_attr: bool = False,
) -> ProtoSpan.Attributes:
"""Convert span.attributes to dict."""
attributes_dict = BoundedDict(num_attrs_limit)
attributes_dict = BoundedDict(
num_attrs_limit
) # type: BoundedDict[str, AttributeValue]
invalid_value_dropped_count = 0
for key, value in attrs.items() if attrs else []:
key = _truncate_str(key, 128)[0]
Expand All @@ -411,7 +413,7 @@ def _extract_attributes(
)
return ProtoSpan.Attributes(
attribute_map=attributes_dict,
dropped_attributes_count=attributes_dict.dropped
dropped_attributes_count=attributes_dict.dropped # type: ignore[attr-defined]
+ invalid_value_dropped_count,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
_TRACE_CONTEXT_HEADER_NAME = "X-Cloud-Trace-Context"
_TRACE_CONTEXT_HEADER_FORMAT = r"(?P<trace_id>[0-9a-f]{32})\/(?P<span_id>[\d]{1,20});o=(?P<trace_flags>\d+)"
_TRACE_CONTEXT_HEADER_RE = re.compile(_TRACE_CONTEXT_HEADER_FORMAT)
_FIELDS = {_TRACE_CONTEXT_HEADER_NAME}


class CloudTraceFormatPropagator(textmap.TextMapPropagator):
Expand Down Expand Up @@ -85,3 +86,7 @@ def inject(
int(span_context.trace_flags.sampled),
)
set_in_carrier(carrier, _TRACE_CONTEXT_HEADER_NAME, header)

@property
def fields(self) -> typing.Set[str]:
return _FIELDS

0 comments on commit 32ed6a7

Please sign in to comment.