feat(perf-detectors): Set default enabled state of perf Detectors based on configuration#109961
feat(perf-detectors): Set default enabled state of perf Detectors based on configuration#109961
Conversation
saponifi3d
left a comment
There was a problem hiding this comment.
i think we should re-think about how we're handling these to reduce the complexity in processing. Rather than us having to worry about "what detectors do we need to execute?" while executing, and instead have that filtering before the evaluation phase.
|
|
||
|
|
||
| @cache | ||
| def get_disabled_platforms_by_wfe_type() -> Mapping[str, frozenset[str]]: |
There was a problem hiding this comment.
nit: the method name makes me think it'd accept a wfe type and filter accordingly.
There was a problem hiding this comment.
agreed, this is a name that mostly makes sense in a different context, but not here. will rename.
| Map WFE detector types to platforms where they should be disabled by default. | ||
| Derives from DEFAULT_DETECTOR_DISABLING_CONFIGS using the detection_enabled_key. |
There was a problem hiding this comment.
i wonder how related these methods are to processing detectors, is there a new directory of file that we should make? should these live in models/detector.py since it's related to fetching? 🤔
There was a problem hiding this comment.
I think they should probably live with performance detectors, near definitions of their Detector-based stuff. .
| detectors[wfe_type] = _ensure_detector(project, wfe_type) | ||
|
|
||
| # Determine initial enabled state based on platform and default settings | ||
| disabled_platforms = disabled_platforms_map.get(wfe_type, frozenset()) |
There was a problem hiding this comment.
should these detectors just be disabled instead? i worry that we're starting to filter / overload how we're selecting what's evaluated -- this is adding quite a bit of complexity to my mental model of how we evaluate detectors.
There was a problem hiding this comment.
key context here:
This is replicating the behavior in
In the case that it is "default detectors aren't necessarily enabled by default" it seems like it'd be something we'd annotate onto Detector definitions probably along with some other defaulting info. We don't have a great place to put that at the moment, so I figured we'd start by just using the primary source of the data now for guaranteed consistency and a clear data path.
This default enabled or not thing is complicated by the "oh, some languages (platforms) really shouldn't have this" which is a sort of manually tacked on thing.
I think ideal structure for this whole defaulting setup might be somehing like:
for detector_spec in DetectorSpecs.all(defaulted=True):
initial_config, default_enabled = spec.default_state_fn(project)
_ensure_detector(detector_spec.slug, initial_config, default_enabled)
although it seems entirely possible that the rules for what is there by default are more nuanced than it makes sense for us to try to shoehorn into something simple.
saponifi3d
left a comment
There was a problem hiding this comment.
i lied -- looks like this is doing it in the ensure / before, and i was just confused with all the processors/detectors.py code living here.
I think we should split out the majority of the ensure_* methods here in another pr, that would really reduce complexity and help out with keeping everything a bit more organized.
5f0a7d1 to
2156492
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Not all Performance Detectors should be enabled at creation time.
For some, it depends on the platform.
This reuses existing configs to ensure newly created performance Detector state matches the legacy behavior.