Skip to content

feat(billing): Seer subscription usage card #91888

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

Closed
wants to merge 15 commits into from

Conversation

jarrettscott
Copy link
Contributor

@jarrettscott jarrettscott commented May 19, 2025

Closes: https://linear.app/getsentry/issue/BIL-547/manage-seer-product-trials-from-the-subscription-page
Closes: https://linear.app/getsentry/issue/BIL-714/create-seer-availability-banner
Closes: https://linear.app/getsentry/issue/BIL-531/detailed-seer-usage
Closes: https://linear.app/getsentry/issue/BIL-536/seer-data-available-for-reserved-usage-chart

Creates a Seer-specific usage card on the subscription page. Combines Autofix and Scanner information into a single usage table.

Screenshot 2025-05-21 at 11 24 33 AM

This PR also supports the standard product trial functionality.

Screenshot 2025-05-21 at 10 16 57 PM Screenshot 2025-05-27 at 9 50 23 AM

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 19, 2025
Copy link

codecov bot commented May 19, 2025

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
10447 2 10445 9
View the top 2 failed test(s) by shortest run time
hasCategoryFeature returns sorted categories with keys
Stack Traces | 0.008s run time
Error: expect(received).toStrictEqual(expected) // deep equality

- Expected  -  0
+ Received  + 20

@@ -117,6 +117,26 @@
        "trueForward": false,
        "usage": 0,
        "usageExceeded": false,
      },
    ],
+   Array [
+     "seerAutofix",
+     Object {
+       "category": "seerScanner",
+       "customPrice": 0,
+       "free": 0,
+       "onDemandBudget": 0,
+       "onDemandQuantity": 0,
+       "onDemandSpendUsed": 0,
+       "order": 13,
+       "paygCpe": 0,
+       "prepaid": 0,
+       "reserved": 0,
+       "sentUsageWarning": false,
+       "softCapType": null,
+       "trueForward": false,
+       "usage": 0,
+       "usageExceeded": false,
+     },
+   ],
  ]
    at Object.<anonymous> (.../gsApp/utils/dataCategory.spec.tsx:138:71)
    at Promise.then.completed (.../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at _runTest (.../jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:121:9)
    at run (.../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../jest-runner/build/testWorker.js:106:12)
hasCategoryFeature returns sorted categories
Stack Traces | 0.022s run time
Error: expect(received).toStrictEqual(expected) // deep equality

- Expected  -  0
+ Received  + 17

@@ -99,6 +99,23 @@
      "softCapType": null,
      "trueForward": false,
      "usage": 0,
      "usageExceeded": false,
    },
+   Object {
+     "category": "seerScanner",
+     "customPrice": 0,
+     "free": 0,
+     "onDemandBudget": 0,
+     "onDemandQuantity": 0,
+     "onDemandSpendUsed": 0,
+     "order": 13,
+     "paygCpe": 0,
+     "prepaid": 0,
+     "reserved": 0,
+     "sentUsageWarning": false,
+     "softCapType": null,
+     "trueForward": false,
+     "usage": 0,
+     "usageExceeded": false,
+   },
  ]
    at Object.<anonymous> (.../gsApp/utils/dataCategory.spec.tsx:101:63)
    at Promise.then.completed (.../jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at _runTest (.../jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../jest-circus/build/run.js:121:9)
    at run (.../jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../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.

@jarrettscott jarrettscott changed the title feat(billing): Display combined Seer usage card feat(billing): Seer subscription usage card May 20, 2025
@jarrettscott jarrettscott marked this pull request as ready for review May 20, 2025 19:57
@jarrettscott jarrettscott requested a review from a team as a code owner May 20, 2025 19:57
Copy link
Member

@brendanhsentry brendanhsentry left a comment

Choose a reason for hiding this comment

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

This doesn't include usage data or on-demand spend for scanner

@brendanhsentry
Copy link
Member

The zero state (no seer purchased) and product trial don't match the figma designs

Copy link
Member

@isabellaenriquez isabellaenriquez left a comment

Choose a reason for hiding this comment

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

if possible, we should move to using availableReservedBudgetTypes; the current implementation is confusing with both seer and DS

@@ -192,24 +192,53 @@ function Overview({location, subscription, promotionData}: Props) {
nonPlanProductTrials?.filter(pt => pt.category === DataCategory.PROFILES).length >
0 || false;

const showAllBudgetTotals = subscription.hadCustomDynamicSampling ? true : false;
const showAllBudgetTotals = subscription.hadCustomDynamicSampling;
Copy link
Member

Choose a reason for hiding this comment

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

This still doesn't include usage data for scanner. We'll need to update this so showAllBudgetTotals is true for all subscriptions that are eligible to Seer. This allows us to combine usage stat totals in the UsageTotals component. Similar to the code snippet below.

{hasReservedBudget &&
subscription.hadCustomDynamicSampling &&
allTotalsByCategory &&
subscription.reservedBudgets?.map(budget =>
Object.entries(budget.categories)
// Filter out the current category since it's already shown from logic above
.filter(([categoryKey]) => categoryKey !== category)
.map(([categoryKey]) => (
<UsageTotalsTable
key={categoryKey}
category={categoryKey as DataCategory}
totals={allTotalsByCategory?.[categoryKey] ?? EMPTY_STAT_TOTAL}
subscription={subscription}
/>
))

Copy link
Member

@isabellaenriquez isabellaenriquez left a comment

Choose a reason for hiding this comment

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

worth noting that this card behavior is strange on self-serve; even if you toggle to Usage mode, it still shows all the Seer info in spend mode

@isabellaenriquez
Copy link
Member

tested locally just now, some places for improvement:

  • the reserved usage chart does not display info for issue fixes and scans
  • the issue scans table does not reflect the real stats (i ingested scans but the table says 0 accepted)
  • the usage card does not breakdown the prepaid nor ondemand usage into the two SKUs
  • the usage card does not reflect the total on-demand usage (i have on-demand usage just for scans but the card says $0)

@jarrettscott
Copy link
Contributor Author

Closing. Refactored into #92450

@jarrettscott jarrettscott deleted the jarrett/seer-subscription-page branch June 2, 2025 06:22
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.

4 participants