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

Promote some PendingDeprecationWarning to DeprecationWarning #2076

Merged
merged 1 commit into from
Jul 9, 2024
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
4 changes: 2 additions & 2 deletions elasticapm/contrib/django/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
class LoggingHandler(BaseLoggingHandler):
def __init__(self, level=logging.NOTSET) -> None:
warnings.warn(
"The LoggingHandler will be deprecated in v7.0 of the agent. "
"The LoggingHandler is deprecated and will be removed in v7.0 of the agent. "
"Please use `log_ecs_reformatting` and ship the logs with Elastic "
"Agent or Filebeat instead. "
"https://www.elastic.co/guide/en/apm/agent/python/current/logs.html",
PendingDeprecationWarning,
DeprecationWarning,
)
# skip initialization of BaseLoggingHandler
logging.Handler.__init__(self, level=level)
Expand Down
2 changes: 1 addition & 1 deletion elasticapm/contrib/flask/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(self, app=None, client=None, client_cls=Client, logging=False, **de
if self.logging:
warnings.warn(
"Flask log shipping is deprecated. See the Flask docs for more info and alternatives.",
PendingDeprecationWarning,
DeprecationWarning,
)
self.client = client or get_client()
self.client_cls = client_cls
Expand Down
4 changes: 2 additions & 2 deletions elasticapm/contrib/opentracing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

warnings.warn(
(
"The OpenTracing bridge will be deprecated in the next major release. "
"The OpenTracing bridge is deprecated and will be removed in the next major release. "
"Please migrate to the OpenTelemetry bridge."
),
PendingDeprecationWarning,
DeprecationWarning,
)
11 changes: 4 additions & 7 deletions elasticapm/handlers/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, *args, **kwargs) -> None:
"the agent. Please use `log_ecs_reformatting` and ship the logs "
"with Elastic Agent or Filebeat instead. "
"https://www.elastic.co/guide/en/apm/agent/python/current/logs.html",
PendingDeprecationWarning,
DeprecationWarning,
)
self.client = None
if "client" in kwargs:
Expand All @@ -66,12 +66,9 @@ def __init__(self, *args, **kwargs) -> None:
if client_cls:
self.client = client_cls(*args, **kwargs)
else:
# In 6.0, this should raise a ValueError
warnings.warn(
"LoggingHandler requires a Client instance. No Client was "
"received. This will result in an error starting in v6.0 "
"of the agent",
PendingDeprecationWarning,
"LoggingHandler requires a Client instance. No Client was received.",
DeprecationWarning,
)
self.client = Client(*args, **kwargs)
logging.Handler.__init__(self, level=kwargs.get("level", logging.NOTSET))
Expand Down Expand Up @@ -201,7 +198,7 @@ def __init__(self, name=""):
"the agent. On Python 3.2+, by default we add a LogRecordFactory to "
"your root logger automatically"
"https://www.elastic.co/guide/en/apm/agent/python/current/logs.html",
PendingDeprecationWarning,
DeprecationWarning,
)

def filter(self, record):
Expand Down
2 changes: 1 addition & 1 deletion tests/handlers/logging/logging_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def test_logging_handler_no_client(recwarn):
while True:
# If we never find our desired warning this will eventually throw an
# AssertionError
w = recwarn.pop(PendingDeprecationWarning)
w = recwarn.pop(DeprecationWarning)
if "LoggingHandler requires a Client instance" in w.message.args[0]:
return True

Expand Down
Loading