Skip to content

Commit

Permalink
Merge branch 'master' into kl_node
Browse files Browse the repository at this point in the history
  • Loading branch information
klboke authored Aug 15, 2024
2 parents e22aea8 + be03c95 commit dc0cc78
Show file tree
Hide file tree
Showing 243 changed files with 4,301 additions and 1,309 deletions.
10 changes: 8 additions & 2 deletions .github/actions/artifacts/do_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ def main():
upload_flags = [
"-t",
input_token,
"--commit-sha",
input_commit_sha,
"--plugin",
"noop",
"--flag",
input_type,
]

if input_commit_sha:
upload_flags += ["--commit-sha", input_commit_sha]

upload_coverage_cmd = [*codecov_base_cmd, "upload-process", *upload_flags]
for file in coverage_files:
upload_coverage_cmd += ["--file", file]
Expand Down Expand Up @@ -85,9 +86,14 @@ def main():
# wait, while showing un-interleaved logs
jobs.append(Popen(tail_args))

return_codes = []

for job in jobs:
job.wait()

if any(return_codes):
raise Exception("Error uploading to codecov")


if __name__ == "__main__":
main()
6 changes: 1 addition & 5 deletions babel.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@ const config: TransformOptions = {
plugins: ['@emotion/babel-plugin', '@babel/plugin-transform-runtime'],
env: {
production: {
plugins: [
['babel-plugin-add-react-displayname'],
'@sentry/babel-plugin-component-annotate',
],
plugins: [['babel-plugin-add-react-displayname']],
},
development: {
plugins: [
'@emotion/babel-plugin',
'@babel/plugin-transform-react-jsx-source',
'@sentry/babel-plugin-component-annotate',
...(process.env.SENTRY_UI_HOT_RELOAD ? ['react-refresh/babel'] : []),
],
},
Expand Down
104 changes: 62 additions & 42 deletions bin/send_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from sentry.sentry_metrics.use_case_id_registry import UseCaseID


def make_counter_payload(use_case, org_id, rand_str):
def make_counter_payload(use_case, org_id, rand_str, sampling_weight=None):
return {
"name": f"c:{use_case}/{use_case}@none",
"tags": {
Expand All @@ -32,11 +32,11 @@ def make_counter_payload(use_case, org_id, rand_str):
"org_id": org_id,
"retention_days": 90,
"project_id": 3,
"sampling_weight": random.uniform(1.0, 24),
**({"sampling_weight": sampling_weight} if sampling_weight else {}),
}


def make_dist_payload(use_case, org_id, rand_str, value_len, b64_encode):
def make_dist_payload(use_case, org_id, rand_str, value_len, b64_encode, sampling_weight=None):
nums = [random.random() for _ in range(value_len)]
return {
"name": f"d:{use_case}/duration@second",
Expand All @@ -63,11 +63,11 @@ def make_dist_payload(use_case, org_id, rand_str, value_len, b64_encode):
"org_id": org_id,
"retention_days": 90,
"project_id": 3,
"sampling_weight": random.uniform(1.0, 24),
**({"sampling_weight": sampling_weight} if sampling_weight else {}),
}


def make_set_payload(use_case, org_id, rand_str, value_len, b64_encode):
def make_set_payload(use_case, org_id, rand_str, value_len, b64_encode, sampling_weight=None):
INT_WIDTH = 4
nums = [random.randint(0, 2048) for _ in range(value_len)]
return {
Expand Down Expand Up @@ -97,11 +97,11 @@ def make_set_payload(use_case, org_id, rand_str, value_len, b64_encode):
"org_id": org_id,
"retention_days": 90,
"project_id": 3,
"sampling_weight": random.uniform(1.0, 24),
**({"sampling_weight": sampling_weight} if sampling_weight else {}),
}


def make_gauge_payload(use_case, org_id, rand_str):
def make_gauge_payload(use_case, org_id, rand_str, sampling_weight):
return {
"name": f"s:{use_case}/error@none",
"tags": {
Expand All @@ -121,26 +121,26 @@ def make_gauge_payload(use_case, org_id, rand_str):
"org_id": org_id,
"retention_days": 90,
"project_id": 3,
"sampling_weight": random.uniform(1.0, 24),
**({"sampling_weight": sampling_weight} if sampling_weight else {}),
}


make_psql = (
lambda rand_str, is_generic: f"""
SELECT string,
organization_id,
{"use_case_id," if is_generic else ""}
date_added,
last_seen
FROM {"sentry_perfstringindexer" if is_generic else "sentry_stringindexer"}
WHERE string ~ 'metric_e2e_.*{rand_str}';
"""
)
def make_psql(rand_str, is_generic):
return f"""
SELECT string,
organization_id,
{"use_case_id," if is_generic else ""}
date_added,
last_seen
FROM {"sentry_perfstringindexer" if is_generic else "sentry_stringindexer"}
WHERE string ~ 'metric_e2e_.*{rand_str}';
"""


make_csql = lambda rand_str, is_generic: "UNION ALL".join(
[
f"""
def make_csql(rand_str, is_generic):
return "UNION ALL".join(
[
f"""
SELECT use_case_id,
org_id,
project_id,
Expand All @@ -151,22 +151,22 @@ def make_gauge_payload(use_case, org_id, rand_str):
FROM {table_name}
WHERE arrayExists(v -> match(v, 'metric_e2e_.*{rand_str}'), tags.raw_value)
"""
for table_name in (
[
"generic_metric_counters_raw_local",
"generic_metric_distributions_raw_local",
"generic_metric_sets_raw_local",
"generic_metric_gauges_raw_local",
]
if is_generic
else [
"metrics_counters_v2_local",
"metrics_distributions_v2_local",
"metrics_sets_v2_local",
]
)
]
)
for table_name in (
[
"generic_metric_counters_raw_local",
"generic_metric_distributions_raw_local",
"generic_metric_sets_raw_local",
"generic_metric_gauges_raw_local",
]
if is_generic
else [
"metrics_counters_v2_local",
"metrics_distributions_v2_local",
"metrics_sets_v2_local",
]
)
]
)


def produce_msgs(messages, is_generic, host, dryrun, quiet):
Expand Down Expand Up @@ -251,6 +251,13 @@ def produce_msgs(messages, is_generic, host, dryrun, quiet):
show_default=True,
help="Encode sets and distribution metrics values in base64",
)
@click.option(
"--sampling-weight",
type=int,
default=None,
show_default=True,
help="Sampling weight for the metrics",
)
def main(
metric_types,
use_cases,
Expand All @@ -263,6 +270,7 @@ def main(
num_bad_msg,
value_len,
b64_encode,
sampling_weight,
):
if UseCaseID.SESSIONS.value in use_cases and len(use_cases) > 1:
click.secho(
Expand All @@ -276,14 +284,26 @@ def main(
metric_types = "".join(set(metric_types))
rand_str = rand_str or "".join(random.choices(string.ascii_uppercase + string.digits, k=8))
payload_generators = {
"c": functools.partial(make_counter_payload, rand_str=rand_str),
"c": functools.partial(
make_counter_payload, rand_str=rand_str, sampling_weight=sampling_weight
),
"d": functools.partial(
make_dist_payload, rand_str=rand_str, value_len=value_len, b64_encode=b64_encode
make_dist_payload,
rand_str=rand_str,
value_len=value_len,
b64_encode=b64_encode,
sampling_weight=sampling_weight,
),
"s": functools.partial(
make_set_payload, rand_str=rand_str, value_len=value_len, b64_encode=b64_encode
make_set_payload,
rand_str=rand_str,
value_len=value_len,
b64_encode=b64_encode,
sampling_weight=sampling_weight,
),
"g": functools.partial(
make_gauge_payload, rand_str=rand_str, sampling_weight=sampling_weight
),
"g": functools.partial(make_gauge_payload, rand_str=rand_str),
}

messages = list(
Expand Down
4 changes: 1 addition & 3 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
"noRestrictedImports": {
"level": "warn",
"options": {
"paths": {
"sentry/types": "Please import directly. For example: import type {Organization} from 'sentry/types/organization'"
}
"paths": {}
}
}
},
Expand Down
22 changes: 22 additions & 0 deletions fixtures/backup/model_dependencies/detailed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2306,6 +2306,28 @@
]
]
},
"sentry.grouphashmetadata": {
"dangling": false,
"foreign_keys": {
"grouphash": {
"kind": "FlexibleForeignKey",
"model": "sentry.grouphash",
"nullable": false
}
},
"model": "sentry.grouphashmetadata",
"relocation_dependencies": [],
"relocation_scope": "Excluded",
"silos": [
"Region"
],
"table_name": "sentry_grouphashmetadata",
"uniques": [
[
"grouphash"
]
]
},
"sentry.grouphistory": {
"dangling": false,
"foreign_keys": {
Expand Down
3 changes: 3 additions & 0 deletions fixtures/backup/model_dependencies/flat.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@
"sentry.grouptombstone",
"sentry.project"
],
"sentry.grouphashmetadata": [
"sentry.grouphash"
],
"sentry.grouphistory": [
"sentry.group",
"sentry.organization",
Expand Down
1 change: 1 addition & 0 deletions fixtures/backup/model_dependencies/sorted.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
"sentry.sentryappinstallationtoken",
"sentry.sentryappinstallationforprovider",
"sentry.incident",
"sentry.grouphashmetadata",
"sentry.dashboardwidgetqueryondemand",
"sentry.alertruletriggerexclusion",
"sentry.alertruletriggeraction",
Expand Down
1 change: 1 addition & 0 deletions fixtures/backup/model_dependencies/truncate.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
"sentry_sentryappinstallationtoken",
"sentry_sentryappinstallationforprovider",
"sentry_incident",
"sentry_grouphashmetadata",
"sentry_dashboardwidgetqueryondemand",
"sentry_alertruletriggerexclusion",
"sentry_alertruletriggeraction",
Expand Down
15 changes: 15 additions & 0 deletions fixtures/integrations/jira/stubs/createmeta_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@
{"id": 10101, "label": "happy"}
]
},
"customfield_10001": {
"required": false,
"schema": {
"type": "team",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:atlassian-team",
"customId": 10001,
"configuration": {
"com.atlassian.jira.plugin.system.customfieldtypes:atlassian-team": true
}
},
"name": "Team",
"key": "customfield_10001",
"hasDefaultValue": false,
"operations": ["set"]
},
"customfield_10300": {
"required": false,
"schema": {
Expand Down
4 changes: 2 additions & 2 deletions migrations_lockfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ hybridcloud: 0016_add_control_cacheversion
nodestore: 0002_nodestore_no_dictfield
remote_subscriptions: 0003_drop_remote_subscription
replays: 0004_index_together
sentry: 0747_create_datasecrecywaiver_table
sentry: 0749_disable_member_invite
social_auth: 0002_default_auto_field
uptime: 0006_projectuptimesubscription_name_owner
uptime: 0007_update_detected_subscription_interval
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
"@sentry-internal/rrweb": "2.25.0",
"@sentry-internal/rrweb-player": "2.25.0",
"@sentry-internal/rrweb-snapshot": "2.25.0",
"@sentry/babel-plugin-component-annotate": "^2.16.1",
"@sentry/core": "^8.24.0",
"@sentry/node": "^8.24.0",
"@sentry/react": "^8.24.0",
"@sentry/release-parser": "^1.3.1",
"@sentry/status-page-list": "^0.3.0",
"@sentry/types": "^8.24.0",
"@sentry/utils": "^8.24.0",
"@sentry/webpack-plugin": "^2.22.2",
"@spotlightjs/spotlight": "^2.0.0-alpha.1",
"@tanstack/react-query": "^4.29.7",
"@tanstack/react-query-devtools": "^4.36.1",
Expand Down Expand Up @@ -263,9 +263,7 @@
"last 3 iOS major versions",
"Firefox ESR"
],
"test": [
"current node"
]
"test": ["current node"]
},
"volta": {
"extends": ".volta.json"
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ module = [
"sentry.api.endpoints.organization_sessions",
"sentry.api.endpoints.organization_stats",
"sentry.api.endpoints.organization_teams",
"sentry.api.endpoints.project_artifact_bundle_file_details",
"sentry.api.endpoints.project_group_index",
"sentry.api.endpoints.project_index",
"sentry.api.endpoints.project_ownership",
Expand Down
Loading

0 comments on commit dc0cc78

Please sign in to comment.