From 9b951f64c6f8e8a6d1fe607cd17062e750a35a4d Mon Sep 17 00:00:00 2001 From: Alex Hall Date: Mon, 10 Feb 2025 12:13:21 +0200 Subject: [PATCH] Fix excluded_urls typo in instrument_flask --- logfire/_internal/integrations/flask.py | 8 ++++++-- logfire/_internal/main.py | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/logfire/_internal/integrations/flask.py b/logfire/_internal/integrations/flask.py index 2cf0135c6..7035a3114 100644 --- a/logfire/_internal/integrations/flask.py +++ b/logfire/_internal/integrations/flask.py @@ -23,7 +23,7 @@ def instrument_flask( capture_headers: bool, enable_commenter: bool, commenter_options: CommenterOptions | None, - exclude_urls: str | None = None, + excluded_urls: str | None = None, request_hook: RequestHook | None = None, response_hook: ResponseHook | None = None, **kwargs: Any, @@ -33,11 +33,15 @@ def instrument_flask( See the `Logfire.instrument_flask` method for details. """ maybe_capture_server_headers(capture_headers) + + # Previously the parameter was accidentally called exclude_urls, so we support both. + excluded_urls = excluded_urls or kwargs.pop('exclude_urls', None) + FlaskInstrumentor().instrument_app( # type: ignore[reportUnknownMemberType] app, enable_commenter=enable_commenter, commenter_options=commenter_options, - excluded_urls=exclude_urls, + excluded_urls=excluded_urls, request_hook=request_hook, response_hook=response_hook, **kwargs, diff --git a/logfire/_internal/main.py b/logfire/_internal/main.py index a8703efbf..c671ea695 100644 --- a/logfire/_internal/main.py +++ b/logfire/_internal/main.py @@ -1439,7 +1439,7 @@ def instrument_flask( capture_headers: bool = False, enable_commenter: bool = True, commenter_options: FlaskCommenterOptions | None = None, - exclude_urls: str | None = None, + excluded_urls: str | None = None, request_hook: FlaskRequestHook | None = None, response_hook: FlaskResponseHook | None = None, **kwargs: Any, @@ -1456,7 +1456,7 @@ def instrument_flask( enable_commenter: Adds comments to SQL queries performed by Flask, so that database logs have additional context. commenter_options: Configure the tags to be added to the SQL comments. See more about it on the [SQLCommenter Configurations](https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/flask/flask.html#sqlcommenter-configurations). - exclude_urls: A string containing a comma-delimited list of regexes used to exclude URLs from tracking. + excluded_urls: A string containing a comma-delimited list of regexes used to exclude URLs from tracking. request_hook: A function called right after a span is created for a request. response_hook: A function called right before a span is finished for the response. **kwargs: Additional keyword arguments to pass to the OpenTelemetry Flask instrumentation. @@ -1469,7 +1469,7 @@ def instrument_flask( capture_headers=capture_headers, enable_commenter=enable_commenter, commenter_options=commenter_options, - exclude_urls=exclude_urls, + excluded_urls=excluded_urls, request_hook=request_hook, response_hook=response_hook, **{