Skip to content

Commit

Permalink
Merge branch 'master' into priscila/alerts/add-query-type-to-analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
priscilawebdev authored Oct 17, 2024
2 parents 235d5c1 + b583563 commit c321daa
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
6 changes: 3 additions & 3 deletions static/app/gettingStartedDocs/android/android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ SentryAndroid.init(context) { options ->
options.isDebug = true
// Currently under experimental options:
options.experimental.sessionReplay.errorSampleRate = 1.0
options.experimental.sessionReplay.onErrorSampleRate = 1.0
options.experimental.sessionReplay.sessionSampleRate = 1.0
}`;

const getReplaySetupSnippetXml = () => `
<meta-data android:name="io.sentry.session-replay.error-sample-rate" android:value="1.0" />
<meta-data android:name="io.sentry.session-replay.on-error-sample-rate" android:value="1.0" />
<meta-data android:name="io.sentry.session-replay.session-sample-rate" android:value="1.0" />`;

const getReplayConfigurationSnippet = () => `
Expand Down Expand Up @@ -434,7 +434,7 @@ const replayOnboarding: OnboardingConfig<PlatformOptions> = {
],
verify: getReplayVerifyStep({
replayOnErrorSampleRateName:
'options\u200b.experimental\u200b.sessionReplay\u200b.errorSampleRate',
'options\u200b.experimental\u200b.sessionReplay\u200b.onErrorSampleRate',
replaySessionSampleRateName:
'options\u200b.experimental\u200b.sessionReplay\u200b.sessionSampleRate',
}),
Expand Down
4 changes: 2 additions & 2 deletions static/app/views/dashboards/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import {
WidgetType,
} from 'sentry/views/dashboards/types';

import ThresholdsHoverWrapper from './widgetBuilder/buildSteps/thresholdsStep/thresholdsHoverWrapper';
import {ThresholdsHoverWrapper} from './widgetBuilder/buildSteps/thresholdsStep/thresholdsHoverWrapper';
import type {ThresholdsConfig} from './widgetBuilder/buildSteps/thresholdsStep/thresholdsStep';
import {ThresholdMaxKeys} from './widgetBuilder/buildSteps/thresholdsStep/thresholdsStep';

Expand Down Expand Up @@ -188,7 +188,7 @@ export function getColoredWidgetIndicator(
}

return (
<ThresholdsHoverWrapper thresholds={thresholds} tableData={tableData}>
<ThresholdsHoverWrapper thresholds={thresholds} type={dataType}>
<CircleIndicator color={color} size={12} />
</ThresholdsHoverWrapper>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,23 @@ import CircleIndicator from 'sentry/components/circleIndicator';
import {Hovercard} from 'sentry/components/hovercard';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {TableDataWithTitle} from 'sentry/utils/discover/discoverQuery';
import theme from 'sentry/utils/theme';

import type {ThresholdsConfig} from './thresholdsStep';

type Props = {
children: React.ReactNode;
tableData: TableDataWithTitle[];
thresholds: ThresholdsConfig;
type?: string;
};

function ThresholdsHoverWrapper({children, thresholds, tableData}: Props) {
export function ThresholdsHoverWrapper({children, thresholds, type}: Props) {
const {
unit,
max_values: {max1, max2},
} = thresholds;
const tableMeta = {...tableData[0].meta};
const fields = Object.keys(tableMeta);
const field = fields[0];
const dataType = tableMeta[field];
const formattedUnit =
unit && (dataType === 'duration' ? `${unit}s` : `/${unit.split('/')[1]}`);
unit && (type === 'duration' ? `${unit}s` : `/${unit.split('/')[1]}`);
const title = unit ? t(`Thresholds in %s`, formattedUnit) : t('Thresholds');

const notSetMsg = t('Not set');
Expand Down Expand Up @@ -87,5 +82,3 @@ const ContextTitle = styled('h6')`
const StyledIndicator = styled(CircleIndicator)`
margin-right: ${space(1)};
`;

export default ThresholdsHoverWrapper;
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ describe('BigNumberWidget', () => {
});

describe('Thresholds', () => {
it('Evaluates the current value against a threshold', () => {
it('Evaluates the current value against a threshold', async () => {
render(
<BigNumberWidget
data={[
Expand All @@ -245,6 +245,9 @@ describe('BigNumberWidget', () => {
);

expect(screen.getByRole('status')).toHaveAttribute('aria-label', 'meh');

await userEvent.hover(screen.getByRole('status'));
expect(await screen.findByText('Thresholds in /second')).toBeInTheDocument();
});

it('Normalizes the units', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from '@emotion/styled';
import type {Polarity} from 'sentry/components/percentChange';

import {normalizeUnit} from '../../utils';
import {ThresholdsHoverWrapper} from '../../widgetBuilder/buildSteps/thresholdsStep/thresholdsHoverWrapper';
import type {Thresholds} from '../common/types';

interface ThresholdsIndicatorProps {
Expand Down Expand Up @@ -39,7 +40,11 @@ export function ThresholdsIndicator({

const colorName = COLOR_NAME_FOR_STATE[state];

return <Circle role="status" aria-label={state} color={theme[colorName]} />;
return (
<ThresholdsHoverWrapper thresholds={thresholds} type={type}>
<Circle role="status" aria-label={state} color={theme[colorName]} />
</ThresholdsHoverWrapper>
);
}

const Circle = styled('div')<{color: string}>`
Expand Down

0 comments on commit c321daa

Please sign in to comment.