Skip to content
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 .github/workflows/test-integrations-ai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-integrations-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-integrations-dbs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down Expand Up @@ -185,7 +185,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-gevent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-integrations-network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-integrations-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-web-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-integrations-web-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
Expand Down
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Performance Monitoring
.. autofunction:: sentry_sdk.api.get_current_span
.. autofunction:: sentry_sdk.api.start_span
.. autofunction:: sentry_sdk.api.start_transaction
.. autofunction:: sentry_sdk.api.update_current_span


Distributed Tracing
Expand Down
2 changes: 1 addition & 1 deletion scripts/split_tox_gh_actions/templates/test_group.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
token: {% raw %}${{ secrets.CODECOV_TOKEN }}{% endraw %}
files: coverage.xml
# make sure no plugins alter our coverage reports
plugin: noop
plugins: noop
verbose: true

- name: Upload test results to Codecov
Expand Down
1 change: 1 addition & 0 deletions sentry_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"start_session",
"end_session",
"set_transaction_name",
"update_current_span",
]

# Initialize the debug support after everything is loaded
Expand Down
57 changes: 57 additions & 0 deletions sentry_sdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"start_session",
"end_session",
"set_transaction_name",
"update_current_span",
]


Expand Down Expand Up @@ -341,3 +342,59 @@ def end_session() -> None:
@scopemethod
def set_transaction_name(name: str, source: Optional[str] = None) -> None:
return get_current_scope().set_transaction_name(name, source)


def update_current_span(op=None, name=None, attributes=None):
# type: (Optional[str], Optional[str], Optional[dict[str, Union[str, int, float, bool]]]) -> None
"""
Update the current active span with the provided parameters.

This function allows you to modify properties of the currently active span.
If no span is currently active, this function will do nothing.

:param op: The operation name for the span. This is a high-level description
of what the span represents (e.g., "http.client", "db.query").
You can use predefined constants from :py:class:`sentry_sdk.consts.OP`
or provide your own string. If not provided, the span's operation will
remain unchanged.
:type op: str or None

:param name: The human-readable name/description for the span. This provides
more specific details about what the span represents (e.g., "GET /api/users",
"SELECT * FROM users"). If not provided, the span's name will remain unchanged.
:type name: str or None

:param attributes: A dictionary of key-value pairs to add as attributes to the span.
Attribute values must be strings, integers, floats, or booleans. These
attributes will be merged with any existing span data. If not provided,
no attributes will be added.
:type attributes: dict[str, Union[str, int, float, bool]] or None

:returns: None

.. versionadded:: 2.35.0

Example::

import sentry_sdk
from sentry_sdk.consts import OP

sentry_sdk.update_current_span(
op=OP.FUNCTION,
name="process_user_data",
attributes={"user_id": 123, "batch_size": 50}
)
"""
current_span = get_current_span()

if current_span is None:
return

if op is not None:
current_span.op = op

if name is not None:
current_span.name = name

if attributes is not None:
current_span.set_attributes(attributes)
Loading
Loading