Skip to content

Commit e23f390

Browse files
committed
chore(sentry): update start_span to use name istead of description arg
This was introduced in getsentry/sentry-python#3524 and description immediatelly started to throw depreciation error.
1 parent c779db0 commit e23f390

File tree

12 files changed

+19
-23
lines changed

12 files changed

+19
-23
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ dependencies = [
7676
"redis>=5.0.2,<5.2.0",
7777
"requests>=2.32.2,<2.33",
7878
"ruamel.yaml>=0.17.2,<0.19.0",
79-
"sentry-sdk>=2.8,<3.0",
79+
"sentry-sdk>=2.15.0,<3.0",
8080
"siphashc>=2.1,<3.0",
8181
"social-auth-app-django>=5.4.1,<6.0.0",
8282
"social-auth-core>=4.5.0,<5.0.0",

weblate/addons/models.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,7 @@ def execute_addon_event(
302302

303303
try:
304304
# Execute event in senty span to track performance
305-
with sentry_sdk.start_span(
306-
op=f"addon.{event.name}", description=addon.name
307-
):
305+
with sentry_sdk.start_span(op=f"addon.{event.name}", name=addon.name):
308306
if isinstance(method, str):
309307
log_result = getattr(addon.addon, method)(*args)
310308
else:

weblate/auth/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ def _fetch_permissions(self) -> None:
726726
"""Fetch all user permissions into a dictionary."""
727727
projects: PermissionCacheType = defaultdict(list)
728728
components: SimplePermissionCacheType = defaultdict(list)
729-
with sentry_sdk.start_span(op="permissions", description=self.username):
729+
with sentry_sdk.start_span(op="permissions", name=self.username):
730730
for group in self.cached_groups:
731731
# Skip permissions for not verified users
732732
if group.enforced_2fa and not self.profile.has_2fa:

weblate/checks/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def check_component(self, component: Component) -> Iterable[Unit]:
216216
raise NotImplementedError
217217

218218
def perform_batch(self, component: Component) -> None:
219-
with sentry_sdk.start_span(op="check.perform_batch", description=self.check_id):
219+
with sentry_sdk.start_span(op="check.perform_batch", name=self.check_id):
220220
self._perform_batch(component)
221221

222222
def _perform_batch(self, component: Component) -> None:

weblate/glossary/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_glossary_sources(component):
4545
def get_glossary_automaton(project):
4646
from weblate.trans.models.component import prefetch_glossary_terms
4747

48-
with sentry_sdk.start_span(op="glossary.automaton", description=project.slug):
48+
with sentry_sdk.start_span(op="glossary.automaton", name=project.slug):
4949
# Chain terms
5050
prefetch_glossary_terms(project.glossaries)
5151
terms = set(
@@ -107,7 +107,7 @@ def get_glossary_terms(
107107
automaton = project.glossary_automaton
108108
positions: dict[str, list[tuple[int, int]]] = defaultdict(list)
109109
# Extract terms present in the source
110-
with sentry_sdk.start_span(op="glossary.match", description=project.slug):
110+
with sentry_sdk.start_span(op="glossary.match", name=project.slug):
111111
for _termno, start, end in automaton.find_matches_as_indexes(
112112
source, overlapping=True
113113
):

weblate/screenshots/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def ensure_tesseract_language(lang: str) -> None:
177177

178178
LOGGER.debug("downloading tesseract data %s", url)
179179

180-
with sentry_sdk.start_span(op="ocr.download", description=url):
180+
with sentry_sdk.start_span(op="ocr.download", name=url):
181181
response = request("GET", url, allow_redirects=True)
182182

183183
with open(full_name, "xb") as handle:
@@ -384,14 +384,14 @@ def ocr_get_strings(api, image: str, resolution: int = 72):
384384
else:
385385
api.SetSourceResolution(resolution)
386386

387-
with sentry_sdk.start_span(op="ocr.recognize", description=image):
387+
with sentry_sdk.start_span(op="ocr.recognize", name=image):
388388
api.Recognize()
389389

390-
with sentry_sdk.start_span(op="ocr.iterate", description=image):
390+
with sentry_sdk.start_span(op="ocr.iterate", name=image):
391391
iterator = api.GetIterator()
392392
level = RIL.TEXTLINE
393393
for r in iterate_level(iterator, level):
394-
with sentry_sdk.start_span(op="ocr.text", description=image):
394+
with sentry_sdk.start_span(op="ocr.text", name=image):
395395
try:
396396
yield r.GetUTF8Text(level)
397397
except RuntimeError:

weblate/trans/models/component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3816,7 +3816,7 @@ def all_repo_components(self):
38163816
return [self]
38173817

38183818
def start_sentry_span(self, op: str):
3819-
return sentry_sdk.start_span(op=op, description=self.full_slug)
3819+
return sentry_sdk.start_span(op=op, name=self.full_slug)
38203820

38213821
@cached_property
38223822
def key_filter_re(self) -> re.Pattern:

weblate/trans/models/translation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def get_filename(self) -> None | str:
271271
def load_store(self, fileobj=None, force_intermediate=False):
272272
"""Load translate-toolkit storage from disk."""
273273
# Use intermediate store as template for source translation
274-
with sentry_sdk.start_span(op="load_store", description=self.get_filename()):
274+
with sentry_sdk.start_span(op="load_store", name=self.get_filename()):
275275
if force_intermediate or (self.is_template and self.component.intermediate):
276276
template = self.component.intermediate_store
277277
else:
@@ -329,7 +329,7 @@ def sync_unit(
329329
is_new = True
330330

331331
with sentry_sdk.start_span(
332-
op="update_from_unit", description=f"{self.full_slug}:{pos}"
332+
op="update_from_unit", name=f"{self.full_slug}:{pos}"
333333
):
334334
newunit.update_from_unit(unit, pos, is_new)
335335

@@ -338,7 +338,7 @@ def sync_unit(
338338

339339
def check_sync(self, force=False, request=None, change=None) -> None: # noqa: C901
340340
"""Check whether database is in sync with git and possibly updates."""
341-
with sentry_sdk.start_span(op="check_sync", description=self.full_slug):
341+
with sentry_sdk.start_span(op="check_sync", name=self.full_slug):
342342
if change is None:
343343
change = Change.ACTION_UPDATE
344344
user = None if request is None else request.user

weblate/trans/views/edit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def display_fixups(request: AuthenticatedHttpRequest, fixups) -> None:
8383

8484
def get_other_units(unit):
8585
"""Return other units to show while translating."""
86-
with sentry_sdk.start_span(op="unit.others", description=unit.pk):
86+
with sentry_sdk.start_span(op="unit.others", name=unit.pk):
8787
result: dict[str, Any] = {
8888
"total": 0,
8989
"skipped": False,
@@ -240,7 +240,7 @@ def search(
240240
name = ""
241241
search_items = ()
242242

243-
with sentry_sdk.start_span(op="unit.search", description=search_url):
243+
with sentry_sdk.start_span(op="unit.search", name=search_url):
244244
search_result = {
245245
"form": form,
246246
"offset": cleaned_data.get("offset", 1),

weblate/utils/lock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def __enter__(self):
8484
self._depth += 1
8585
if self._depth > 1:
8686
return
87-
with sentry_sdk.start_span(op="lock.wait", description=self._name):
87+
with sentry_sdk.start_span(op="lock.wait", name=self._name):
8888
self._enter_implementation()
8989

9090
def __exit__(self, exc_type, exc_value, traceback):

0 commit comments

Comments
 (0)