Skip to content

feat(aci): Create detector on submit #93380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 16, 2025
Merged

Conversation

scttcper
Copy link
Member

@scttcper scttcper commented Jun 11, 2025

Allows creating new detectors via the ui. Not everything is working yet like resolution threshold.

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 11, 2025
@scttcper scttcper changed the title feat(aci): Allow submitting detector form feat(aci): Create detector on submit Jun 11, 2025
Copy link

codecov bot commented Jun 11, 2025

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
10567 4 10563 9
View the top 3 failed test(s) by shortest run time
PriorityControl allows configuring priority
Stack Traces | 1.05s run time
Error: Unable to find role="button" and name "Low"

Ignored nodes: comments, script, style
...
    at waitForWrapper (.../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../dom/dist/wait-for.js:163:27)
    at .../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../dom/dist/query-helpers.js:86:33
    at Object.<anonymous> (.../form/control/priorityControl.spec.tsx:41:46)
    at Promise.then.completed (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:316:40)
    at _runTest (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:121:9)
    at run (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../sentry/node_modules/.pnpm/[email protected][email protected]..../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../sentry/node_modules/.pnpm/[email protected][email protected]..../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/runTest.js:367:16)
    at runTest (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/testWorker.js:106:12)
PriorityControl allows configuring medium threshold
Stack Traces | 1.06s run time
Error: Unable to find an element by: [data-test-id="priority-control-medium"]

Ignored nodes: comments, script, style
...
    at waitForWrapper (.../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../dom/dist/wait-for.js:163:27)
    at .../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../dom/dist/query-helpers.js:86:33
    at Object.<anonymous> (.../form/control/priorityControl.spec.tsx:69:54)
    at Promise.then.completed (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:316:40)
    at _runTest (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:121:9)
    at run (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../sentry/node_modules/.pnpm/[email protected][email protected]..../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../sentry/node_modules/.pnpm/[email protected][email protected]..../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/runTest.js:367:16)
    at runTest (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/testWorker.js:106:12)
PriorityControl allows configuring high value
Stack Traces | 1.07s run time
Error: Unable to find an element by: [data-test-id="priority-control-high"]

Ignored nodes: comments, script, style
...
    at waitForWrapper (.../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../dom/dist/wait-for.js:163:27)
    at .../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../dom/dist/query-helpers.js:86:33
    at Object.<anonymous> (.../form/control/priorityControl.spec.tsx:86:52)
    at Promise.then.completed (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:316:40)
    at _runTest (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:121:9)
    at run (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../sentry/node_modules/.pnpm/[email protected][email protected]..../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../sentry/node_modules/.pnpm/[email protected][email protected]..../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/runTest.js:367:16)
    at runTest (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/testWorker.js:106:12)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@scttcper scttcper marked this pull request as ready for review June 12, 2025 21:55
@scttcper scttcper requested a review from a team as a code owner June 12, 2025 21:55
Copy link
Contributor

@saponifi3d saponifi3d left a comment

Choose a reason for hiding this comment

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

😅 sorry for so many comments, in future i think it might be easier if the PR is a bit smaller scope. things like introducing the priorityControl then using it in the detector form would make it a bit easier to review.

biggest pieces of feedback would be if we can match the enums a bit better to the server, then you might have an easier time with typing etc and wanting to understand why we are re-mapping the priority level things to a new structure.


return (
<NewDetectorLayout>
<MetricDetectorForm model={model} />
<FullHeightForm
Copy link
Contributor

Choose a reason for hiding this comment

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

is any of this stuff something we should make shared components from?

It seems like we could have a lot of little split out components to me,

        <StyledLayoutHeader>
          <Layout.HeaderContent>
            <NewDetectorBreadcrumbs />
            <Layout.Title>
              <EditableDetectorName />
            </Layout.Title>
          </Layout.HeaderContent>
        </StyledLayoutHeader>

might be a shareable DetectorHeader -- need to find those common components because we'll have so many different detector types. (the other trick is to make them composable to allow for overrides)

Copy link
Member Author

Choose a reason for hiding this comment

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

the thirds layout we're using is the shared layout component for now

/**
* Creates the data source configuration for the detector
*/
function createDataSource(data: MetricDetectorFormData): NewDataSource {
Copy link
Contributor

Choose a reason for hiding this comment

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

should the NewDataSource type be a generic type that we pass in stuff like SnubaDataSource to? that way we could have a generic for anything that's common in the data sources and have a strict typing to snuba for the metric case.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah i've not figured out what that looks like yet. That part of the form isn't built

const eventTypes = ['error'];

return {
queryType: 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
queryType: 0,
queryType: DetectorType.METRIC,

seems like we should drive this through an enum, and something we can access from the form itself.

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'll figure out query type and the enum when we add that part of the form soon

: lowThresholdDirection === 'higher'
? t('higher')
: t('lower')}
{conditionType === 'gt' ? t('higher') : t('lower')}
Copy link
Contributor

Choose a reason for hiding this comment

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

should we cache consistent translations like higher and lower in a constants file?

Copy link
Member Author

Choose a reason for hiding this comment

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

usually ends up not being worth it because of casing and stuff or you want 'higher than' in another file

@@ -1,22 +0,0 @@
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why we're removing this component? it seems like a helpful wrapper component to build more monitors quickly.

Copy link
Member Author

Choose a reason for hiding this comment

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

The layouts were preemptively split out a bit early. Right now they're getting in the way since they're trying to share code between multiple pages that are changing. We'll likely have a single page for edit/new and another for step 1 similar to metric alerts. Right now they don't have a ton in common.

@scttcper scttcper merged commit f0134a0 into master Jun 16, 2025
45 checks passed
@scttcper scttcper deleted the scttcper/submit-detector-form branch June 16, 2025 18:23
billyvg pushed a commit that referenced this pull request Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants