Skip to content

Conversation

@kcons
Copy link
Member

@kcons kcons commented Jan 28, 2026

Extend get_merged_settings with a mode parameter that allows us to maintain current operation ("LEGACY", the default, negligible performance cost), read configs from Detector rows and compare them to legacy config ("COMPARE", not yet suitable for prod use at scale), or actually use configs from Detector rows and not ProjectOption configs ("WFE" mode).

We don't currently have Detector rows for performance issues and the flags aren't enabled, so in practice this isn't yet code that will run, but we'll soon be dual-writing and opting in some test projects.

Resolves ISWF-1922.

@kcons kcons requested a review from cathteng January 28, 2026 01:16
@kcons kcons requested a review from a team as a code owner January 28, 2026 01:16
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 28, 2026
def get_detection_settings(
project_id: int | None = None, organization: Organization | None = None
project: Project | None = None,
organization: Organization | None = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need organization here if we're always fetching org from project.organization?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope!

PERFORMANCE_DETECTOR_CONFIG_MAPPINGS: dict[DetectorType, PerformanceDetectorConfigMapping] = {
DetectorType.SLOW_DB_QUERY: PerformanceDetectorConfigMapping(
settings_key=DetectorType.SLOW_DB_QUERY,
wfe_detector_type="performance_slow_db_query",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use GroupType slugs here instead of hardcoded strings?PerformanceSlowDBQueryGroupType.slug? Not sure if there's a way to force these to specifically be a grouptype slug

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't do that because these are Detector types, not GroupType slugs, and it feels odd to import so much for a few stable constants that are correct mostly by convention.
It's still weird because the Detector types don't actually exist yet and Detector.type is hard to clearly specify, but I clarified comments here and added at test that verifies that they all map to valid GroupTypes.
I think a follow-up change that adds detector_settings will make this all make a bit more sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

3 participants