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

Replace use of deprecated class BoundedDict with BoundedAttributes #238

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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 e2e-test-server/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Jinja2==2.11.3
libcst==0.3.18
MarkupSafe==1.1.1
mypy-extensions==0.4.3
opentelemetry-api==1.1.0
opentelemetry-api==1.4.0
opentelemetry-sdk==1.1.0
opentelemetry-semantic-conventions==0.20b0
packaging==20.9
Expand Down
2 changes: 2 additions & 0 deletions opentelemetry-exporter-gcp-trace/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Add support for Python 3.11
([#240](https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/pull/240))
- Upgrade `opentelemetry-api` dependency to version 1.4 or newer
([#238](https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/pull/238))

## Version 1.4.0

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-exporter-gcp-trace/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ package_dir=
packages=find_namespace:
install_requires =
google-cloud-trace ~= 1.1
opentelemetry-api ~= 1.0
opentelemetry-api ~= 1.4
opentelemetry-sdk ~= 1.0
opentelemetry-resourcedetector-gcp >= 1.5.0dev0, == 1.*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
Timestamp,
)
from google.rpc import code_pb2, status_pb2
from opentelemetry.attributes import BoundedAttributes
from opentelemetry.exporter.cloud_trace.environment_variables import (
OTEL_EXPORTER_GCP_TRACE_PROJECT_ID,
OTEL_EXPORTER_GCP_TRACE_RESOURCE_REGEX,
Expand All @@ -115,7 +116,6 @@
SpanExporter,
SpanExportResult,
)
from opentelemetry.sdk.util import BoundedDict
from opentelemetry.trace import format_span_id, format_trace_id
from opentelemetry.trace.status import StatusCode
from opentelemetry.util import types
Expand Down Expand Up @@ -476,9 +476,9 @@ def _extract_attributes(
add_agent_attr: bool = False,
) -> trace_types.Span.Attributes:
"""Convert span.attributes to dict."""
attributes_dict: BoundedDict[
attributes_dict: BoundedAttributes[
str, trace_types.AttributeValue
] = BoundedDict(num_attrs_limit)
] = BoundedAttributes(num_attrs_limit, immutable=False)
invalid_value_dropped_count = 0
for ot_key, ot_value in attrs.items() if attrs else []:
key = _truncate_str(ot_key, MAX_ATTR_KEY_BYTES)[0]
Expand Down