Skip to content
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

feat(profile hours): add ui profile hours to overage banners #87300

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions static/gsApp/components/addEventsCTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type EventType =
| 'monitorSeat'
| 'span'
| 'profileDuration'
| 'profileDurationUI'
| 'uptime';

type Props = {
Expand Down
36 changes: 34 additions & 2 deletions static/gsApp/components/gsBanner.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ describe('GSBanner', function () {
attachments: MetricHistoryFixture({usageExceeded: false}),
monitorSeats: MetricHistoryFixture({usageExceeded: false}),
profileDuration: MetricHistoryFixture({usageExceeded: false}),
profileDurationUI: MetricHistoryFixture({usageExceeded: false}),
},
canSelfServe: true,
productTrials: [
Expand Down Expand Up @@ -367,6 +368,7 @@ describe('GSBanner', function () {
attachments: MetricHistoryFixture({usageExceeded: false}),
monitorSeats: MetricHistoryFixture({usageExceeded: false}),
profileDuration: MetricHistoryFixture({usageExceeded: false}),
profileDurationUI: MetricHistoryFixture({usageExceeded: false}),
},
canSelfServe: true,
productTrials: [
Expand Down Expand Up @@ -528,6 +530,7 @@ describe('GSBanner', function () {
attachments: MetricHistoryFixture({sentUsageWarning: false}),
monitorSeats: MetricHistoryFixture({sentUsageWarning: false}),
profileDuration: MetricHistoryFixture({sentUsageWarning: false}),
profileDurationUI: MetricHistoryFixture({sentUsageWarning: false}),
},
canSelfServe: true,
productTrials: [
Expand Down Expand Up @@ -564,8 +567,8 @@ describe('GSBanner', function () {
replays: MetricHistoryFixture({usageExceeded: true}),
attachments: MetricHistoryFixture({sentUsageWarning: false}),
monitorSeats: MetricHistoryFixture({sentUsageWarning: false}),
profileDurationUI: MetricHistoryFixture({sentUsageWarning: false}),
},
canSelfServe: true,
productTrials: [
{
category: 'replays',
Expand Down Expand Up @@ -2112,11 +2115,40 @@ describe('GSBanner', function () {
});
const subscription = SubscriptionFixture({
organization,
plan: 'am1_team',
plan: 'am3_team',
categories: {
errors: MetricHistoryFixture({sentUsageWarning: false}),
spans: MetricHistoryFixture({sentUsageWarning: false}),
profileDuration: MetricHistoryFixture({sentUsageWarning: true}), // Warning sent
profileDurationUI: MetricHistoryFixture({sentUsageWarning: false}),
replays: MetricHistoryFixture({usageExceeded: false}),
attachments: MetricHistoryFixture({sentUsageWarning: false}),
monitorSeats: MetricHistoryFixture({sentUsageWarning: false}),
},
canSelfServe: true,
});
SubscriptionStore.set(organization.slug, subscription);

render(<GSBanner organization={organization} />, {organization});

expect(
await screen.findByRole('button', {name: /increase reserved limits/i})
).toBeInTheDocument();
});

it('shows overage warning banner for profileDurationUI', async function () {
const organization = OrganizationFixture({
access: ['org:billing'],
slug: 'another-slug-1',
});
const subscription = SubscriptionFixture({
organization,
plan: 'am3_team',
categories: {
errors: MetricHistoryFixture({sentUsageWarning: false}),
spans: MetricHistoryFixture({sentUsageWarning: false}),
profileDuration: MetricHistoryFixture({sentUsageWarning: false}),
profileDurationUI: MetricHistoryFixture({sentUsageWarning: true}),
replays: MetricHistoryFixture({usageExceeded: false}),
attachments: MetricHistoryFixture({sentUsageWarning: false}),
monitorSeats: MetricHistoryFixture({sentUsageWarning: false}),
Expand Down
27 changes: 26 additions & 1 deletion static/gsApp/components/gsBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const ALERTS_OFF: Record<EventType, boolean> = {
monitorSeat: false,
span: false,
profileDuration: false,
profileDurationUI: false,
uptime: false,
};

Expand Down Expand Up @@ -319,6 +320,7 @@ class GSBanner extends Component<Props, State> {
monitorSeat: true,
span: true,
profileDuration: true,
profileDurationUI: true,
uptime: true,
},
overageWarningDismissed: {
Expand All @@ -329,6 +331,7 @@ class GSBanner extends Component<Props, State> {
monitorSeat: true,
span: true,
profileDuration: true,
profileDurationUI: true,
uptime: true,
},
productTrialDismissed: {
Expand All @@ -339,6 +342,7 @@ class GSBanner extends Component<Props, State> {
monitorSeat: true,
span: true,
profileDuration: true,
profileDurationUI: true,
uptime: true,
},
};
Expand Down Expand Up @@ -669,6 +673,7 @@ class GSBanner extends Component<Props, State> {
'monitor_seats_overage_alert',
'spans_overage_alert',
'profile_duration_overage_alert',
'profile_duration_ui_overage_alert',
'uptime_overage_alert',

// warning alerts
Expand All @@ -679,6 +684,7 @@ class GSBanner extends Component<Props, State> {
'monitor_seats_warning_alert',
'spans_warning_alert',
'profile_duration_warning_alert',
'profile_duration_ui_warning_alert',
'uptime_warning_alert',

// product trial alerts
Expand All @@ -689,6 +695,7 @@ class GSBanner extends Component<Props, State> {
'monitor_seats_product_trial_alert',
'spans_product_trial_alert',
'profile_duration_product_trial_alert',
'profile_duration_ui_product_trial_alert',
'uptime_product_trial_alert',
],
{
Expand Down Expand Up @@ -731,6 +738,9 @@ class GSBanner extends Component<Props, State> {
profileDuration: promptIsDismissedForBillingPeriod(
checkResults.profile_duration_overage_alert!
),
profileDurationUI: promptIsDismissedForBillingPeriod(
checkResults.profile_duration_ui_overage_alert!
),
uptime: promptIsDismissedForBillingPeriod(checkResults.uptime_overage_alert!),
},
overageWarningDismissed: {
Expand All @@ -749,6 +759,9 @@ class GSBanner extends Component<Props, State> {
profileDuration: promptIsDismissedForBillingPeriod(
checkResults.profile_duration_warning_alert!
),
profileDurationUI: promptIsDismissedForBillingPeriod(
checkResults.profile_duration_ui_warning_alert!
),
uptime: promptIsDismissedForBillingPeriod(checkResults.uptime_warning_alert!),
},

Expand Down Expand Up @@ -781,6 +794,10 @@ class GSBanner extends Component<Props, State> {
checkResults.profile_duration_product_trial_alert!,
subscription
),
profileDurationUI: trialPromptIsDismissed(
checkResults.profile_duration_ui_product_trial_alert!,
subscription
),
uptime: trialPromptIsDismissed(
checkResults.uptime_product_trial_alert!,
subscription
Expand Down Expand Up @@ -820,6 +837,9 @@ class GSBanner extends Component<Props, State> {
profileDuration:
!this.state.overageAlertDismissed.profileDuration &&
!!subscription.categories.profileDuration?.usageExceeded,
profileDurationUI:
!this.state.overageAlertDismissed.profileDurationUI &&
!!subscription.categories.profileDurationUI?.usageExceeded,
uptime:
!this.state.overageAlertDismissed.uptime &&
!!subscription.categories.uptime?.usageExceeded,
Expand Down Expand Up @@ -857,6 +877,9 @@ class GSBanner extends Component<Props, State> {
profileDuration:
!this.state.overageWarningDismissed.profileDuration &&
!!subscription.categories.profileDuration?.sentUsageWarning,
profileDurationUI:
!this.state.overageWarningDismissed.profileDurationUI &&
!!subscription.categories.profileDurationUI?.sentUsageWarning,
uptime:
!this.state.overageWarningDismissed.uptime &&
!!subscription.categories.uptime?.sentUsageWarning,
Expand Down Expand Up @@ -924,6 +947,7 @@ class GSBanner extends Component<Props, State> {
monitorSeat: `monitor_seats_${key}_alert`,
span: `spans_${key}_alert`,
profileDuration: `profile_duration_${key}_alert`,
profileDurationUI: `profile_duration_ui_${key}_alert`,
uptime: `uptime_${key}_alert`,
};

Expand All @@ -942,6 +966,7 @@ class GSBanner extends Component<Props, State> {
monitorSeat: true,
span: true,
profileDuration: true,
profileDurationUI: true,
uptime: true,
};
// Suppress all warnings and alerts
Expand Down Expand Up @@ -1060,7 +1085,7 @@ class GSBanner extends Component<Props, State> {
})}
</ExternalLink>
),
// TODO: Uncomment when we have a continuous profile doc link
// TODO(continuous profiling): Uncomment when we have a continuous profile doc link
// profile: (
// <ExternalLink
// key="profiles"
Expand Down
Loading