kibana/x-pack/plugins/apm
Oliver Gupte 16ba937bae
[APM] Client new platform migration (#64046)
* migrate files from legacy path to new plugin path

* update file paths to reflect migrated files

* move minimal legacy client files back to legacy path in order to run kibana

* Completes the full cutover to the new kibana platform removing all shims and legacy adapters.

* Adds APM to ignored list for casing check.

* - moves public/utils/pickKeys.ts to common/utils/pick_keys.ts
- exposes getTraceUrl as a plugin static export of apm/public and updates import in infra
- fixes FeaturesPluginSetup import in apm/public app
- renames get_apm_index_pattern_titles -> get_apm_index_pattern_title
- getApmIndexPatternTitle is now a synchronous getter function
- removes unused comments and xpack.apm.apmForESDescription i18n translations

* Moves automatic index pattern saved object creation from
plugin start to when the Home screen first renders

* removed unnecessary legacy css imports

* fixed ci issues by:
- moving readOnly badge, and help extension setup to occure only
  when apm app is mounted
- registering saved object types
- also moved createStaticIndexPattern from a react useEffect on the
  APM home screen to when the app is mounted
2020-04-30 13:08:50 -07:00
..
common [APM] Client new platform migration (#64046) 2020-04-30 13:08:50 -07:00
dev_docs [APM] Client new platform migration (#64046) 2020-04-30 13:08:50 -07:00
e2e [APM] Client new platform migration (#64046) 2020-04-30 13:08:50 -07:00
public [APM] Client new platform migration (#64046) 2020-04-30 13:08:50 -07:00
scripts [APM] Client new platform migration (#64046) 2020-04-30 13:08:50 -07:00
server [APM] Client new platform migration (#64046) 2020-04-30 13:08:50 -07:00
typings [APM] Client new platform migration (#64046) 2020-04-30 13:08:50 -07:00
.prettierrc [APM] NP Migration - Moves plugin server files out of legacy (#57532) 2020-02-19 13:43:03 -08:00
CONTRIBUTING.md [APM] Client new platform migration (#64046) 2020-04-30 13:08:50 -07:00
kibana.json [APM] Client new platform migration (#64046) 2020-04-30 13:08:50 -07:00
readme.md [APM] Client new platform migration (#64046) 2020-04-30 13:08:50 -07:00

Documentation for APM UI developers

Setup local environment

Kibana

git clone git@github.com:elastic/kibana.git
cd kibana/
yarn kbn bootstrap
yarn start --no-base-path

APM Server, Elasticsearch and data

To access an elasticsearch instance that has live data you have two options:

A. Connect to Elasticsearch on Cloud (internal devs only)

Find the credentials for the cluster here

B. Start Elastic Stack and APM data generators
git clone git@github.com:elastic/apm-integration-testing.git
cd apm-integration-testing/
./scripts/compose.py start master --all --no-kibana

Docker Compose is required

E2E (Cypress) tests

x-pack/plugins/apm/e2e/run-e2e.sh

Starts Kibana (:5701), APM Server (:8201) and Elasticsearch (:9201). Ingests sample data into Elasticsearch via APM Server and runs the Cypress tests

Unit testing

Note: Run the following commands from kibana/x-pack.

Run unit tests

node scripts/jest.js plugins/apm --watch

Update snapshots

node scripts/jest.js plugins/apm --updateSnapshot

Functional tests

Start server

node scripts/functional_tests_server --config x-pack/test/functional/config.js

Run tests

node scripts/functional_test_runner --config x-pack/test/functional/config.js --grep='APM specs'

APM tests are located in x-pack/test/functional/apps/apm. For debugging access Elasticsearch on http://localhost:9220` (elastic/changeme)

API integration tests

Start server

node scripts/functional_tests_server --config x-pack/test/api_integration/config.js

Run tests

node scripts/functional_test_runner --config x-pack/test/api_integration/config.js --grep='APM specs'

APM tests are located in x-pack/test/api_integration/apis/apm. For debugging access Elasticsearch on http://localhost:9220` (elastic/changeme)

Linting

Note: Run the following commands from kibana/.

Prettier

yarn prettier  "./x-pack/plugins/apm/**/*.{tsx,ts,js}" --write

ESLint

yarn eslint ./x-pack/plugins/apm --fix

Setup default APM users

APM behaves differently depending on which the role and permissions a logged in user has. For testing purposes APM uses 3 custom users:

apm_read_user: Apps: read. Indices: read (apm-*)

apm_write_user: Apps: read/write. Indices: read (apm-*)

kibana_write_user Apps: read/write. Indices: None

To create the users with the correct roles run the following script:

node x-pack/plugins/apm/scripts/setup-kibana-security.js --role-suffix <github-username-or-something-unique>

The users will be created with the password specified in kibana.dev.yml for elasticsearch.password

Debugging Elasticsearch queries

All APM api endpoints accept _debug=true as a query param that will result in the underlying ES query being outputted in the Kibana backend process.

Example: /api/apm/services/my_service?_debug=true

Storybook

Start the Storybook development environment with yarn storybook apm. All files with a .stories.tsx extension will be loaded. You can access the development environment at http://localhost:9001.

Further resources