Skip to content

Commit

Permalink
Merge branch 'master' into ogi/feat/on-demand-alerts-chart-fe
Browse files Browse the repository at this point in the history
  • Loading branch information
obostjancic authored Jul 21, 2023
2 parents ddf4a31 + a5bf83a commit c288b63
Show file tree
Hide file tree
Showing 1,056 changed files with 24,452 additions and 8,774 deletions.
26 changes: 0 additions & 26 deletions .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,6 @@
color: '3C74DD'
description: Automatically applied to PRs that change frontend components

# Status for use with stalebot and routing/triage
- name: 'Status: Backlog'
color: '8D5494'
description: stalebot will ignore
- name: 'Status: In Progress'
color: '8D5494'
description: stalebot will ignore
- name: 'Status: Invalid'
color: '8D5494'
description: ''
- name: 'Status: Investigating'
color: '8D5494'
description: ''
- name: 'Status: Needs More Information'
color: '8D5494'
description: stalebot will close after four weeks of inactivity
- name: 'Status: Stale'
color: '8D5494'
description: stalebot will close after another week of inactivity
- name: 'Status: Unrouted'
color: '8D5494'
description: stalebot will close after four weeks of inactivity
- name: 'Status: Untriaged'
color: '8D5494'
description: stalebot will close after four weeks of inactivity

# Issue type
- name: 'Type: Bug'
color: '584774'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ jobs:
fail-fast: false
matrix:
# XXX: When updating this, make sure you also update MATRIX_INSTANCE_TOTAL.
instance: [0, 1, 2, 3, 4, 5]
instance: [0, 1, 2, 3, 4, 5, 6]
pg-version: ['14']

env:
# XXX: `MATRIX_INSTANCE_TOTAL` must be hardcoded to the length of `strategy.matrix.instance`.
# If this increases, make sure to also increase `flags.backend.after_n_builds` in `codecov.yml`.
MATRIX_INSTANCE_TOTAL: 6
MATRIX_INSTANCE_TOTAL: 7

steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Gemfile.lock
*.iml
.pytest_cache/
.vscode/tags
.vscode/bookmarks.json
coverage.xml
junit.xml
*.codestyle.xml
Expand Down
4 changes: 3 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
"recommendations": [
"esbenp.prettier-vscode",
"ms-python.python",
"ms-python.black-formatter",
"dbaeumer.vscode-eslint",
"lextudio.restructuredtext",
"ziyasal.vscode-open-in-github",
"timonwong.shellcheck"
"timonwong.shellcheck",
"tyriar.sort-lines",
]
}
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"django": true,
"env": {
"SENTRY_MODEL_MANIFEST_FILE_PATH": "./model-manifest.json"
}
},
"justMyCode": false
}
]
}
50 changes: 50 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
23.7.0
------

### Escalating Issues V2 (EA) (ongoing)

This is a placeholder milestone for tracking post-v1 work for escalating issues.
See the RFC: https://github.com/getsentry/rfcs/blob/main/text/0078-escalating-issues.md
There's also discussions about escalation in here:
https://github.com/getsentry/sentry/discussions/43039

V2 will focus on moving ongoing issues (upcoming) into the state archived-until-escalating after an issue being in the `ongoing` state for 14 days.


By: @snigdhas (#52360)

### Search Shortcuts (ongoing)

Make common searches more accessible and discoverable for users. [notion page](https://www.notion.so/sentry/Search-Shortcuts-fka-Assignee-Filter-on-Issue-Stream-648954e782d04805bc64f1983e5cbd16?pvs=4)

By: @scttcper (#52414, #52348)

### Various fixes & improvements

- test(hybrid-cloud): Stabilizes sentry app install tests (#53004) by @GabeVillalobos
- ref(saved search): Migrate betterPriority to priority (#52909) by @ceorourke
- ref(sort): Change betterPriority to priority (#52910) by @ceorourke
- feat(crons): Use timeout_at for timed out check-ins (#52570) by @rjo100
- ref(event_manager): Fix typing issues for event_manager (#52974) by @armenzg
- test(backup): Add more model tests (#52923) by @azaslavsky
- fix(replays): fix bin/mock-replays script (#52927) by @michellewzhang
- ref(crons): Change to uuid validator for trace (#52561) by @rjo100
- fix(crons): Properly checks for environment name lengths (#52820) by @rjo100
- feat(grouping): Add metrics for issue merging and unmerging (#52919) by @lobsterkatie
- chore(starfish): Adding referrers to starfish (#52749) by @wmak
- chore(starfish): Add starfish referrers to the backend (#52754) by @wmak
- ref(tsc): usageChart utils to tsx (#52935) by @IanWoodard
- chore(hybrid-cloud): Add tags to debug Identity service (#52997) by @dashed
- feat(starfish): Add unit and types for rates (#52991) by @wmak
- ref(replay): Refactor the "Next Breadcrumb" button to use *Frame types (#52931) by @ryan953
- fix(group-attributes): log metric when post_save.send(update_fields=["status", "subs"]) is called for group (#52996) by @barkbarkimashark
- fix(releases): Use query parameter when switching filters (#52937) by @scttcper
- fix(discord): Change log level from error to info for unauthorized interactions (#52946) by @spalmurray
- ref: fix typing for sentry.models.__init__ (#52992) by @asottile-sentry
- feat(replay): Render the replay currentTime & hoverTime inside the performance waterfall (#52890) by @ryan953
- feat(perf): Hide timing metrics on http (#52993) by @k-fish
- fix(issue-details): Fix react warning (#52907) by @roggenkemper
- fix(hybrid-cloud): Fixes tests for split DB mode app installs using transaction routing and silo annotations (#52932) by @GabeVillalobos

_Plus 434 more_

23.6.2
------

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Additional Use Grant: You may make use of the Licensed Work, provided that you d
error-reporting or application monitoring features of the
Licensed Work.

Change Date: 2026-07-06
Change Date: 2026-07-17

Change License: Apache License, Version 2.0

Expand Down
6 changes: 3 additions & 3 deletions bin/load-mocks
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ from random import randint
from uuid import uuid4

from django.conf import settings
from django.db import IntegrityError, transaction
from django.db import IntegrityError, router, transaction
from django.db.models import F
from django.utils import timezone
from pytz import utc
Expand Down Expand Up @@ -451,7 +451,7 @@ def main(
else CheckInStatus.ERROR,
)

with transaction.atomic():
with transaction.atomic(using=router.db_for_write(Release)):
has_release = Release.objects.filter(
version=sha1(uuid4().bytes).hexdigest(),
organization_id=project.organization_id,
Expand All @@ -474,7 +474,7 @@ def main(
raw_commits = generate_commits(user)

try:
with transaction.atomic():
with transaction.atomic(using=router.db_for_write(Repository)):
repo, _ = Repository.objects.get_or_create(
organization_id=org.id,
provider="integrations:github",
Expand Down
97 changes: 80 additions & 17 deletions bin/mock-replay
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
#!/usr/bin/env python
from io import BytesIO
from zlib import compress

from sentry.runner import configure
from sentry.utils.json import dumps_htmlsafe

configure()
import datetime
import pathlib
import uuid
from datetime import datetime, timedelta

import click
import requests
from django.conf import settings

from sentry.models import File, Organization, Project
from sentry.models import File, Organization, Project, Team
from sentry.replays.models import ReplayRecordingSegment
from sentry.replays.testutils import mock_replay
from sentry.replays.testutils import (
mock_replay,
mock_rrweb_div_helloworld,
mock_segment_click,
mock_segment_console,
mock_segment_fullsnapshot,
mock_segment_init,
mock_segment_nagivation,
mock_segment_rageclick,
)


def store_replay(replay):
Expand All @@ -22,16 +35,53 @@ def store_replay(replay):
assert response.status_code == 200


def create_recording_segment(replay_id, project_id, filename, segment_id):
with open(filename, "rb") as f:
file = File.objects.create(name=filename, type="application/octet-stream")
file.putfile(f)

def create_recording(replay_id, project_id, timestamp):
segments = [
mock_segment_init(timestamp),
mock_segment_fullsnapshot(timestamp, [mock_rrweb_div_helloworld()]),
mock_segment_console(timestamp),
mock_segment_nagivation(timestamp + timedelta(seconds=1), hrefFrom="/", hrefTo="/home/"),
mock_segment_nagivation(
timestamp + timedelta(seconds=2), hrefFrom="/home/", hrefTo="/profile/"
),
mock_segment_rageclick(
timestamp + timedelta(seconds=2),
"nav.app-65yvxw.e1upz5ks6[aria-label='Primary Navigation'] > div.app-1v175cc.e1upz5ks4",
"sidebar-item-performance",
"a",
24,
),
mock_segment_click(
timestamp + timedelta(seconds=2),
"nav.app-65yvxw.e1upz5ks6[aria-label='Primary Navigation'] > div.app-1v175cc.e1upz5ks4",
"sidebar-item-performance",
"a",
),
mock_segment_nagivation(
timestamp + timedelta(seconds=6),
hrefFrom="/profile/",
hrefTo="/performance/",
),
mock_segment_rageclick(
timestamp + timedelta(seconds=6),
"nav.app-65yvxw.e1upz5ks6[aria-label='Primary Navigation'] > div.app-1v175cc.e1upz5ks4",
"sidebar-item-performance",
"a",
24,
),
]
for (segment_id, segment) in enumerate(segments):
store_replay_segments(replay_id, project_id, segment_id, segment)


def store_replay_segments(replay_id: str, project_id: str, segment_id: int, segment):
f = File.objects.create(name="rr:{segment_id}", type="replay.recording")
f.putfile(BytesIO(compress(dumps_htmlsafe(segment).encode())))
ReplayRecordingSegment.objects.create(
replay_id=replay_id.replace("-", ""),
replay_id=replay_id,
project_id=project_id,
segment_id=segment_id,
file_id=file.id,
file_id=f.id,
)


Expand All @@ -41,7 +91,13 @@ def make_filename(filename: str) -> str:


def main():
project_name = "Replay Test"
project_name = "Replay Test Project"

if not settings.SENTRY_FEATURES["organizations:session-replay"]:
click.echo(
'Session Replays is currently turned off! \nTo enable, add the following line to your local sentry.conf.py file: \nSENTRY_FEATURES["organizations:session-replay"] = True'
)
exit()

if settings.SENTRY_SINGLE_ORGANIZATION:
org = Organization.get_default()
Expand All @@ -51,25 +107,32 @@ def main():
org, _ = Organization.objects.get_or_create(slug="default")

click.echo(f" > Mocking project {project_name}")

team, _ = Team.objects.get_or_create(
organization=org, slug="sentry", defaults={"name": "Sentry"}
)

project, _ = Project.objects.get_or_create(
name=project_name,
defaults={
"organization": org,
"flags": Project.flags.has_replays,
},
platform="javascript",
)

project.add_team(team)

replay_id = uuid.uuid4().hex
seq1_timestamp = datetime.datetime.now() - datetime.timedelta(seconds=22)
seq2_timestamp = datetime.datetime.now() - datetime.timedelta(seconds=5)
seq1_timestamp = datetime.now() - timedelta(seconds=15)
seq2_timestamp = datetime.now() - timedelta(seconds=5)

click.echo("Creating Clickhouse entries...")
click.echo("Creating Replay events entries...")
store_replay(mock_replay(seq1_timestamp, project.id, replay_id, segment_id=0))
store_replay(mock_replay(seq2_timestamp, project.id, replay_id, segment_id=1))

click.echo("Creating Postgres entries...")
create_recording_segment(replay_id, project.id, make_filename("rrweb-1658770770892.json"), 0)
create_recording_segment(replay_id, project.id, make_filename("rrweb-1658770772903.json"), 1)
click.echo("Creating Replay recording entries...")
create_recording(replay_id, project.id, seq1_timestamp)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ flags:
- "src/sentry/**/*.py"
carryforward: true
# Do not send any status checks until N coverage reports are uploaded
after_n_builds: 17
after_n_builds: 18

# Read more here: https://docs.codecov.com/docs/pull-request-comments
comment:
Expand Down
48 changes: 28 additions & 20 deletions fixtures/gitlab.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from time import time

from sentry.models import Identity, IdentityProvider, Integration, Repository
from sentry.silo import SiloMode
from sentry.testutils import APITestCase
from sentry.testutils.silo import assume_test_silo_mode

EXTERNAL_ID = "example.gitlab.com:group-x"
WEBHOOK_SECRET = "secret-token-value"
Expand All @@ -13,28 +15,34 @@ class GitLabTestCase(APITestCase):

def setUp(self):
self.login_as(self.user)
self.integration = Integration.objects.create(
provider=self.provider,
name="Example Gitlab",
external_id=EXTERNAL_ID,
metadata={
"instance": "example.gitlab.com",
"base_url": "https://example.gitlab.com",
"domain_name": "example.gitlab.com/group-x",
"verify_ssl": False,
"webhook_secret": WEBHOOK_SECRET,
"group_id": 1,
},
)
identity = Identity.objects.create(
idp=IdentityProvider.objects.create(type=self.provider, config={}),
user=self.user,
external_id="gitlab123",
data={"access_token": "123456789", "created_at": time(), "refresh_token": "0987654321"},
)
self.integration.add_organization(self.organization, self.user, identity.id)
with assume_test_silo_mode(SiloMode.CONTROL):
self.integration = Integration.objects.create(
provider=self.provider,
name="Example Gitlab",
external_id=EXTERNAL_ID,
metadata={
"instance": "example.gitlab.com",
"base_url": "https://example.gitlab.com",
"domain_name": "example.gitlab.com/group-x",
"verify_ssl": False,
"webhook_secret": WEBHOOK_SECRET,
"group_id": 1,
},
)
identity = Identity.objects.create(
idp=IdentityProvider.objects.create(type=self.provider, config={}),
user=self.user,
external_id="gitlab123",
data={
"access_token": "123456789",
"created_at": time(),
"refresh_token": "0987654321",
},
)
self.integration.add_organization(self.organization, self.user, identity.id)
self.installation = self.integration.get_installation(self.organization.id)

@assume_test_silo_mode(SiloMode.REGION)
def create_repo(self, name, external_id=15, url=None, organization_id=None):
instance = self.integration.metadata["instance"]
organization_id = organization_id or self.organization.id
Expand Down
Loading

0 comments on commit c288b63

Please sign in to comment.