Skip to content

Commit

Permalink
Merge branch 'master' of github.com:getsentry/sentry into egou/feat/q…
Browse files Browse the repository at this point in the history
…ueues-module-table-sorting
  • Loading branch information
edwardgou-sentry committed May 14, 2024
2 parents ee00369 + 2ecee6e commit dac4924
Show file tree
Hide file tree
Showing 295 changed files with 4,969 additions and 3,796 deletions.
30 changes: 26 additions & 4 deletions .github/workflows/openapi-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ jobs:
timeout-minutes: 90
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
# Avoid codecov error message related to SHA resolution:
# https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
fetch-depth: '2'

- name: Check for python file changes
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
Expand Down Expand Up @@ -58,3 +54,29 @@ jobs:
if: steps.changes.outputs.api_docs == 'true'
run: |
npx json-diff@0.5.4 --color sentry-api-schema/openapi-derefed.json tests/apidocs/openapi-derefed.json
# Do RPC compatibility checks. Combined with public API audits
# to avoid workflow/job setup overhead.
- name: Dump RPC schema for new version
id: newschema
if: steps.changes.outputs.api_docs == 'true'
run: |
mkdir schemas
sentry rpcschema --partial > schemas/new_schema.json
- name: Dump RPC schema for master
id: oldschema
if: steps.changes.outputs.api_docs == 'true'
run: |
git fetch origin
git switch master
sentry rpcschema --partial > schemas/old_schema.json
- name: Invoke oasdiff on RPC schemas
uses: oasdiff/oasdiff-action/breaking@fc826b9f0d21b85b085842521c7a8cc445412c08 # v0.0.19
if: steps.changes.outputs.api_docs == 'true'
with:
base: ./schemas/old_schema.json
revision: ./schemas/new_schema.json
format: 'text'
fail-on-diff: true
31 changes: 1 addition & 30 deletions fixtures/backup/model_dependencies/detailed.json
Original file line number Diff line number Diff line change
Expand Up @@ -5650,35 +5650,6 @@
]
]
},
"sentry.sentryfunction": {
"dangling": false,
"foreign_keys": {
"organization": {
"kind": "FlexibleForeignKey",
"model": "sentry.organization",
"nullable": false
}
},
"model": "sentry.sentryfunction",
"relocation_dependencies": [],
"relocation_scope": "Excluded",
"silos": [
"Region"
],
"table_name": "sentry_sentryfunction",
"uniques": [
[
"external_id"
],
[
"organization",
"slug"
],
[
"slug"
]
]
},
"sentry.sentryshot": {
"dangling": false,
"foreign_keys": {
Expand Down Expand Up @@ -6177,4 +6148,4 @@
]
]
}
}
}
5 changes: 1 addition & 4 deletions fixtures/backup/model_dependencies/flat.json
Original file line number Diff line number Diff line change
Expand Up @@ -779,9 +779,6 @@
"sentry.apitoken",
"sentry.sentryappinstallation"
],
"sentry.sentryfunction": [
"sentry.organization"
],
"sentry.sentryshot": [
"sentry.organization"
],
Expand Down Expand Up @@ -848,4 +845,4 @@
"social_auth.usersocialauth": [
"sentry.user"
]
}
}
3 changes: 1 addition & 2 deletions fixtures/backup/model_dependencies/sorted.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"sentry.repositoryprojectpathconfig",
"sentry.reprocessingreport",
"sentry.scheduleddeletion",
"sentry.sentryfunction",
"sentry.sentryshot",
"sentry.stringindexer",
"sentry.team",
Expand Down Expand Up @@ -229,4 +228,4 @@
"sentry.incidentseen",
"sentry.incidentproject",
"sentry.incidentactivity"
]
]
3 changes: 1 addition & 2 deletions fixtures/backup/model_dependencies/truncate.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"sentry_repositoryprojectpathconfig",
"sentry_reprocessingreport",
"sentry_scheduleddeletion",
"sentry_sentryfunction",
"sentry_sentryshot",
"sentry_stringindexer",
"sentry_team",
Expand Down Expand Up @@ -229,4 +228,4 @@
"sentry_incidentseen",
"sentry_incidentproject",
"sentry_incidentactivity"
]
]
4 changes: 1 addition & 3 deletions fixtures/page_objects/issue_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ def assign_to(self, user):
assignee.find_element(by=By.TAG_NAME, value="input").send_keys(user)

# Click the member/team
options = assignee.find_elements(
by=By.CSS_SELECTOR, value='[data-test-id="assignee-option"]'
)
options = assignee.find_elements(by=By.CSS_SELECTOR, value='[role="option"]')
assert len(options) > 0, "No assignees could be found."
options[0].click()

Expand Down
7 changes: 4 additions & 3 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ const config: Config.InitialOptions = {
*/
clearMocks: true,

testEnvironment: 'jsdom',
// To disable the sentry jest integration, set this to 'jsdom'
testEnvironment: '@sentry/jest-environment/jsdom',
testEnvironmentOptions: {
sentryConfig: {
init: {
Expand All @@ -284,8 +285,8 @@ const config: Config.InitialOptions = {
: false,
// Use production env to reduce sampling of commits on master
environment: CI ? (IS_MASTER_BRANCH ? 'ci:master' : 'ci:pull_request') : 'local',
tracesSampleRate: CI ? 1 : 0.5,
profilesSampleRate: CI ? 0.1 : 0,
tracesSampleRate: CI ? 0.75 : 0,
profilesSampleRate: 0,
transportOptions: {keepAlive: true},
},
transactionOptions: {
Expand Down
2 changes: 1 addition & 1 deletion migrations_lockfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ feedback: 0004_index_together
hybridcloud: 0016_add_control_cacheversion
nodestore: 0002_nodestore_no_dictfield
replays: 0004_index_together
sentry: 0720_remove_actor_columns
sentry: 0722_drop_sentryfunctions
social_auth: 0002_default_auto_field
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@types/diff": "5.0.2",
"@types/dompurify": "^3.0.5",
"@types/invariant": "^2.2.35",
"@types/jest": "^29.5.3",
"@types/jest": "29.5.12",
"@types/js-beautify": "^1.14.3",
"@types/js-cookie": "^3.0.2",
"@types/lodash": "^4.14.182",
Expand Down Expand Up @@ -177,25 +177,24 @@
"@biomejs/biome": "^1.7.0",
"@codecov/webpack-plugin": "^0.0.1-beta.6",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
"@sentry/jest-environment": "^4.0.0",
"@sentry/jest-environment": "6.0.0",
"@sentry/profiling-node": "^8.0.0",
"@styled/typescript-styled-plugin": "^1.0.1",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/jest-dom": "6.4.5",
"@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^14.5.2",
"@types/node": "^20.11.7",
"babel-gettext-extractor": "^4.1.3",
"babel-jest": "^29.6.2",
"babel-jest": "29.7.0",
"benchmark": "^2.1.4",
"eslint": "8.57.0",
"eslint-config-sentry-app": "2.7.0",
"html-webpack-plugin": "^5.5.0",
"jest": "29.6.2",
"jest": "29.7.0",
"jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "^29.6.2",
"jest-fail-on-console": "^3.1.1",
"jest-environment-jsdom": "29.7.0",
"jest-fail-on-console": "3.3.0",
"jest-junit": "16.0.0",
"jest-sentry-environment": "3.0.0",
"postcss-styled-syntax": "0.6.4",
"react-refresh": "0.14.0",
"stylelint": "16.2.1",
Expand Down
10 changes: 6 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,7 @@ disable_error_code = [
module = [
"sentry.api.endpoints.issues.*",
"sentry.api.helpers.source_map_helper",
"sentry.buffer.base",
"sentry.buffer.redis",
"sentry.buffer.*",
"sentry.build.*",
"sentry.eventstore.reprocessing.redis",
"sentry.hybridcloud",
Expand Down Expand Up @@ -596,6 +595,7 @@ module = [
"sentry.llm.*",
"sentry.mediators.sentry_app_installations.installation_notifier",
"sentry.migrations.*",
"sentry.models.eventattachment",
"sentry.nodestore.base",
"sentry.nodestore.bigtable.backend",
"sentry.nodestore.django.backend",
Expand All @@ -617,7 +617,6 @@ module = [
"sentry.services.hybrid_cloud.notifications.*",
"sentry.services.hybrid_cloud.organization_actions.*",
"sentry.services.hybrid_cloud.organization_mapping.*",
"sentry.services.hybrid_cloud.organization_provisioning.*",
"sentry.services.hybrid_cloud.organizationmember_mapping.*",
"sentry.services.hybrid_cloud.orgauthtoken.*",
"sentry.services.hybrid_cloud.pagination",
Expand All @@ -636,7 +635,8 @@ module = [
"sentry.tasks.commit_context",
"sentry.tasks.on_demand_metrics",
"sentry.tasks.reprocessing2",
"sentry.utils.actor",
"sentry.types.actor",
"sentry.types.region",
"sentry.utils.arroyo",
"sentry.utils.assets",
"sentry.utils.audit",
Expand Down Expand Up @@ -699,6 +699,8 @@ module = [
"tests.sentry.relay.config.test_metric_extraction",
"tests.sentry.services.hybrid_cloud.*",
"tests.sentry.tasks.test_on_demand_metrics",
"tests.sentry.types.test_actor",
"tests.sentry.types.test_region",
"tools.*",
]
disallow_any_generics = true
Expand Down
2 changes: 1 addition & 1 deletion requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ sentry-arroyo>=2.16.5
sentry-kafka-schemas>=0.1.81
sentry-ophio==0.2.7
sentry-redis-tools>=0.1.7
sentry-relay>=0.8.60
sentry-relay>=0.8.64
sentry-sdk==2.1.1
snuba-sdk>=2.0.33
simplejson>=3.17.6
Expand Down
3 changes: 2 additions & 1 deletion requirements-dev-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ nodeenv==1.8.0
oauthlib==3.1.0
openai==1.3.5
openapi-core==0.18.2
openapi-pydantic==0.4.0
openapi-schema-validator==0.6.2
openapi-spec-validator==0.7.1
orjson==3.10.0
Expand Down Expand Up @@ -183,7 +184,7 @@ sentry-forked-djangorestframework-stubs==3.15.0.post1
sentry-kafka-schemas==0.1.81
sentry-ophio==0.2.7
sentry-redis-tools==0.1.7
sentry-relay==0.8.60
sentry-relay==0.8.64
sentry-sdk==2.1.1
sentry-usage-accountant==0.0.10
simplejson==3.17.6
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ docker>=6
time-machine>=2.13.0
honcho>=1.1.0
openapi-core>=0.18.2
openapi-pydantic>=0.4.0
pytest>=8
pytest-cov>=4.0.0
pytest-django>=4.8.0
Expand Down
2 changes: 1 addition & 1 deletion requirements-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ sentry-arroyo==2.16.5
sentry-kafka-schemas==0.1.81
sentry-ophio==0.2.7
sentry-redis-tools==0.1.7
sentry-relay==0.8.60
sentry-relay==0.8.64
sentry-sdk==2.1.1
sentry-usage-accountant==0.0.10
simplejson==3.17.6
Expand Down
14 changes: 0 additions & 14 deletions src/sentry/api/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,6 @@ class OrganizationSavedSearchDeletedEvent(analytics.Event):
)


class FunctionTimerEvent(analytics.Event):
type = "function_timer.timed"

attributes = (
analytics.Attribute("function_name"),
analytics.Attribute("duration"),
analytics.Attribute("organization_id"),
analytics.Attribute("project_id"),
analytics.Attribute("group_id", required=False),
analytics.Attribute("frame_abs_path", required=False),
)


class GroupSimilarIssuesEmbeddingsCountEvent(analytics.Event):
type = "group_similar_issues_embeddings.count"

Expand All @@ -48,5 +35,4 @@ class GroupSimilarIssuesEmbeddingsCountEvent(analytics.Event):

analytics.register(OrganizationSavedSearchCreatedEvent)
analytics.register(OrganizationSavedSearchDeletedEvent)
analytics.register(FunctionTimerEvent)
analytics.register(GroupSimilarIssuesEmbeddingsCountEvent)
2 changes: 1 addition & 1 deletion src/sentry/api/endpoints/event_ai_suggested_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def describe_event_for_ai(event, model):
detailed = model.startswith("gpt-4")
data = {}

msg = event.get("message")
msg = event.get("logentry")
if msg:
data["message"] = msg

Expand Down
14 changes: 3 additions & 11 deletions src/sentry/api/endpoints/issues/related_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import region_silo_endpoint
from sentry.api.bases.group import GroupEndpoint
from sentry.issues.related import find_related_issues # To be deprecated
from sentry.issues.related import RELATED_ISSUES_ALGORITHMS
from sentry.models.group import Group
from sentry.types.ratelimit import RateLimit, RateLimitCategory
Expand Down Expand Up @@ -35,13 +34,6 @@ def get(self, request: Request, group: Group) -> Response:
:pparam Group group: the group object
"""
# The type of related issues to retrieve. Can be either `same_root_cause` or `trace_connected`.
related_type = request.query_params.get("type")
related_issues: list[dict[str, str | list[int] | dict[str, str]]] = []

if related_type in RELATED_ISSUES_ALGORITHMS:
data, meta = RELATED_ISSUES_ALGORITHMS[related_type](group)
return Response({"type": related_type, "data": data, "meta": meta})
else:
# XXX: We will be deprecating this approach soon
related_issues = find_related_issues(group)
return Response({"data": [related_set for related_set in related_issues]})
related_type = request.query_params["type"]
data, meta = RELATED_ISSUES_ALGORITHMS[related_type](group)
return Response({"type": related_type, "data": data, "meta": meta})
4 changes: 4 additions & 0 deletions src/sentry/api/endpoints/organization_dashboard_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def delete(self, request: Request, organization, dashboard) -> Response:
if not features.has(EDIT_FEATURE, organization, actor=request.user):
return Response(status=404)

self.check_object_permissions(request, dashboard)

num_dashboards = Dashboard.objects.filter(organization=organization).count()
num_tombstones = DashboardTombstone.objects.filter(organization=organization).count()

Expand Down Expand Up @@ -118,6 +120,8 @@ def put(self, request: Request, organization, dashboard) -> Response:
if not features.has(EDIT_FEATURE, organization, actor=request.user):
return Response(status=404)

self.check_object_permissions(request, dashboard)

tombstone = None
if isinstance(dashboard, dict):
tombstone = dashboard["id"]
Expand Down
Loading

0 comments on commit dac4924

Please sign in to comment.