Skip to content

Commit

Permalink
[8.10] [Synthetics] Refactor cardinality test runs query (#166608) (#…
Browse files Browse the repository at this point in the history
…167547)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[Synthetics] Refactor cardinality test runs query
(#166608)](#166608)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Shahzad","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-09-26T10:12:24Z","message":"[Synthetics]
Refactor cardinality test runs query
(#166608)","sha":"59c5eb0988c61dfd5f589e656dc4096102eade33","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:uptime","release_note:skip","auto-backport","v8.11.0","v8.10.3"],"number":166608,"url":"https://github.com/elastic/kibana/pull/166608","mergeCommit":{"message":"[Synthetics]
Refactor cardinality test runs query
(#166608)","sha":"59c5eb0988c61dfd5f589e656dc4096102eade33"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/166608","number":166608,"mergeCommit":{"message":"[Synthetics]
Refactor cardinality test runs query
(#166608)","sha":"59c5eb0988c61dfd5f589e656dc4096102eade33"}},{"branch":"8.10","label":"v8.10.3","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
  • Loading branch information
shahzad31 authored Oct 3, 2023
1 parent a6ad364 commit 03439e7
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ export class LensAttributes {
dataType: 'number',
isBucketed: false,
label: label || 'Count of records',
customLabel: true,
operationType: 'count',
scale: 'ratio',
sourceField: RECORDS_FIELD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
PERCENTILE,
ReportTypes,
FORMULA_COLUMN,
RECORDS_FIELD,
} from '../constants';
import {
CLS_LABEL,
Expand Down Expand Up @@ -124,8 +125,8 @@ export function getSyntheticsKPIConfig({ dataView }: ConfigProps): SeriesConfig
},
{
label: 'Total runs',
id: 'monitor.check_group',
field: 'monitor.check_group',
id: 'total_test_runs',
field: RECORDS_FIELD,
columnType: OPERATION_COLUMN,
columnFilters: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ export function getSyntheticsSingleMetricConfig({ dataView }: ConfigProps): Seri
titlePosition: 'bottom',
},
columnType: FORMULA_COLUMN,
formula: "unique_count(monitor.check_group, kql='summary: *')",
format: 'number',
field: RECORDS_FIELD,
columnFilter: { language: 'kuery', query: 'summary: *' },
},
{
id: 'monitor_successful',
Expand All @@ -114,9 +115,9 @@ export function getSyntheticsSingleMetricConfig({ dataView }: ConfigProps): Seri
metricStateOptions: {
titlePosition: 'bottom',
},
columnType: FORMULA_COLUMN,
formula: 'unique_count(monitor.check_group, kql=\'monitor.status: "up"\')',
format: 'number',
field: RECORDS_FIELD,
columnFilter: { language: 'kuery', query: 'summary.down: 0' },
},
{
id: 'monitor_errors',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const sampleAttributeCoreWebVital = {
sourceField: 'user_agent.os.name',
},
'y-axis-column-1': {
customLabel: true,
dataType: 'number',
filter: {
language: 'kuery',
Expand All @@ -67,6 +68,7 @@ export const sampleAttributeCoreWebVital = {
sourceField: RECORDS_FIELD,
},
'y-axis-column-2': {
customLabel: true,
dataType: 'number',
filter: {
language: 'kuery',
Expand All @@ -79,6 +81,7 @@ export const sampleAttributeCoreWebVital = {
sourceField: RECORDS_FIELD,
},
'y-axis-column-layer0-0': {
customLabel: true,
dataType: 'number',
filter: {
language: 'kuery',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const sampleAttributeKpi = {
},
isBucketed: false,
label: 'test-series',
customLabel: true,
operationType: 'count',
scale: 'ratio',
sourceField: RECORDS_FIELD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ export const MonitorTestRunsSparkline = ({ monitorIds }: { monitorIds: string[]
'monitor.id': monitorIds.length > 0 ? monitorIds : ['false-monitor-id'], // Show no data when monitorIds is empty
},
dataType: 'synthetics' as const,
selectedMetricField: 'monitor.check_group',
selectedMetricField: 'total_test_runs',
filters: [],
name: labels.TEST_RUNS_LABEL,
color: theme.eui.euiColorVis1,
operationType: 'unique_count',
operationType: 'count',
},
];
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
5 changes: 0 additions & 5 deletions x-pack/plugins/uptime/server/legacy_uptime/lib/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { DYNAMIC_SETTINGS_DEFAULT_ATTRIBUTES } from '../../constants/settings';
import { DynamicSettingsAttributes } from '../../runtime_types/settings';
import { settingsObjectId, umDynamicSettings } from './saved_objects/uptime_settings';
import { API_URLS } from '../../../common/constants';
import { UptimeServerSetup } from './adapters';

export type { UMServerLibs } from '../uptime_server';

Expand Down Expand Up @@ -287,7 +286,3 @@ export function debugESCall({
}
console.log(`\n`);
}

export const isTestUser = (server: UptimeServerSetup) => {
return server.config.service?.username === 'localKibanaIntegrationTestsUser';
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { KibanaResponse } from '@kbn/core-http-router-server-internal';
import { UMKibanaRouteWrapper } from './types';
import { isTestUser, UptimeEsClient } from '../lib/lib';
import { UptimeEsClient } from '../lib/lib';

export const uptimeRouteWrapper: UMKibanaRouteWrapper = (uptimeRoute, server) => ({
...uptimeRoute,
Expand All @@ -24,7 +24,7 @@ export const uptimeRouteWrapper: UMKibanaRouteWrapper = (uptimeRoute, server) =>
{
request,
uiSettings: coreContext.uiSettings,
isDev: Boolean(server.isDev && !isTestUser(server)),
isDev: Boolean(server.isDev),
}
);

Expand Down

0 comments on commit 03439e7

Please sign in to comment.