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

BoundedDict was deprecated in opentelemetry-python 1.4.0 #226

Open
poolpitako opened this issue Jan 6, 2023 · 6 comments · May be fixed by #238
Open

BoundedDict was deprecated in opentelemetry-python 1.4.0 #226

poolpitako opened this issue Jan 6, 2023 · 6 comments · May be fixed by #238
Labels
enhancement accepted An actionable enhancement for which PRs will be accepted enhancement New feature or request priority: p3

Comments

@poolpitako
Copy link

Changelog:
https://github.com/open-telemetry/opentelemetry-python/blob/main/CHANGELOG.md#version-140023b0-2021-07-21

Used in in

Usage of the library will print:

/Users/user/.pyenv/versions/3.9.9/lib/python3.9/site-packages/opentelemetry/exporter/cloud_trace/__init__.py:498: DeprecationWarning: Call to deprecated class BoundedDict. -- Deprecated since version 1.4.0.
  ] = BoundedDict(num_attrs_limit)
@aabmass aabmass added enhancement New feature or request enhancement accepted An actionable enhancement for which PRs will be accepted priority: p3 labels Jan 11, 2023
@aabmass
Copy link
Collaborator

aabmass commented Jan 11, 2023

This was just removed from the public API of OTel so should keep warning. I agree we should fix this to stop the log spam, probably just by copying the code for BoundedDict into this repo.

@nnutter
Copy link

nnutter commented Feb 23, 2023

This produces a lot of log noise which we are billed for. I have not been able to figure out how to suppress the warning as a consumer of this package. Is there any chance the warning could be suppressed until a better solution is implemented?

@parabolala
Copy link

parabolala commented Feb 23, 2023

Here's a workaround that suppresses the warning:

import warnings

from opentelemetry.exporter import cloud_trace

class CloudTraceSpanExporterWithoutWarnings(cloud_trace.CloudTraceSpanExporter):
    """Suppresses DeprecationWarning raised by CloudTraceSpanExporter.

    See for details:
    https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/issues/226
    """

    def export(self, *args, **kwargs):
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", category=DeprecationWarning)
            super().export(*args, **kwargs)

@nnutter
Copy link

nnutter commented Mar 18, 2023

opentelemetry-api/opentelemetry-sdk v1.16.0 removes a warnings.resetwarnings() which is what I think was causing these deprecation warnings to have been spamming our logs. As far as I can tell Python does not show these warnings by default and it was that resetwarnings() call that was removing the default filters.

@shevisj
Copy link

shevisj commented Apr 21, 2023

Glad to see that they resolved the log spam issue but it seems like we should resolve the underlying issue as well.

It looks like opentelemetry.sdk.util.BoundedDict (sdk) was deprecated in favor of the equivalent class opentelemetry.attributes.BoundedAttributes (api) here open-telemetry/opentelemetry-python#1915

Would it make more sense to just switch to the new non-deprecated class rather than pulling a copy of the deprecated class into this repo?

@aabmass
Copy link
Collaborator

aabmass commented Jul 17, 2023

The linked PR is not working but glad the log spam has stopped. Can I assign this to you @shevisj ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement accepted An actionable enhancement for which PRs will be accepted enhancement New feature or request priority: p3
Projects
None yet
5 participants