diff --git a/pyproject.toml b/pyproject.toml index 1e276ef71bf8..1030f90b165d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,7 +76,7 @@ dependencies = [ "redis>=5.0.2,<5.2.0", "requests>=2.32.2,<2.33", "ruamel.yaml>=0.17.2,<0.19.0", - "sentry-sdk>=2.8,<3.0", + "sentry-sdk>=2.15.0,<3.0", "siphashc>=2.1,<3.0", "social-auth-app-django>=5.4.1,<6.0.0", "social-auth-core>=4.5.0,<5.0.0", diff --git a/weblate/addons/models.py b/weblate/addons/models.py index 21b2a38e4081..68a9db2fb413 100644 --- a/weblate/addons/models.py +++ b/weblate/addons/models.py @@ -302,9 +302,7 @@ def execute_addon_event( try: # Execute event in senty span to track performance - with sentry_sdk.start_span( - op=f"addon.{event.name}", description=addon.name - ): + with sentry_sdk.start_span(op=f"addon.{event.name}", name=addon.name): if isinstance(method, str): log_result = getattr(addon.addon, method)(*args) else: diff --git a/weblate/auth/models.py b/weblate/auth/models.py index 6f1a405e5f6b..5e21f6fc6aeb 100644 --- a/weblate/auth/models.py +++ b/weblate/auth/models.py @@ -726,7 +726,7 @@ def _fetch_permissions(self) -> None: """Fetch all user permissions into a dictionary.""" projects: PermissionCacheType = defaultdict(list) components: SimplePermissionCacheType = defaultdict(list) - with sentry_sdk.start_span(op="permissions", description=self.username): + with sentry_sdk.start_span(op="permissions", name=self.username): for group in self.cached_groups: # Skip permissions for not verified users if group.enforced_2fa and not self.profile.has_2fa: diff --git a/weblate/checks/base.py b/weblate/checks/base.py index dd12684f5590..cc7913e362b8 100644 --- a/weblate/checks/base.py +++ b/weblate/checks/base.py @@ -216,7 +216,7 @@ def check_component(self, component: Component) -> Iterable[Unit]: raise NotImplementedError def perform_batch(self, component: Component) -> None: - with sentry_sdk.start_span(op="check.perform_batch", description=self.check_id): + with sentry_sdk.start_span(op="check.perform_batch", name=self.check_id): self._perform_batch(component) def _perform_batch(self, component: Component) -> None: diff --git a/weblate/glossary/models.py b/weblate/glossary/models.py index e793e0f20a50..00d87f4e5c83 100644 --- a/weblate/glossary/models.py +++ b/weblate/glossary/models.py @@ -45,7 +45,7 @@ def get_glossary_sources(component): def get_glossary_automaton(project): from weblate.trans.models.component import prefetch_glossary_terms - with sentry_sdk.start_span(op="glossary.automaton", description=project.slug): + with sentry_sdk.start_span(op="glossary.automaton", name=project.slug): # Chain terms prefetch_glossary_terms(project.glossaries) terms = set( @@ -107,7 +107,7 @@ def get_glossary_terms( automaton = project.glossary_automaton positions: dict[str, list[tuple[int, int]]] = defaultdict(list) # Extract terms present in the source - with sentry_sdk.start_span(op="glossary.match", description=project.slug): + with sentry_sdk.start_span(op="glossary.match", name=project.slug): for _termno, start, end in automaton.find_matches_as_indexes( source, overlapping=True ): diff --git a/weblate/screenshots/views.py b/weblate/screenshots/views.py index 659bb4b10ac1..046317c8e4a0 100644 --- a/weblate/screenshots/views.py +++ b/weblate/screenshots/views.py @@ -177,7 +177,7 @@ def ensure_tesseract_language(lang: str) -> None: LOGGER.debug("downloading tesseract data %s", url) - with sentry_sdk.start_span(op="ocr.download", description=url): + with sentry_sdk.start_span(op="ocr.download", name=url): response = request("GET", url, allow_redirects=True) with open(full_name, "xb") as handle: @@ -384,14 +384,14 @@ def ocr_get_strings(api, image: str, resolution: int = 72): else: api.SetSourceResolution(resolution) - with sentry_sdk.start_span(op="ocr.recognize", description=image): + with sentry_sdk.start_span(op="ocr.recognize", name=image): api.Recognize() - with sentry_sdk.start_span(op="ocr.iterate", description=image): + with sentry_sdk.start_span(op="ocr.iterate", name=image): iterator = api.GetIterator() level = RIL.TEXTLINE for r in iterate_level(iterator, level): - with sentry_sdk.start_span(op="ocr.text", description=image): + with sentry_sdk.start_span(op="ocr.text", name=image): try: yield r.GetUTF8Text(level) except RuntimeError: diff --git a/weblate/trans/models/component.py b/weblate/trans/models/component.py index 144dc05a4aed..5dd1b7e50fbe 100644 --- a/weblate/trans/models/component.py +++ b/weblate/trans/models/component.py @@ -3816,7 +3816,7 @@ def all_repo_components(self): return [self] def start_sentry_span(self, op: str): - return sentry_sdk.start_span(op=op, description=self.full_slug) + return sentry_sdk.start_span(op=op, name=self.full_slug) @cached_property def key_filter_re(self) -> re.Pattern: diff --git a/weblate/trans/models/translation.py b/weblate/trans/models/translation.py index cf13c3f5bfb7..6896a2e77d36 100644 --- a/weblate/trans/models/translation.py +++ b/weblate/trans/models/translation.py @@ -271,7 +271,7 @@ def get_filename(self) -> None | str: def load_store(self, fileobj=None, force_intermediate=False): """Load translate-toolkit storage from disk.""" # Use intermediate store as template for source translation - with sentry_sdk.start_span(op="load_store", description=self.get_filename()): + with sentry_sdk.start_span(op="load_store", name=self.get_filename()): if force_intermediate or (self.is_template and self.component.intermediate): template = self.component.intermediate_store else: @@ -329,7 +329,7 @@ def sync_unit( is_new = True with sentry_sdk.start_span( - op="update_from_unit", description=f"{self.full_slug}:{pos}" + op="update_from_unit", name=f"{self.full_slug}:{pos}" ): newunit.update_from_unit(unit, pos, is_new) @@ -338,7 +338,7 @@ def sync_unit( def check_sync(self, force=False, request=None, change=None) -> None: # noqa: C901 """Check whether database is in sync with git and possibly updates.""" - with sentry_sdk.start_span(op="check_sync", description=self.full_slug): + with sentry_sdk.start_span(op="check_sync", name=self.full_slug): if change is None: change = Change.ACTION_UPDATE user = None if request is None else request.user diff --git a/weblate/trans/views/edit.py b/weblate/trans/views/edit.py index 34dad864a207..4f492aacd868 100644 --- a/weblate/trans/views/edit.py +++ b/weblate/trans/views/edit.py @@ -83,7 +83,7 @@ def display_fixups(request: AuthenticatedHttpRequest, fixups) -> None: def get_other_units(unit): """Return other units to show while translating.""" - with sentry_sdk.start_span(op="unit.others", description=unit.pk): + with sentry_sdk.start_span(op="unit.others", name=unit.pk): result: dict[str, Any] = { "total": 0, "skipped": False, @@ -240,7 +240,7 @@ def search( name = "" search_items = () - with sentry_sdk.start_span(op="unit.search", description=search_url): + with sentry_sdk.start_span(op="unit.search", name=search_url): search_result = { "form": form, "offset": cleaned_data.get("offset", 1), diff --git a/weblate/utils/lock.py b/weblate/utils/lock.py index 05aa5ed87fb4..b2614bec44f1 100644 --- a/weblate/utils/lock.py +++ b/weblate/utils/lock.py @@ -84,7 +84,7 @@ def __enter__(self): self._depth += 1 if self._depth > 1: return - with sentry_sdk.start_span(op="lock.wait", description=self._name): + with sentry_sdk.start_span(op="lock.wait", name=self._name): self._enter_implementation() def __exit__(self, exc_type, exc_value, traceback): diff --git a/weblate/utils/stats.py b/weblate/utils/stats.py index 815efe33a52e..a050a6e16895 100644 --- a/weblate/utils/stats.py +++ b/weblate/utils/stats.py @@ -363,9 +363,7 @@ def update_stats(self, update_parents: bool = True) -> None: self.save(update_parents=update_parents) def calculate_basic(self) -> None: - with sentry_sdk.start_span( - op="stats", description=f"CALCULATE {self.cache_key}" - ): + with sentry_sdk.start_span(op="stats", name=f"CALCULATE {self.cache_key}"): self.ensure_loaded() self._calculate_basic() diff --git a/weblate/vcs/git.py b/weblate/vcs/git.py index ef74d2ec01fd..c9e34713e777 100644 --- a/weblate/vcs/git.py +++ b/weblate/vcs/git.py @@ -1158,7 +1158,7 @@ def request( next_api_time = cache.get(cache_id) now = time() if next_api_time is not None and now < next_api_time: - with sentry_sdk.start_span(op="api_sleep", description=vcs_id): + with sentry_sdk.start_span(op="api_sleep", name=vcs_id): sleep(next_api_time - now) try: response = requests.request(