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
14 changes: 10 additions & 4 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -798,15 +798,21 @@ tests/sentry/api/endpoints/test_organization_attribute_mappings.py @get
/static/app/views/settings/ @getsentry/design-engineering
/static/app/views/nav/ @getsentry/design-engineering
/static/app/bootstrap/ @getsentry/design-engineering

# LLM Agent guidelines
# Config files
/figma.config.json @getsentry/design-engineering
/knip.config.ts @getsentry/design-engineering
# Agents + Skills
/static/.cursor/BUGBOT.md @getsentry/design-engineering
/static/CLAUDE.md @getsentry/design-engineering
/static/AGENTS.md @getsentry/design-engineering
/.claude/skills/design-system/ @getsentry/design-engineering

/static/eslint/ @getsentry/design-engineering
/scripts/analyze-styled.ts @getsentry/design-engineering
/.agents/skills/design-system/ @getsentry/design-engineering
/.agents/skills/migrate-frontend-forms/ @getsentry/design-engineering
/.agents/skills/generate-frontend-forms/ @getsentry/design-engineering
/.agents/skills/lint-fix/ @getsentry/design-engineering
/.agents/skills/lint-new/ @getsentry/design-engineering
/.agents/skills/react-component-documentation/ @getsentry/design-engineering
## End of Frontend Platform

# Coding Workflows
Expand Down
13 changes: 0 additions & 13 deletions .github/codeowners-coverage-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,11 @@
src/sentry/data/error-**
src/sentry/locale/**

.agents/skills/design-system/SKILL.md
.agents/skills/generate-frontend-forms/SKILL.md
.agents/skills/lint-fix/SKILL.md
.agents/skills/lint-fix/references/fix-patterns.md
.agents/skills/lint-fix/references/token-taxonomy.md
.agents/skills/lint-new/SKILL.md
.agents/skills/lint-new/references/rule-archetypes.md
.agents/skills/lint-new/references/schema-patterns.md
.agents/skills/lint-new/references/style-collector-guide.md
.agents/skills/migrate-frontend-forms/SKILL.md
.agents/skills/notification-platform/SKILL.md
.agents/skills/notification-platform/references/custom-renderers.md
.agents/skills/notification-platform/references/data-and-templates.md
.agents/skills/notification-platform/references/provider-template.md
.agents/skills/notification-platform/references/targets-and-sending.md
.agents/skills/react-component-documentation/SKILL.md
.agents/skills/setup-dev/SKILL.md
.agents/skills/setup-dev/references/orbstack-fix.md
.codeowners-config.yml
Expand Down Expand Up @@ -68,9 +57,7 @@ bin/split-silo-database
bin/update-migration
config/build-chartcuterie.ts
config/commit-template
figma.config.json
jest.config.snapshots.ts
knip.config.ts
migrations_lockfile.txt
rspack.config.ts
src/AGENTS.md
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ default = true

[dependency-groups]
dev = [
"codeowners-coverage>=0.2.1",
"covdefaults>=2.3.0",
"devservices>=1.2.4",
"docker>=7.1.0",
Expand Down
5 changes: 3 additions & 2 deletions src/sentry/api/endpoints/organization_events.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from collections.abc import Mapping
from concurrent.futures import ThreadPoolExecutor, as_completed
from concurrent.futures import as_completed
from typing import Any, NotRequired, TypedDict

import sentry_sdk
Expand Down Expand Up @@ -54,6 +54,7 @@
from sentry.snuba.types import DatasetQuery
from sentry.snuba.utils import RPC_DATASETS, dataset_split_decision_inferred_from_query, get_dataset
from sentry.types.ratelimit import RateLimit, RateLimitCategory
from sentry.utils.concurrent import ContextPropagatingThreadPoolExecutor
from sentry.utils.cursors import Cursor, EAPPageTokenCursor
from sentry.utils.snuba import SnubaError

Expand Down Expand Up @@ -409,7 +410,7 @@ def _discover_data_fn(
# Unable to infer based on selected fields and query string, so run both queries.
else:
map = {}
with ThreadPoolExecutor(max_workers=3) as exe:
with ContextPropagatingThreadPoolExecutor(max_workers=3) as exe:
futures = {
exe.submit(
_data_fn, dataset_query, offset, limit, scoped_query
Expand Down
5 changes: 3 additions & 2 deletions src/sentry/api/endpoints/organization_events_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
from collections import defaultdict, deque
from collections.abc import Callable, Iterable, Mapping, Sequence
from concurrent.futures import ThreadPoolExecutor, as_completed
from concurrent.futures import as_completed
from datetime import datetime, timedelta
from typing import Any, Optional, TypedDict, TypeVar, cast

Expand Down Expand Up @@ -38,6 +38,7 @@
from sentry.snuba.occurrences_rpc import OccurrenceCategory, Occurrences
from sentry.snuba.query_sources import QuerySource
from sentry.snuba.referrer import Referrer
from sentry.utils.concurrent import ContextPropagatingThreadPoolExecutor
from sentry.utils.numbers import base32_encode, format_grouped_length
from sentry.utils.sdk import set_span_attribute
from sentry.utils.snuba import bulk_snuba_queries
Expand Down Expand Up @@ -1286,7 +1287,7 @@ def update_children(event: TraceEvent, limit: int) -> None:
@staticmethod
def nodestore_event_map(events: Sequence[SnubaTransaction]) -> dict[str, Event | GroupEvent]:
event_map = {}
with ThreadPoolExecutor(max_workers=20) as executor:
with ContextPropagatingThreadPoolExecutor(max_workers=20) as executor:
future_to_event = {
executor.submit(
eventstore.backend.get_event_by_id, event["project.id"], event["id"]
Expand Down
6 changes: 4 additions & 2 deletions src/sentry/api/endpoints/organization_events_trends_v2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
from concurrent.futures import ThreadPoolExecutor
from functools import partial

import sentry_sdk
Expand All @@ -24,6 +23,7 @@
from sentry.snuba.metrics_performance import query as metrics_query
from sentry.snuba.referrer import Referrer
from sentry.types.ratelimit import RateLimit, RateLimitCategory
from sentry.utils.concurrent import ContextPropagatingThreadPoolExecutor
from sentry.utils.iterators import chunked
from sentry.utils.snuba import SnubaTSResult

Expand Down Expand Up @@ -275,7 +275,9 @@ def get_trends_data(stats_data, request):
]

# send the data to microservice
with ThreadPoolExecutor(thread_name_prefix=__name__) as query_thread_pool:
with ContextPropagatingThreadPoolExecutor(
thread_name_prefix=__name__
) as query_thread_pool:
results = list(
query_thread_pool.map(
partial(detect_breakpoints, viewer_context=viewer_context),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from collections.abc import Callable, Sequence
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timedelta
from typing import Any, Literal, NotRequired, TypedDict

Expand Down Expand Up @@ -71,6 +70,7 @@
from sentry.snuba.referrer import Referrer
from sentry.tagstore.types import TagValue
from sentry.utils import snuba_rpc
from sentry.utils.concurrent import ContextPropagatingThreadPoolExecutor
from sentry.utils.cursors import Cursor, CursorResult

POSSIBLE_ATTRIBUTE_TYPES = ["string", "number", "boolean"]
Expand Down Expand Up @@ -321,7 +321,7 @@ def get(self, request: Request, organization: Organization) -> Response:

def data_fn(offset: int, limit: int) -> list[TraceItemAttributeKey]:
futures = []
with ThreadPoolExecutor(
with ContextPropagatingThreadPoolExecutor(
thread_name_prefix=__name__,
max_workers=len(POSSIBLE_ATTRIBUTE_TYPES),
) as pool:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor
from typing import Any, TypedDict, cast

from rest_framework.request import Request
Expand Down Expand Up @@ -34,6 +33,7 @@
from sentry.snuba.referrer import Referrer
from sentry.snuba.spans_rpc import Spans
from sentry.utils import snuba_rpc
from sentry.utils.concurrent import ContextPropagatingThreadPoolExecutor
from sentry.utils.snuba_rpc import trace_item_stats_rpc

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -326,7 +326,7 @@ def run_table_query_with_error_handling(query_string):
referrer=Referrer.API_SPAN_SAMPLE_GET_SPAN_DATA.value,
)

with ThreadPoolExecutor(
with ContextPropagatingThreadPoolExecutor(
thread_name_prefix=__name__,
max_workers=PARALLELIZATION_FACTOR * 2 + 2, # 2 cohorts * threads + 2 totals queries
) as query_thread_pool:
Expand Down
5 changes: 3 additions & 2 deletions src/sentry/api/endpoints/organization_trace_item_stats.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor, as_completed
from concurrent.futures import as_completed

from rest_framework import serializers
from rest_framework.request import Request
Expand Down Expand Up @@ -28,6 +28,7 @@
from sentry.search.eap.types import SearchResolverConfig
from sentry.snuba.referrer import Referrer
from sentry.snuba.spans_rpc import Spans
from sentry.utils.concurrent import ContextPropagatingThreadPoolExecutor
from sentry.utils.cursors import Cursor, CursorResult

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -210,7 +211,7 @@ def data_fn(offset: int, limit: int):
)

stats_results: dict[str, dict[str, dict]] = defaultdict(lambda: {"data": {}})
with ThreadPoolExecutor(
with ContextPropagatingThreadPoolExecutor(
thread_name_prefix=__name__,
max_workers=MAX_THREADS,
) as query_thread_pool:
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/api/endpoints/organization_trace_meta.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
from concurrent.futures import ThreadPoolExecutor
from typing import TypedDict

import sentry_sdk
Expand Down Expand Up @@ -28,6 +27,7 @@
from sentry.snuba.rpc_dataset_common import RPCBase, TableQuery
from sentry.snuba.spans_rpc import Spans
from sentry.snuba.trace import _run_uptime_results_query, _uptime_results_query
from sentry.utils.concurrent import ContextPropagatingThreadPoolExecutor

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -208,7 +208,7 @@ def get(self, request: Request, organization: Organization, trace_id: str) -> Ht
# parallelizing the queries here, but ideally this parallelization happens by calling run_bulk_table_queries
include_uptime = request.GET.get("include_uptime", "0") == "1"
max_workers = 3 + (1 if include_uptime else 0)
with ThreadPoolExecutor(
with ContextPropagatingThreadPoolExecutor(
thread_name_prefix=__name__,
max_workers=max_workers,
) as query_thread_pool:
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/api/endpoints/organization_traces.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import dataclasses
from collections import defaultdict
from collections.abc import Callable, Generator, Mapping, MutableMapping
from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager
from datetime import timedelta
from typing import Any, Literal, NotRequired, TypedDict
Expand Down Expand Up @@ -56,6 +55,7 @@
from sentry.snuba.occurrences_rpc import OccurrenceCategory
from sentry.snuba.referrer import Referrer
from sentry.snuba.spans_rpc import Spans
from sentry.utils.concurrent import ContextPropagatingThreadPoolExecutor
from sentry.utils.numbers import clip
from sentry.utils.sdk import set_span_attribute
from sentry.utils.snuba import bulk_snuba_queries_with_referrers
Expand Down Expand Up @@ -253,7 +253,7 @@ def _execute_rpc(self):
# issue
if len(self.snuba_params.projects) < len(all_projects) and self.offset == 0:
selected_project_request = self.get_traces_rpc(list(self.snuba_params.projects))
with ThreadPoolExecutor(
with ContextPropagatingThreadPoolExecutor(
thread_name_prefix=__name__, max_workers=2
) as query_thread_pool:
all_project_future = query_thread_pool.submit(get_traces_rpc, all_project_request)
Expand Down
8 changes: 0 additions & 8 deletions src/sentry/features/temporary.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,7 @@ def register_temporary_features(manager: FeatureManager) -> None:
manager.add("organizations:performance-transaction-name-only-search", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable the EAP-powered transactions summary view
manager.add("organizations:performance-transaction-summary-eap", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enables the new UI for span summary and the spans tab
manager.add("organizations:performance-spans-new-ui", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
manager.add("organizations:performance-use-metrics", OrganizationFeature, FeatureHandlerStrategy.INTERNAL, api_expose=True)
# Enable standalone cls and lcp in the web vitals module
manager.add("organizations:performance-vitals-standalone-cls-lcp", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable Seer Suggestions for Web Vitals Module
manager.add("organizations:performance-web-vitals-seer-suggestions", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable the warning banner to inform users of pending deprecation of the transactions dataset
Expand Down Expand Up @@ -361,14 +357,10 @@ def register_temporary_features(manager: FeatureManager) -> None:
manager.add("organizations:sentry-app-webhook-requests", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
# Enable standalone span ingestion
manager.add("organizations:standalone-span-ingestion", OrganizationFeature, FeatureHandlerStrategy.INTERNAL, api_expose=False)
# Enable mobile starfish app start module view
manager.add("organizations:starfish-mobile-appstart", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable mobile starfish ui module view
manager.add("organizations:starfish-mobile-ui-module", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable the new experimental starfish view
manager.add("organizations:starfish-view", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable UI for regression issues RCA using spans data
manager.add("organizations:statistical-detectors-rca-spans-only", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Allow organizations to configure all symbol sources.
manager.add("organizations:symbol-sources", OrganizationFeature, FeatureHandlerStrategy.INTERNAL, default=True, api_expose=True)
# Enable static ClickHouse sampling for `OrganizationTagsEndpoint`
Expand Down
5 changes: 3 additions & 2 deletions src/sentry/hybridcloud/tasks/deliver_webhooks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datetime
import logging
from concurrent.futures import ThreadPoolExecutor, as_completed
from concurrent.futures import as_completed

import orjson
import requests
Expand Down Expand Up @@ -35,6 +35,7 @@
from sentry.taskworker.namespaces import hybridcloud_control_tasks
from sentry.types.cell import Cell, get_cell_by_name
from sentry.utils import metrics
from sentry.utils.concurrent import ContextPropagatingThreadPoolExecutor

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -494,7 +495,7 @@ def _run_parallel_delivery_batch(
id__gte=payload.id, mailbox_name=payload.mailbox_name
).order_by("id")

with ThreadPoolExecutor(max_workers=worker_threads) as threadpool:
with ContextPropagatingThreadPoolExecutor(max_workers=worker_threads) as threadpool:
futures = {
threadpool.submit(deliver_message_parallel, record) for record in query[:worker_threads]
}
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/integrations/aws_lambda/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import logging
from collections.abc import Mapping
from concurrent.futures import ThreadPoolExecutor
from typing import TYPE_CHECKING, Any

from botocore.exceptions import ClientError
Expand Down Expand Up @@ -31,6 +30,7 @@
from sentry.silo.base import control_silo_function
from sentry.users.models.user import User
from sentry.users.services.user.serial import serialize_rpc_user
from sentry.utils.concurrent import ContextPropagatingThreadPoolExecutor
from sentry.utils.sdk import capture_exception

from .client import ConfigurationError, gen_aws_client
Expand Down Expand Up @@ -421,7 +421,7 @@ def _enable_lambda(function):
failures = []
success_count = 0

with ThreadPoolExecutor(
with ContextPropagatingThreadPoolExecutor(
max_workers=options.get("aws-lambda.thread-count")
) as _lambda_setup_thread_pool:
# use threading here to parallelize requests
Expand Down
5 changes: 3 additions & 2 deletions src/sentry/integrations/middleware/hybrid_cloud/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import logging
from abc import ABC
from concurrent.futures import ThreadPoolExecutor, as_completed
from concurrent.futures import as_completed
from typing import TYPE_CHECKING, Any, ClassVar

from django.conf import settings
Expand Down Expand Up @@ -33,6 +33,7 @@
from sentry.silo.client import CellSiloClient, SiloClientError
from sentry.types.cell import Cell, find_cells_for_orgs, get_cell_by_name
from sentry.utils import metrics
from sentry.utils.concurrent import ContextPropagatingThreadPoolExecutor
from sentry.utils.options import sample_modulo

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -147,7 +148,7 @@ def get_responses_from_cell_silos(self, cells: list[Cell]) -> dict[str, CellResu

cell_to_response_map = {}

with ThreadPoolExecutor(max_workers=len(cells)) as executor:
with ContextPropagatingThreadPoolExecutor(max_workers=len(cells)) as executor:
future_to_cell = {
executor.submit(self.get_response_from_cell_silo, cell): cell for cell in cells
}
Expand Down
3 changes: 2 additions & 1 deletion src/sentry/integrations/utils/issue_summary_for_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from sentry.seer.autofix.constants import SeerAutomationSource
from sentry.seer.autofix.issue_summary import get_issue_summary
from sentry.seer.autofix.utils import is_seer_scanner_rate_limited
from sentry.utils.concurrent import ContextPropagatingThreadPoolExecutor

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -47,7 +48,7 @@ def fetch_issue_summary(group: Group) -> dict[str, Any] | None:

try:
with sentry_sdk.start_span(op="ai_summary.fetch_issue_summary_for_alert"):
with concurrent.futures.ThreadPoolExecutor() as executor:
with ContextPropagatingThreadPoolExecutor() as executor:
future = executor.submit(
get_issue_summary, group, source=SeerAutomationSource.ALERT
)
Expand Down
Loading
Loading