Skip to content

Commit

Permalink
Added server and runner script
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Mar 1, 2021
1 parent c116477 commit 6c4222f
Show file tree
Hide file tree
Showing 14 changed files with 182 additions and 264 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@
"@elastic/github-checks-reporter": "0.0.20b3",
"@elastic/makelogs": "^6.0.0",
"@elastic/maki": "6.3.0",
"@elastic/synthetics": "0.0.1-alpha.9",
"@elastic/ui-ace": "0.2.3",
"@istanbuljs/schema": "^0.1.2",
"@jest/reporters": "^26.5.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export const schema = Joi.object()
serverEnvVars: Joi.object(),
dataArchive: Joi.string(),
ssl: Joi.boolean().default(false),
skipEsCluster: Joi.boolean(),
})
.default(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ import { setupUsers, DEFAULT_SUPERUSER_PASS } from './auth';

export async function runElasticsearch({ config, options }) {
const { log, esFrom } = options;

const ssl = config.get('esTestCluster.ssl');
const license = config.get('esTestCluster.license');
const esArgs = config.get('esTestCluster.serverArgs');
const esEnvVars = config.get('esTestCluster.serverEnvVars');
const isSecurityEnabled = esArgs.includes('xpack.security.enabled=true');

if (config.get('esTestCluster.skipEsCluster')) {
return;
}
const cluster = createLegacyEsTestCluster({
port: config.get('servers.elasticsearch.port'),
password: isSecurityEnabled
Expand Down
41 changes: 0 additions & 41 deletions x-pack/plugins/apm/common/utils/as_mutable_array.ts

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ interface AggregationParams {
kuery?: string;
setup: ServicesItemsSetup;
searchAggregatedTransactions: boolean;
maxNumServices: number;
}

const MAX_NUMBER_OF_SERVICES = 500;

export async function getServiceTransactionStats({
environment,
kuery,
setup,
searchAggregatedTransactions,
maxNumServices,
}: AggregationParams) {
return withApmSpan('get_service_transaction_stats', async () => {
const { apmEventClient, start, end } = setup;
Expand Down Expand Up @@ -92,7 +92,7 @@ export async function getServiceTransactionStats({
services: {
terms: {
field: SERVICE_NAME,
size: maxNumServices,
size: MAX_NUMBER_OF_SERVICES,
},
aggs: {
transactionType: {
Expand All @@ -104,6 +104,7 @@ export async function getServiceTransactionStats({
environments: {
terms: {
field: SERVICE_ENVIRONMENT,
missing: '',
},
},
sample: {
Expand Down Expand Up @@ -146,9 +147,9 @@ export async function getServiceTransactionStats({
return {
serviceName: bucket.key as string,
transactionType: topTransactionTypeBucket.key as string,
environments: topTransactionTypeBucket.environments.buckets.map(
(environmentBucket) => environmentBucket.key as string
),
environments: topTransactionTypeBucket.environments.buckets
.map((environmentBucket) => environmentBucket.key as string)
.filter(Boolean),
agentName: topTransactionTypeBucket.sample.top[0].metrics[
AGENT_NAME
] as AgentName,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@
*/

import { Logger } from '@kbn/logging';
import { asMutableArray } from '../../../../common/utils/as_mutable_array';
import { joinByKey } from '../../../../common/utils/join_by_key';
import { getServicesProjection } from '../../../projections/services';
import { withApmSpan } from '../../../utils/with_apm_span';
import { Setup, SetupTimeRange } from '../../helpers/setup_request';
import { getHealthStatuses } from './get_health_statuses';
import { getServicesFromMetricDocuments } from './get_services_from_metric_documents';
import { getServiceTransactionStats } from './get_service_transaction_stats';

export type ServicesItemsSetup = Setup & SetupTimeRange;

const MAX_NUMBER_OF_SERVICES = 500;

export async function getServicesItems({
environment,
kuery,
Expand All @@ -35,49 +32,33 @@ export async function getServicesItems({
const params = {
environment,
kuery,
projection: getServicesProjection({
kuery,
setup,
searchAggregatedTransactions,
}),
setup,
searchAggregatedTransactions,
maxNumServices: MAX_NUMBER_OF_SERVICES,
};

const [
transactionStats,
servicesFromMetricDocuments,
healthStatuses,
] = await Promise.all([
const [transactionStats, healthStatuses] = await Promise.all([
getServiceTransactionStats(params),
getServicesFromMetricDocuments(params),
getHealthStatuses(params).catch((err) => {
logger.error(err);
return [];
}),
]);

const foundServiceNames = transactionStats.map(
({ serviceName }) => serviceName
);

const servicesWithOnlyMetricDocuments = servicesFromMetricDocuments.filter(
({ serviceName }) => !foundServiceNames.includes(serviceName)
);

const allServiceNames = foundServiceNames.concat(
servicesWithOnlyMetricDocuments.map(({ serviceName }) => serviceName)
);
const apmServices = transactionStats.map(({ serviceName }) => serviceName);

// make sure to exclude health statuses from services
// that are not found in APM data
const matchedHealthStatuses = healthStatuses.filter(({ serviceName }) =>
allServiceNames.includes(serviceName)
apmServices.includes(serviceName)
);

return joinByKey(
asMutableArray([
...transactionStats,
...servicesWithOnlyMetricDocuments,
...matchedHealthStatuses,
] as const),
'serviceName'
);
const allMetrics = [...transactionStats, ...matchedHealthStatuses];

return joinByKey(allMetrics, 'serviceName');
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class LogStreamEmbeddable extends Embeddable<LogStreamEmbeddableInput> {
}

const startTimestamp = datemathToEpochMillis(this.input.timeRange.from);
const endTimestamp = datemathToEpochMillis(this.input.timeRange.to, 'up');
const endTimestamp = datemathToEpochMillis(this.input.timeRange.to);

if (!startTimestamp || !endTimestamp) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const SyntheticsCallout = () => {
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty
data-test-subj={'uptimeDismissSyntheticsCallout'}
onClick={() => {
if (shouldShow) {
hideSyntheticsCallout();
Expand Down
3 changes: 1 addition & 2 deletions x-pack/test/accessibility/apps/search_profiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const a11y = getService('a11y');
const flyout = getService('flyout');

// FLAKY: https://github.com/elastic/kibana/issues/91939
describe.skip('Accessibility Search Profiler Editor', () => {
describe('Accessibility Search Profiler Editor', () => {
before(async () => {
await PageObjects.common.navigateToApp('searchProfiler');
await a11y.testAppSnapshot();
Expand Down
Loading

0 comments on commit 6c4222f

Please sign in to comment.