Skip to content

Commit

Permalink
Fix excluded_urls typo in instrument_flask
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmojaki committed Feb 10, 2025
1 parent 8bd85d4 commit 9b951f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions logfire/_internal/integrations/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions logfire/_internal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand All @@ -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,
**{
Expand Down

0 comments on commit 9b951f6

Please sign in to comment.