Skip to content

Commit ea78efa

Browse files
authored
Merge pull request #2496 from RedisInsight/feature/RI-3807_Slowlog_change_ms_to_msec
#RI-3807 - SlowLog - set milliseconds by default
2 parents 6a97a8e + 4396608 commit ea78efa

File tree

20 files changed

+93
-56
lines changed

20 files changed

+93
-56
lines changed

redisinsight/api/src/modules/slow-log/slow-log-analytics.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ export class SlowLogAnalyticsService extends TelemetryBaseService {
3737
TelemetryEvents.SlowlogSetLogSlowerThan,
3838
{
3939
databaseId,
40-
previousValue,
41-
currentValue,
40+
// convert microseconds to milliseconds
41+
previousValueInMSeconds: previousValue / 1_000,
42+
currentValueInMSeconds: currentValue / 1_000,
4243
},
4344
);
4445
}

redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('QueryCardHeader', () => {
5656
})
5757
await waitForEuiToolTipVisible()
5858

59-
expect(screen.getByTestId('execution-time-tooltip')).toHaveTextContent('12 345 678.91 ms')
59+
expect(screen.getByTestId('execution-time-tooltip')).toHaveTextContent('12 345 678.91 msec')
6060
})
6161

6262
it('should render disabled copy button', async () => {

redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ export interface Props {
7676

7777
const getExecutionTimeString = (value: number): string => {
7878
if (value < 1) {
79-
return '0.001 ms'
79+
return '0.001 msec'
8080
}
81-
return `${numberWithSpaces((parseFloat((value / 1000).toFixed(3))))} ms`
81+
return `${numberWithSpaces((parseFloat((value / 1000).toFixed(3))))} msec`
8282
}
8383

8484
const getTruncatedExecutionTimeString = (value: number): string => {
8585
if (value < 1) {
86-
return '0.001 ms'
86+
return '0.001 msec'
8787
}
8888

8989
return truncateMilliseconds(parseFloat((value / 1000).toFixed(3)))

redisinsight/ui/src/constants/durationUnits.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { EuiSuperSelectOption } from '@elastic/eui'
22

33
export enum DurationUnits {
44
microSeconds = 'µs',
5-
milliSeconds = 'ms'
5+
milliSeconds = 'ms',
6+
mSeconds = 'msec',
67
}
78

89
export const DURATION_UNITS: EuiSuperSelectOption<DurationUnits>[] = [
@@ -12,15 +13,15 @@ export const DURATION_UNITS: EuiSuperSelectOption<DurationUnits>[] = [
1213
'data-test-subj': 'unit-micro-second',
1314
},
1415
{
15-
inputDisplay: DurationUnits.milliSeconds,
16+
inputDisplay: 'msec',
1617
value: DurationUnits.milliSeconds,
1718
'data-test-subj': 'unit-milli-second',
1819
},
1920
]
2021

2122
export const MINUS_ONE = -1
2223
export const DEFAULT_SLOWLOG_MAX_LEN = 128
23-
export const DEFAULT_SLOWLOG_SLOWER_THAN = 10_000
24-
export const DEFAULT_SLOWLOG_DURATION_UNIT = DurationUnits.microSeconds
24+
export const DEFAULT_SLOWLOG_SLOWER_THAN = 10
25+
export const DEFAULT_SLOWLOG_DURATION_UNIT = DurationUnits.milliSeconds
2526

2627
export default DURATION_UNITS
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const OAUTH_CLOUD_CAPI_KEYS_DATA = [
2+
{
3+
id: '1',
4+
name: 'RedisInsight-f4868252-a128-4a02-af75-bd3c99898267-2020-11-01T-123',
5+
createdAt: '2023-08-02T09:07:41.680Z',
6+
lastUsed: '2023-08-02T09:07:41.680Z',
7+
valid: true,
8+
}
9+
]

redisinsight/ui/src/mocks/handlers/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import analytics from './analytics'
66
import browser from './browser'
77
import recommendations from './recommendations'
88
import triggeredFunctions from './triggeredFunctions'
9+
import cloud from './oauth'
910

1011
// @ts-ignore
1112
export const handlers: RestHandler<MockedRequest>[] = [].concat(
@@ -16,4 +17,5 @@ export const handlers: RestHandler<MockedRequest>[] = [].concat(
1617
browser,
1718
recommendations,
1819
triggeredFunctions,
20+
cloud,
1921
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { rest, RestHandler } from 'msw'
2+
import { getMswURL } from 'uiSrc/utils/test-utils'
3+
import { ApiEndpoints } from 'uiSrc/constants'
4+
import { OAUTH_CLOUD_CAPI_KEYS_DATA } from 'uiSrc/mocks/data/oauth'
5+
6+
const handlers: RestHandler[] = [
7+
// fetch cloud capi keys
8+
rest.get(
9+
getMswURL(ApiEndpoints.CLOUD_CAPI_KEYS),
10+
async (_req, res, ctx) => res(
11+
ctx.status(200),
12+
ctx.json(OAUTH_CLOUD_CAPI_KEYS_DATA),
13+
)
14+
),
15+
]
16+
17+
export default handlers
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { DefaultBodyType, MockedRequest, RestHandler } from 'msw'
2+
3+
import cloud from './cloud'
4+
5+
const handlers: RestHandler<MockedRequest<DefaultBodyType>>[] = [].concat(cloud)
6+
export default handlers

redisinsight/ui/src/pages/browser/components/stream-details/consumers-view/ConsumersViewWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const ConsumersViewWrapper = (props: Props) => {
138138
},
139139
{
140140
id: 'idle',
141-
label: 'Idle Time, ms',
141+
label: 'Idle Time, msec',
142142
minWidth: 140,
143143
maxWidth: 140,
144144
absoluteWidth: 140,

redisinsight/ui/src/pages/browser/components/stream-details/messages-view/MessageClaimPopover/MessageClaimPopover.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ const MessageClaimPopover = (props: Props) => {
212212
placeholder="0"
213213
className={styles.fieldWithAppend}
214214
value={formik.values.minIdleTime}
215-
append="ms"
215+
append="msec"
216216
onChange={(e: ChangeEvent<HTMLInputElement>) => {
217217
formik.setFieldValue(
218218
e.target.name,
@@ -238,7 +238,7 @@ const MessageClaimPopover = (props: Props) => {
238238
placeholder="0"
239239
className={styles.fieldWithAppend}
240240
value={formik.values.timeCount}
241-
append="ms"
241+
append="msec"
242242
onChange={(e: ChangeEvent<HTMLInputElement>) => {
243243
formik.setFieldValue(
244244
e.target.name,

0 commit comments

Comments
 (0)