Skip to content

Commit

Permalink
Merge branch 'main' of github.com:elastic/kibana into feature/synthet…
Browse files Browse the repository at this point in the history
…ics-monitor-id-hook
  • Loading branch information
shahzad31 committed Nov 14, 2022
2 parents 1d4cac2 + 9fda59f commit 6916334
Show file tree
Hide file tree
Showing 158 changed files with 3,983 additions and 749 deletions.
1 change: 1 addition & 0 deletions packages/kbn-apm-synthtrace/src/lib/apm/apm_fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export type ApmFields = Fields &
'service.name': string;
'service.version': string;
'service.environment': string;
'service.language.name': string;
'service.node.name': string;
'service.runtime.name': string;
'service.runtime.version': string;
Expand Down
41 changes: 29 additions & 12 deletions packages/kbn-apm-synthtrace/src/scenarios/many_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* Side Public License, v 1.
*/

import { random } from 'lodash';
import { flatten, random } from 'lodash';

import { apm, timerange } from '../..';
import { Instance } from '../lib/apm/instance';
import { Scenario } from '../cli/scenario';
import { getLogger } from '../cli/utils/get_common_services';
import { RunOptions } from '../cli/utils/parse_run_cli_flags';
import { ApmFields } from '../lib/apm/apm_fields';
import { Instance } from '../lib/apm/instance';
import { getSynthtraceEnvironment } from '../lib/utils/get_synthtrace_environment';

const ENVIRONMENT = getSynthtraceEnvironment(__filename);
Expand All @@ -24,23 +24,40 @@ const scenario: Scenario<ApmFields> = async (runOptions: RunOptions) => {
const numServices = 500;
const languages = ['go', 'dotnet', 'java', 'python'];
const services = ['web', 'order-processing', 'api-backend', 'proxy'];
const agentVersions: Record<string, string[]> = {
go: ['2.1.0', '2.0.0', '1.15.0', '1.14.0', '1.13.1'],
dotnet: ['1.18.0', '1.17.0', '1.16.1', '1.16.0', '1.15.0'],
java: ['1.34.1', '1.34.0', '1.33.0', '1.32.0', '1.32.0'],
python: ['6.12.0', '6.11.0', '6.10.2', '6.10.1', '6.10.0'],
};

return {
generate: ({ from, to }) => {
const range = timerange(from, to);

const successfulTimestamps = range.ratePerMinute(180);

const instances = [...Array(numServices).keys()].map((index) =>
apm
.service({
name: `${services[index % services.length]}-${
languages[index % languages.length]
}-${index}`,
environment: ENVIRONMENT,
agentName: languages[index % languages.length],
})
.instance(`instance-${index}`)
const instances = flatten(
[...Array(numServices).keys()].map((index) => {
const language = languages[index % languages.length];
const agentLanguageVersions = agentVersions[language];

const numOfInstances = (index % 3) + 1;

return [...Array(numOfInstances).keys()].map((instanceIndex) =>
apm
.service({
name: `${services[index % services.length]}-${language}-${index}`,
environment: ENVIRONMENT,
agentName: language,
})
.instance(`instance-${index}-${instanceIndex}`)
.defaults({
'agent.version': agentLanguageVersions[index % agentLanguageVersions.length],
'service.language.name': language,
})
);
})
);

const urls = ['GET /order/{id}', 'POST /basket/{id}', 'DELETE /basket', 'GET /products'];
Expand Down

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 @@ -8,7 +8,7 @@

import React from 'react';
import { css } from '@emotion/react';
import { EuiButton, EuiProgress, EuiSpacer } from '@elastic/eui';
import { EuiButton, EuiProgress, EuiSpacer, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { GuideId, GuideState } from '../../types';
import { UseCase } from './use_case_card';
Expand Down Expand Up @@ -54,16 +54,18 @@ export interface GuideCardFooterProps {
export const GuideCardFooter = ({ guides, useCase, activateGuide }: GuideCardFooterProps) => {
const guideState = guides.find((guide) => guide.guideId === (useCase as GuideId));
const viewGuideButton = (
<div className="eui-textCenter">
<EuiButton
// Used for FS tracking
data-test-subj={`onboarding--guideCard--view--${useCase}`}
fill
onClick={() => activateGuide(useCase, guideState)}
>
{viewGuideLabel}
</EuiButton>
</div>
<EuiFlexGroup justifyContent="center">
<EuiFlexItem grow={false}>
<EuiButton
// Used for FS tracking
data-test-subj={`onboarding--guideCard--view--${useCase}`}
fill
onClick={() => activateGuide(useCase, guideState)}
>
{viewGuideLabel}
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
);
// guide has not started yet
if (!guideState || guideState.status === 'not_started') {
Expand Down Expand Up @@ -108,16 +110,18 @@ export const GuideCardFooter = ({ guides, useCase, activateGuide }: GuideCardFoo
}}
/>
<EuiSpacer size="l" />
<div className="eui-textCenter">
<EuiButton
// Used for FS tracking
data-test-subj={`onboarding--guideCard--continue--${useCase}`}
fill
onClick={() => activateGuide(useCase, guideState)}
>
{continueGuideLabel}
</EuiButton>
</div>
<EuiFlexGroup justifyContent="center">
<EuiFlexItem grow={false}>
<EuiButton
// Used for FS tracking
data-test-subj={`onboarding--guideCard--continue--${useCase}`}
fill
onClick={() => activateGuide(useCase, guideState)}
>
{continueGuideLabel}
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</>
);
};
8 changes: 4 additions & 4 deletions packages/kbn-health-gateway-server/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @kbn/health-gateway-server

This package runs a small server called the Health Gateway, which exists to query
the status APIs of multiple Kibana instances and return an aggregated result.
This package runs a small server called the Health Gateway, which exists to
check the health of multiple Kibana instances and return an aggregated result.

This is used by the Elastic Cloud infrastructure to run two different Kibana processes
with different `node.roles`: one process for handling UI requests, and one for background
Expand Down Expand Up @@ -70,8 +70,8 @@ above (5605-5606).

Once you have your `gateway.yml` and have started docker-compose, you can run the
server from the `/packages/kbn-health-gateway-server` directory with `yarn start`. Then you should
be able to make requests to the `/api/status` endpoint:
be able to make requests to the `/` endpoint:

```bash
$ curl "https://localhost:3000/api/status"
$ curl "https://localhost:3000/"
```
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ describe('KibanaService', () => {
expect(kibanaStart).toBeUndefined();
});

test('registers /api/status route with the server', async () => {
test('registers / route with the server', async () => {
const kibanaService = new KibanaService({ config, logger });
await kibanaService.start({ server });
expect(server.addRoute).toHaveBeenCalledWith(
expect.objectContaining({
method: 'GET',
path: '/api/status',
path: '/',
})
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import type { IConfigService } from '@kbn/config';
import type { Logger, LoggerFactory } from '@kbn/logging';
import { ServerStart } from '../server';
import { createStatusRoute } from './routes';
import { createRootRoute } from './routes';

interface KibanaServiceStartDependencies {
server: ServerStart;
Expand All @@ -33,7 +33,7 @@ export class KibanaService {
}

async start({ server }: KibanaServiceStartDependencies) {
server.addRoute(createStatusRoute({ config: this.config, log: this.log }));
server.addRoute(createRootRoute({ config: this.config, log: this.log }));
}

stop() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
* Side Public License, v 1.
*/

export { createStatusRoute } from './status';
export { createRootRoute } from './root';
Loading

0 comments on commit 6916334

Please sign in to comment.