kibana/x-pack/plugins/apm
Mikhail Shustov d920682e4e
Update @elastic/elasticsearch to 8.0.0-canary13 (#98266)
* bump @elastic/elasticsearch to canary.7

* address errors in core

* address errors in data plugin

* address errors in Alerting team plugins

* remove outdated messages in Lens

* remove unnecessary comments in ML

* address errors in Observability plugin

* address errors in reporting plugin

* address errors in Rule registry plugin

* fix errors in Security plugins

* fix errors in ES-UI plugin

* remove unnecessary union.

* update core tests

* fix kbn-es-archiver

* update to canary 8

* bump to v9

* use new typings

* fix new errors in core

* fix errors in core typeings

* fix type errors in data plugin

* fix type errors in telemetray plugin

* fix data plugin tests

* fix search examples type error

* fix errors in discover plugin

* fix errors in index_pattern_management

* fix type errors in vis_type_*

* fix errors in typings/elasticsearch

* fix type errors in actions plugin

* fix type errors in alerting and apm plugins

* fix type errors in canvas and cases

* fix errors in event_log

* fix type errors in ILM and ingest_pipelines

* fix errors in lens plugin

* fix errors in lists plugin

* fix errors in logstash

* fix errors in metrics_entities

* fix errors in o11y

* fix errors in watcher

* fix errors in uptime

* fix errors in upgrade_assistant

* fix errors in task_manager

* fix errors in stack_alerts

* fix errors in security_solution

* fix errors in rule_registry

* fix errors in snapshot_restore

* fix remaining errors

* fix search intergration tests

* adjust assetion

* bump version to canary.10

* adapt code to new naming schema

* use mapping types provided by the client library

* Revert "adjust assetion"

This reverts commit 19b8fe0464.

* fix so intergration tests

* fix http integration tests

* bump version to canary 11

* fix login test

* fix http integration test

* fix apm test

* update docs

* fixing some ml types

* fix new errors in data plugin

* fix new errors in alerting plugin

* fix new errors in lists plugin

* fix new errors in reporting

* fix or mute errors in rule_registry plugin

* more ML type fixes

* bump to canary 12

* fix errors after merge conflict

* additional ML fixes

* bump to canary 13

* fix errors in apm plugin

* fix errors in fleet plugin

* fix errors in infra plugin

* fix errors in monitoring plugin

* fix errors in osquery plugin

* fix errors in security solution plugins

* fix errors in transform plugin

* Update type imports for ES

* fix errors in x-pack plugins

* fix errors in tests

* update docs

* fix errors in x-pack/test

* update error description

* fix errors after master merge

* update comment in infra plugin

* fix new errors on xpack tests/

Co-authored-by: James Gowdy <jgowdy@elastic.co>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
2021-06-08 15:06:06 +02:00
..
.storybook Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
common [APM] Add Obs side nav and refactor APM templates (#101044) 2021-06-03 20:59:30 -04:00
dev_docs Converts usage collection README to .mdx (#92982) 2021-03-02 09:40:43 +00:00
e2e [APM] Update ESLint and tsc commands in APM readme (#101207) 2021-06-04 05:27:11 -04:00
ftr_e2e [kbn/test] move types/ftr into src (#99555) 2021-05-17 09:51:53 -07:00
public Updates to APM alert annotations (#101106) 2021-06-08 07:58:06 -05:00
scripts Update @elastic/elasticsearch to 8.0.0-canary13 (#98266) 2021-06-08 15:06:06 +02:00
server Update @elastic/elasticsearch to 8.0.0-canary13 (#98266) 2021-06-08 15:06:06 +02:00
typings [APM] Service overview: Instances table metadata foldout (#96467) 2021-04-20 18:26:58 -04:00
.prettierrc
CONTRIBUTING.md
jest.config.js Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
kibana.json [RAC] Decouple registry from alerts-as-data client (#98935) 2021-05-13 17:12:47 +02:00
readme.md [APM] Update ESLint and tsc commands in APM readme (#101207) 2021-06-04 05:27:11 -04:00
tsconfig.json [RAC] Rule registry plugin (#95903) 2021-04-09 10:35:44 +02:00

Documentation for APM UI developers

Local environment setup

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

Testing

Cypress tests

node x-pack/plugins/apm/scripts/ftr_e2e/cypress_run.js

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

Jest tests

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

Run

npx jest --watch

Update snapshots

npx jest --updateSnapshot

Coverage

HTML coverage report can be found in target/coverage/jest after tests have run.

open target/coverage/jest/index.html

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

API tests are separated in two suites:

  • a basic license test suite
  • a trial license test suite (the equivalent of gold+)

This requires separate test servers and test runners.

Basic

# Start server
node scripts/functional_tests_server --config x-pack/test/apm_api_integration/basic/config.ts

# Run tests
node scripts/functional_test_runner --config x-pack/test/apm_api_integration/basic/config.ts

The API tests for "basic" are located in x-pack/test/apm_api_integration/basic/tests.

Trial

# Start server
node scripts/functional_tests_server --config x-pack/test/apm_api_integration/trial/config.ts

# Run tests
node scripts/functional_test_runner --config x-pack/test/apm_api_integration/trial/config.ts

The API tests for "trial" are located in x-pack/test/apm_api_integration/trial/tests.

API Test tips

  • For debugging access Elasticsearch on http://localhost:9220` (elastic/changeme)
  • To update snapshots append --updateSnapshots to the functional_test_runner command

Linting

Note: Run the following commands from kibana/.

Typescript

node scripts/type_check.js --project x-pack/plugins/apm/tsconfig.json

Prettier

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

ESLint

node scripts/eslint.js x-pack/legacy/plugins/apm

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 _inspect=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?_inspect=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.

Experimental features settings

To set up a flagged feature, add the name of the feature key (apm:myFeature) to commmon/ui_settings_keys.ts and the feature parameters to server/ui_settings.ts.

Test for the feature like:

import { myFeatureEnabled } from '../ui_settings_keys';
if (core.uiSettings.get(myFeatureEnabled)) {
  doStuff();
}

Settings can be managed in Kibana under Stack Management > Advanced Settings > Observability.

Further resources