Skip to content

Commit

Permalink
feat: Remove background_task and hide get_current_transaction.
Browse files Browse the repository at this point in the history
background_task is seemingly unusued, so it has been removed.

Also add comments explaining get_current_transaction is
internal-only and will not be exposed via API. Remove most
public references to it.
  • Loading branch information
dianakhuang committed Oct 16, 2024
1 parent 2d7519c commit cd70e28
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 33 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ Change Log

.. There should always be an "Unreleased" section for changes pending release.
Unreleased
----------
Changed
~~~~~~~
* Remove unused ``background_task`` monitoring function.
* Remove ``get_current_transaction`` from the public API.

[6.1.0] - 2024-10-15
---------------------
Changed
Expand Down
6 changes: 1 addition & 5 deletions edx_django_utils/monitoring/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,14 @@ Feature support matrix for built-in telemetry backends:
- ✅
- ❌
- ✅
* - Retrieve and manipulate spans (``get_current_transaction``, ``ignore_transaction``)
* - Manipulate spans (``ignore_transaction``)
- ✅
- ❌
- ❌
* - Record exceptions (``record_exception``)
- ✅
- ✅
- ✅
* - Instrument non-web tasks (``background_task``)
- ✅
- ❌
- ❌

Additional requirements for using these backends:

Expand Down
3 changes: 1 addition & 2 deletions edx_django_utils/monitoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
MonitoringMemoryMiddleware,
MonitoringSupportMiddleware
)
from .internal.transactions import get_current_transaction, ignore_transaction
from .internal.transactions import ignore_transaction
from .internal.utils import (
accumulate,
background_task,
function_trace,
increment,
record_exception,
Expand Down
4 changes: 3 additions & 1 deletion edx_django_utils/monitoring/internal/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def name(self):

def get_current_transaction():
"""
Returns the current transaction.
Returns the current transaction. This is only used internally and won't
be ported over to the backends framework, because transactions will be
very different based on the backend.
"""
current_transaction = None
if newrelic:
Expand Down
25 changes: 0 additions & 25 deletions edx_django_utils/monitoring/tests/test_utils.py

This file was deleted.

0 comments on commit cd70e28

Please sign in to comment.