kibana/x-pack/plugins/uptime
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
..
common [Exploratory view] use synthetics and rum indices settings (#97425) 2021-04-20 22:00:21 +02:00
public Update dependency @elastic/charts to v30 (master) (#101409) 2021-06-08 10:49:31 +02:00
server Update @elastic/elasticsearch to 8.0.0-canary13 (#98266) 2021-06-08 15:06:06 +02:00
jest.config.js
kibana.json [Uptime] Move uptime to new solution nav (#100905) 2021-06-03 15:19:35 +02:00
README.md
tsconfig.json [Uptime] Add Custom Fleet Integration UI (#91584) 2021-04-20 13:33:46 -04:00

Uptime Monitoring

Purpose

The purpose of this plugin is to provide users of Heartbeat more visibility of what's happening in their infrastructure.

Layout

There are three sections to the app, common, public, and server.

common

Contains runtime types types, constants and a few other files.

Notably, we use io-ts/fp-ts functions and types to help provide additional runtime safety for our API requests/responses.

public

We use Redux and associated tools for managing our app state. Components come in the usual connected and presentational varieties.

The lib directory controls bootstrapping code and adapter types.

There is a pages directory; each view gets its own page component.

The principal structure of the app is stored in uptime_app.tsx.

server

The lib directory contains adapters, which are connections to external resources like Kibana Server, Elasticsearch, etc. In addition, it contains domains, which are libraries that provide functionality via adapters.

The requests directory contains functions responsible for querying Elasticsearch and parsing its responses.

There's also a rest_api folder that defines the structure of the RESTful API endpoints.

Testing

Unit tests

Documentation: https://www.elastic.co/guide/en/kibana/current/development-tests.html#_unit_testing

yarn test:jest x-pack/plugins/uptime

Functional tests

In one shell, from ~/kibana/x-pack: node scripts/functional_tests_server.js

In another shell, from ~kibana/x-pack: node ../scripts/functional_test_runner.js --grep="{TEST_NAME}".

API tests

If instead you need to run API tests, start up the test server and then in another shell, from ~kibana/x-pack: node ../scripts/functional_test_runner.js --config test/api_integration/config.ts --grep="{TEST_NAME}".

You can update snapshots by prefixing the runner command with env UPDATE_UPTIME_FIXTURES=1

You can access the functional test server's Kibana at http://localhost:5620/.

You can login with username elastic and password changeme by default.

If you want to freeze a UI or API test you can include an async call like await new Promise(r => setTimeout(r, 1000 * 60)) to freeze the execution for 60 seconds if you need to click around or check things in the state that is loaded.

Running --ssl tests

Some of our tests require there to be an SSL connection between Kibana and Elasticsearch.

We can run these tests like described above, but with some special config.

node scripts/functional_tests_server.js --config=test/functional_with_es_ssl/config.ts

node scripts/functional_test_runner.js --config=test/functional_with_es_ssl/config.ts

Running accessibility tests

We maintain a suite of Accessibility tests (you may see them referred to elsewhere as a11y tests).

These tests render each of our pages and ensure that the inputs and other elements contain the attributes necessary to ensure all users are able to make use of Kibana (for example, users relying on screen readers).

The commands for running these tests are very similar to the other functional tests described above.

From the ~/x-pack directory:

Start the server: node scripts/functional_tests_server --config test/accessibility/config.ts

Run the uptime a11y tests: node scripts/functional_test_runner.js --config test/accessibility/config.ts --grep=uptime