Skip to content

Commit

Permalink
Merge branch 'master' into vsts-stacktrace-linking
Browse files Browse the repository at this point in the history
  • Loading branch information
leeandher authored Sep 29, 2023
2 parents 348eaa9 + dc0e859 commit 5a1bca5
Show file tree
Hide file tree
Showing 941 changed files with 26,266 additions and 8,400 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
/tests/sentry/sentry_metrics/ @getsentry/owners-snuba
/src/sentry/snuba/metrics/ @getsentry/owners-snuba @getsentry/telemetry-experience
/src/sentry/snuba/metrics/query.py @getsentry/owners-snuba @getsentry/telemetry-experience
/src/sentry/snuba/metrics_layer/ @getsentry/owners-snuba
/src/sentry/search/events/datasets/metrics_layer.py @getsentry/owners-snuba

## Event Ingestion
Expand Down Expand Up @@ -454,6 +455,8 @@ yarn.lock @getsentry/owners-js-de
/static/app/actionCreators/metrics.tsx @getsentry/telemetry-experience
/static/app/actionCreators/metrics.spec.tsx @getsentry/telemetry-experience
/static/app/types/metrics.tsx @getsentry/telemetry-experience

/static/app/gettingStartedDocs/ @getsentry/telemetry-experience
## End of Telemetry Experience


Expand Down
7 changes: 5 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,20 @@ body:
- 'Projects - Project Creation'
- 'Projects - Project Details'
- 'Performance'
- 'Performance - Queries'
- 'Starfish'
- 'Starfish - API'
- 'Starfish - Database'
- 'Starfish - Interactions'
- 'Starfish - Page Loads'
- 'Profiling'
- 'DDM'
- 'Replays'
- 'Crons'
- 'Alerts'
- 'Discover'
- 'Dashboards'
- 'Releases'
- 'User Feedback'
- 'Bug Report'
- 'Stats'
- 'Settings'
- 'Settings - General'
Expand Down
7 changes: 5 additions & 2 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ body:
- 'Projects - Project Creation'
- 'Projects - Project Details'
- 'Performance'
- 'Performance - Queries'
- 'Starfish'
- 'Starfish - API'
- 'Starfish - Database'
- 'Starfish - Interactions'
- 'Starfish - Page Loads'
- 'Profiling'
- 'DDM'
- 'Replays'
- 'Crons'
- 'Alerts'
- 'Discover'
- 'Dashboards'
- 'Releases'
- 'User Feedback'
- 'Bug Report'
- 'Stats'
- 'Settings'
- 'Settings - General'
Expand Down
10 changes: 8 additions & 2 deletions .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,18 @@
color: '8D5494'
- name: 'Product Area: Performance'
color: '8D5494'
- name: 'Product Area: Performance - Queries'
color: '8D5494'
- name: 'Product Area: Starfish'
color: '8D5494'
- name: 'Product Area: Starfish - API'
- name: 'Product Area: Starfish - Interactions'
color: '8D5494'
- name: 'Product Area: Starfish - Database'
- name: 'Product Area: Starfish - Page Loads'
color: '8D5494'
- name: 'Product Area: Profiling'
color: '8D5494'
- name: 'Product Area: DDM'
color: '8D5494'
- name: 'Product Area: Replays'
color: '8D5494'
- name: 'Product Area: Crons'
Expand All @@ -202,6 +206,8 @@
color: '8D5494'
- name: 'Product Area: User Feedback'
color: '8D5494'
- name: 'Product Area: Bug Report'
color: '8D5494'
- name: 'Product Area: Stats'
color: '8D5494'
- name: 'Product Area: Settings'
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/react-to-product-owners-yml-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@ jobs:
with:
python-version: 3.11.3

- name: Get an auth token
id: token
uses: getsentry/action-github-app-token@v2.0.0
with:
app_id: ${{ vars.SENTRY_INTERNAL_APP_ID }}
private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}

- name: React to product-owners.yml changes
shell: bash
env:
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
GITHUB_TOKEN: ${{ secrets.BUMP_SENTRY_TOKEN }}
COMMITTER_NAME: getsentry-bot
COMMITTER_EMAIL: bot@sentry.io
run: ./bin/react-to-product-owners-yml-changes.sh
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ repos:
language: python
files: requirements-.*\.txt$
additional_dependencies: [packaging==21.3]
- id: check-mypy-bypass
name: do not bypass the type checker
entry: '(^# *mypy: *ignore-errors|^# *type: *ignore|\bno_type_check\b)'
language: pygrep
types: [python]
exclude: ^src/sentry/metrics/minimetrics.py$

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.24.1
Expand Down
3 changes: 3 additions & 0 deletions api-docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@
},
"/api/0/organizations/{organization_slug}/scim/v2/Groups": {
"$ref": "paths/scim/team_index.json"
},
"/api/0/organizations/{organization_slug}/spike-protections/": {
"$ref": "paths/projects/spike-protection.json"
}
},
"components": {
Expand Down
6 changes: 3 additions & 3 deletions api-docs/paths/events/project-issues.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
},
"put": {
"tags": ["Events"],
"description": "Bulk mutate various attributes on issues. The list of issues to modify is given through the `id` query parameter. It is repeated for each issue that should be modified.\n\n- For non-status updates, the `id` query parameter is required.\n- For status updates, the `id` query parameter may be omitted\nfor a batch \"update all\" query.\n- An optional `status` query parameter may be used to restrict\nmutations to only events with the given status.\n\nThe following attributes can be modified and are supplied as JSON object in the body:\n\nIf any ids are out of scope this operation will succeed without any data mutation.",
"description": "Bulk mutate various attributes on issues. The list of issues to modify is given through the `id` query parameter. It is repeated for each issue that should be modified.\n\n- For non-status updates, the `id` query parameter is required.\n- For status updates, the `id` query parameter may be omitted\nfor a batch \"update all\" query.\n- An optional `status` query parameter may be used to restrict\nmutations to only events with the given status.\n\nThe following attributes can be modified and are supplied as JSON object in the body:\n\nIf any IDs are out of scope this operation will succeed without any data mutation.",
"operationId": "Bulk Mutate a List of Issues",
"parameters": [
{
Expand Down Expand Up @@ -233,7 +233,7 @@
},
"assignedTo": {
"type": "string",
"description": "The actor id (or username) of the user or team that should be assigned to this issue."
"description": "The actor ID (or username) of the user or team that should be assigned to this issue."
},
"hasSeen": {
"type": "boolean",
Expand Down Expand Up @@ -300,7 +300,7 @@
},
"delete": {
"tags": ["Events"],
"description": "Permanently remove the given issues. The list of issues to modify is given through the `id` query parameter. It is repeated for each issue that should be removed.\n\nOnly queries by 'id' are accepted.\n\nIf any ids are out of scope this operation will succeed without any data mutation.",
"description": "Permanently remove the given issues. The list of issues to modify is given through the `id` query parameter. It is repeated for each issue that should be removed.\n\nOnly queries by 'id' are accepted.\n\nIf any IDs are out of scope this operation will succeed without any data mutation.",
"operationId": "Bulk Remove a List of Issues",
"parameters": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{
"name": "external_issue_id",
"in": "path",
"description": "The id of the external issue.",
"description": "The ID of the external issue.",
"required": true,
"schema": {
"type": "string"
Expand Down
112 changes: 112 additions & 0 deletions api-docs/paths/projects/spike-protection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"post": {
"tags": ["Projects"],
"description": "Enables Spike Protection feature for some of the projects within the organization.",
"operationId": "Enable Spike Protection",
"parameters": [
{
"name": "organization_slug",
"in": "path",
"description": "The slug of the organization the projects belong to",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Django Rest Framework serializer for incoming Spike Protection API payloads",
"properties": {
"projects": {
"description": "Slugs of projects to enable Spike Protection for. Set to `$all` to enable Spike Protection for all the projects in the organization.",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"projects"
]
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Success"
},
"400": {
"description": "Bad Request"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"auth_token": ["project:read", "project:write", "project:admin"]
}
]
},
"delete": {
"tags": ["Projects"],
"description": "Disables Spike Protection feature for some of the projects within the organization.",
"operationId": "Disable Spike Protection",
"parameters": [
{
"name": "organization_slug",
"in": "path",
"description": "The slug of the organization the projects belong to",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Django Rest Framework serializer for incoming Spike Protection API payloads",
"properties": {
"projects": {
"description": "Slugs of projects to disable Spike Protection for. Set to `$all` to disable Spike Protection for all the projects in the organization.",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"projects"
]
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Success"
},
"400": {
"description": "Bad Request"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"auth_token": ["project:read", "project:write", "project:admin"]
}
]
}
}
13 changes: 12 additions & 1 deletion bin/generate-model-dependency-fixtures
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ configure()

import click

from sentry.backup.dependencies import DependenciesJSONEncoder, dependencies, sorted_dependencies
from sentry.backup.dependencies import (
DependenciesJSONEncoder,
dependencies,
get_model_name,
sorted_dependencies,
)
from sentry.testutils.factories import get_fixture_path # noqa

encoder = DependenciesJSONEncoder(
Expand All @@ -31,6 +36,7 @@ def main():
detailed = {str(k): v for k, v in dependencies().items()}
flat = {k: v.flatten() for k, v in detailed.items()}
sorted = sorted_dependencies()
truncate = [dependencies()[get_model_name(m)].table_name for m in sorted_dependencies()]

det_path = get_fixture_path("backup", "model_dependencies", "detailed.json")
with open(det_path, "w+") as fixture:
Expand All @@ -44,6 +50,11 @@ def main():
with open(det_path, "w+") as fixture:
fixture.write(encoder.encode(sorted))

# Print tables in the order one would need to list them for a TRUNCATE statement.
det_path = get_fixture_path("backup", "model_dependencies", "truncate.json")
with open(det_path, "w+") as fixture:
fixture.write(encoder.encode(truncate))

click.echo(
f"\nSuccess! The dependency mapping fixtures at {[det_path, flat_path]} were updated.\n"
)
Expand Down
29 changes: 14 additions & 15 deletions bin/model-dependency-graphviz
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ from string import Template
import click
from django.db import models

from sentry.backup.dependencies import ForeignFieldKind, ModelRelations, dependencies
from sentry.backup.dependencies import ForeignField, ForeignFieldKind, ModelRelations, dependencies

digraph = Template(
"""
Expand Down Expand Up @@ -86,10 +86,10 @@ class NodeColor(Enum):


@unique
class EdgeStyle(Enum):
Hybrid = "[color=green]"
Explicit = "[color=blue]"
Implicit = "[color=red]"
class EdgeColor(Enum):
Hybrid = "color=green"
Explicit = "color=blue"
Implicit = "color=red"


def print_model_node(model: models.base.ModelBase, silo: SiloMode) -> str:
Expand All @@ -113,18 +113,17 @@ def print_edges(mr: ModelRelations) -> str:
return ""

src = mr.model
return "\n ".join([print_edge(src, ff.model, ff.kind) for ff in mr.foreign_keys.values()])
return "\n ".join([print_edge(src, ff.model, ff) for ff in mr.foreign_keys.values()])


def print_edge(
src: models.base.ModelBase, dest: models.base.ModelBase, kind: ForeignFieldKind
) -> str:
style = EdgeStyle.Explicit
if kind == ForeignFieldKind.HybridCloudForeignKey:
style = EdgeStyle.Hybrid
elif kind == ForeignFieldKind.ImplicitForeignKey:
style = EdgeStyle.Implicit
return f""""{src.__name__}":e -> "{dest.__name__}":w {style.value};"""
def print_edge(src: models.base.ModelBase, dest: models.base.ModelBase, field: ForeignField) -> str:
color = EdgeColor.Explicit
if field.kind == ForeignFieldKind.HybridCloudForeignKey:
color = EdgeColor.Hybrid
elif field.kind == ForeignFieldKind.ImplicitForeignKey:
color = EdgeColor.Implicit
style = "dashed" if field.nullable else "solid"
return f""""{src.__name__}":e -> "{dest.__name__}":w [{color.value},style={style}];"""


def get_most_permissive_relocation_scope(mr: ModelRelations) -> RelocationScope:
Expand Down
Loading

0 comments on commit 5a1bca5

Please sign in to comment.