Commit graph

114 commits

Author SHA1 Message Date
patrykkopycinski cc4c1729d1
Bump jest related packages (#58095) 2020-06-20 21:05:09 +02:00
Chris Roberson e6cf4b36d3
[Monitoring] Ensure we use existing Elasticsearch config (#68389)
* Ensure we use existing Elasticsearch config

* Use separate type for this to ensure custom properties work

* PR suggestions

* PR feedback

* PR feedback

* Fix type issues

* PR feedback
2020-06-15 12:43:37 -04:00
Chris Roberson a1a1d5d2f7
Ensure we query for more than 10 (#67172) 2020-06-02 10:41:04 -04:00
Yuliia Naumenko ce45dad8b6
Changed alerting API endpoints urls, bodies and params to follow Kibana STYLEGUIDE (#66838)
* Changed alerting API endpoints urls, bodies and params to follow Kibana STYLEGUIDE

* Changed alerting REST API to keep the pattern 'alerts/alert/{id}'

* fixed tests

* fixed tests

* Fixed jest tests

* Renamed plugin from alerting to alerts

* fixed tests

* fixed tests

* Fixed alert type check error

* Fixed find api

* fixed type checks

* fixed tests security issues

* Fixed view in app

* -

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-06-01 18:45:36 -07:00
Mikhail Shustov 53b95424fe
Deprecate es API exposed from setup contract (#67596)
* move elasticsearch client under legacy namespace

* update mocks and tests

* update platform code

* update legacy code

* update plugins using elasticsearch setup API

* update request handler context

* update docs

* rename remaining places

* address comments

* fix merge conflict error
2020-06-01 16:16:44 +02:00
restrry bf04235dae apply prettier styles 2020-05-22 09:08:58 +02:00
Yuliia Naumenko 5ed5fda832
Allow registered alert types to be non-editable (#65606)
* Allow registered alert types to be non-editable

* Fixed isUiEditEnabled values

* Fixed due to comments

* fixed failing tests

* Enable alert type selection per alert consumer, only 'alerting' consumer can display other consumers alert types, but in case if it isEditable

* fixed tests

* Removed consumer property from the client side alert type registry and added server side property producer which purpose is to manage a feature logic

* fixed type check

* Fixed tests and type checks

* Removed error message for non registered plugins

* Fixed failing tests

* Fixed due to comments

* fixed test

* -

* revert logic for requiresAppContext

* Added close toast after saving alert
2020-05-12 13:38:22 -07:00
Alejandro Fernández Haro 398b660045
[Fix] Monitoring failing to start (#65516) 2020-05-07 17:53:27 +01:00
Larry Gregory 6a6deef151
Deprecate kibana user in favor of kibana_system user (#63186) 2020-05-05 11:36:40 -04:00
igoristic 59315bc84d
[Monitoring] NP Migration complete client cutover (#62908)
* Final phase before the complete cutover

* NP migration

* lint fix

* More NP stuff

* Moved Stack Monitoring client plugin outside legacy and fixed all tests

* ...

* Removed unused files

* Fix for main links

* Fixed more tests

* Fixed redirect when clicking on SM icon again

* Code review feedback

* Addressed code review feedback

* Fixed return value
2020-04-30 15:59:35 -04:00
Chris Roberson 989245793e
[Monitoring] Fix monitoring 7.7 deprecations (#63738)
* Fix monitoring 7.7 deprecations

* Switch order

* Add comment

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-04-22 09:06:40 -04:00
Alejandro Fernández Haro 9226d4cc94
[Telemetry] Use staging if it's not a distributable release (#63875)
* [Telemetry] Use staging if it's not a distributable release (instead of 'dev' vs. 'prod' approach)

* Rename isProd to isDistributable and useProdKey
2020-04-20 12:43:34 +01:00
igoristic dacc95fa85
[Monitoring] Fixed server response errors (#63181)
* Fixed server response errors

* Fixed async error

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-04-16 20:07:24 -04:00
Gidi Meir Morris bb9f8845ae
[alerting] Adds an alertServices mock and uses it in siem, monitoring and uptime (#63489)
Work on #61313 has revealed that we don't have amock for AlertServices, which creates coupling between us and any solution depending on us, which makes it harder to make changes in our own code.

This PR adds mocks and uses them in SIEM, Monitoring and Uptime, so that we can make future changes without having to change outside solutions.
2020-04-16 08:45:38 +01:00
Larry Gregory 9d89a4fb49
Support multiple reserved feature privileges (#61980)
* support multiple reserved feature privileges

* update reserved privilege ids

* additional testing

* Add ml_user and ml_admin reserved privileges

* prrevent reserved privilege ids from sttarting with 'reserved_'

* address pr feedback: dedicated reserved privilege type

* re-enable ML test suites

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-04-08 13:03:15 -04:00
Alejandro Fernández Haro 028313a8fe
[Telemetry] Add possibility of registering exclusive collectors for each collection (#62665)
* [Telemetry] Add posibility of regitering exclusive collectors for collections

* [Telemetry] Filter unwanted fields from the kibana.os telemetry payload

* Filter the collectors properly in bulkFetch

* Move "kibana" usage collector from Monitoring to OSS Telemetry

* Remove exclusivity of the "kibana_settings" collector

* Unify "kibana_stats" collector from Monitoring and Legacy

* Remove unused legacy constants

* Proper type for UsageCollectionSetup in monitoring

* Missed one undo

* Add unit tests to the migrated collectors

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-04-08 09:08:59 +01:00
Chris Roberson 8ffc08f2f7
[REVERT THE REVERT] [Monitoring] Cluster state watch to Kibana alerting (#62793)
* Revert "Revert "[Monitoring] Cluster state watch to Kibana alerting (#61685)""

This reverts commit f1bd3bdacb.

* Fix i18n error

* Fix test
2020-04-07 13:44:34 -04:00
spalger f1bd3bdacb Revert "[Monitoring] Cluster state watch to Kibana alerting (#61685)"
This reverts commit ab0cc8894a.
2020-04-06 17:05:09 -07:00
Chris Roberson ab0cc8894a
[Monitoring] Cluster state watch to Kibana alerting (#61685)
* WIP

* Add new alert with tests

* Fix type issues, and disable new alerting for tests

* Fix up the view all alerts view

* Turn off for merging

* Fix jest test

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-04-06 15:31:01 -04:00
Pierre Gayvallet 468de51153
Add plugin start contract to getStartServices return value (#61216)
* add plugin own contract as third element of getStartServices result

* adapt plugins code

* update tests

* revert unknown to use void again

* update generated doc

* fix UT

* update mock to allow non-object `pluginStartContract`

* add @typeParam documentation
2020-03-26 10:49:05 +01:00
Tyler Smalley 1bcf848e46
Sets min_doc_count=0 for parent histogram of derivative aggregation (#61390)
From the docs: The specified metric must be numeric and the enclosing
histogram must have min_doc_count set to 0 (default for histogram
aggregations).

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-derivative-aggregation.html#search-aggregations-pipeline-derivative-aggregation

This is now enforced, and currently failing the promotion of the current
Elasticsearch build

Related to https://github.com/elastic/kibana/pull/61387

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2020-03-25 22:22:04 -07:00
Chris Roberson 6c8cc4cf74
Fix issue with no logstash monitoring data in the top end of the time series (#61273) 2020-03-25 13:35:45 -04:00
Chris Roberson 223f774c3f
[Monitoring] Update /api/stats to use core.metrics (#60974)
* Align api/stats with the monitoring logic for kibana ops metrics

* Align collectors

* Add in locale to kibana_settings

* More tweaks

* PR feedback

* PR feedback
2020-03-24 15:53:43 -04:00
Larry Gregory b82cc6ed4a
Support for sub-feature privileges (#60563)
* initial server-side support for sub-feature privileges (#57507)

* initial server-side support for sub-feature privileges

* start addressing PR feedback

* renaming interfaces

* move privilege id collision check to security plugin

* additional testing

* change featurePrivilegeIterator import location

* fix link assertions following rebase from master

* Initial UI support for sub-feature privileges (#59198)

* Initial UI support for sub-feature privileges

* Address PR feedback

* display deleted spaces correctly in the privilege summary

* additional testing

* update snapshot

* Enables sub-feature privileges for gold+ licenses (#59750)

* enables sub-feature privileges for gold+ licenses

* Address PR feedback

* address platform review feedback
2020-03-24 11:12:49 -04:00
Alejandro Fernández Haro 452193fdba
[Telemetry] Server-side Migration to NP (#60485)
* [Telemetry] Migration to NP

* Telemetry management advanced settings section + fix import paths + dropped support for injectVars

* Fix i18nrc paths for telemetry

* Move ui_metric mappings to NP registerType

* Fixed minor test tweaks

* Add README docs (#60443)

* Add missing translation

* Update the telemetryService config only when authenticated

* start method is not a promise anymore

* Fix mocha tests

* No need to JSON.stringify the API responses

* Catch handleOldSettings as we used to do

* Deal with the forbidden use case in the optIn API

* No need to provide the plugin name in the logger.get(). It is automatically scoped + one missing CallCluster vs. APICaller type replacement

* Add empty start method in README.md to show differences with the other approach

* Telemetry collection with X-Pack README

* Docs update

* Allow monitoring collector to send its own ES client

* All collections should provide their own ES client

* PR feedback

* i18n NITs from kibana-platform feedback

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-03-23 18:49:38 +00:00
Chris Roberson 3a396027f6
[Monitoring] Migrate server to NP (#56675)
* First pass

* First pass

* Add new routes

* Getting closer

* Remove legacy server code, and other fixes

* Register the plugin with xpack

* Pass a legacy client to telemetry

* Suport callWithInternalUser

* Remove this

* More NP work

* Fix some tests

* Fix broken test

* Move over new telemetry changes, and fix other issues

* Fix TODO item

* Reuse the same schema as elasticsearch module

* Use a singular config definition here

* Disable this for now

* Use the right method

* Use custom config again

* Tweak the config to make this optional

* Remove these

* Remove these unnecessary files

* Fix jest test

* Fix some linting issues

* Fix type issue

* Fix localization issues

* Use the elasticsearch config

* Remove todos

* Fix this check

* Move kibana alerting over

* PR feedback

* Use new metrics core service

* Change config for xpack_api_polling_frequency_millis

* Make sure this is disabled for now

* Disable both

* Update this to the new function

* Tighten up legacy api needs

* Check for existence

* Fix jest tests

* Cleaning up the plugin definition

* Create custom type in our plugin

* Revert this change

* Fix CI issues

* Add these tests back

* Just use a different collector type

* Handle errors better

* Use custom type

* PR feedback

* Fix type issues

* PR feedback
2020-03-20 14:02:15 -04:00
Court Ewing 7ac8e4d9cc Move x-pack plugins/server/common to x-pack/legacy 2019-06-20 13:34:48 -04:00
Chris Roberson b09e3a622f
[Monitoring] Metricbeat migration flyout and instructions (#35228)
* Initial attempt at a reactor of how this works

* Enter and exiting setup mode with migration buttons working

* Adding monitoring url step back in and some small cleanup

* Elasticsearch steps

* Add missing file

* Better organization here

* Remove this debug logic

* Clean up

* PR feedback

* Add in monospacing

* Persist monitoring url in local storage

* Rework the steps

* Change node to server, and add missing files

* Fix linting issues

* Fix api integration tests

* PR feedback

* Pass down if the product is the "primary" or not, then use that to show certain warnings in the UI (just supported for Kibana right now)

* Elasticsearch migration will work slightly differently in that all nodes must be partially migrated before we can disable internal collection

* More PR feedback

* PR feedback

* Better links

* Fix tests

* This should open in a new tab

* PR feedback

* Design and PR feedback

* Fix these tests

* PR feedback

* Remove debug

* PR feedback

* Update the import path

* Update this import path too

* PR feedback

* Fix i18n
2019-06-14 14:21:53 -04:00
Chris Roberson 25802019ae
[Monitoring] Integrate logs source for Logs UI (#36929)
* Define and use an internal log ui source configuration

* Fix urls in tests

* Remove unnecessary code
2019-06-13 09:28:54 -04:00
Mike Place 6c0f83a515
Minor changes to text on Alerting in Stack Monitoring application (#38388)
* Minor changes to text.

* "Basic" is a proper name, so it should be capatalized.

* Cluster Alerts are plural.

* Fix tests to align with help text changes

* Missed one test file
2019-06-13 14:46:36 +02:00
Ahmad Bamieh c308048f04
[Telemetry] move from xpack main (#35403)
* enabling xpack in new plugins

* move telemetry into separate new platform plugin

* remap constants

* resolved hacks issue

* remove extra dir

* js -> ts

* run linter

* fix tests

* reset kibana.yml

* reset kibana.yml

* ts types

* add telemetry translations to i18n

* use deprecated configs

* checkout config.yml

* fix test

* move telemetry from xpack_main in api_integration

* add telemetry apis

* hide banner

* remove routes/get_stats in favor of collectors/get_stats

* code review fixes
2019-06-12 13:53:48 +03:00
igoristic b75bbd6904
Issue 33025: Fixed CPU calculation for APM (#37230)
* Using the correct property for CPU calc

* Changed the name alias to a more relevant name

* Fixed unit tests
2019-05-30 15:28:02 -04:00
Chris Roberson 34e6c906b1
[Monitoring] Used fixed_interval explicitly for date_histogram aggregations (#37023)
* Used fixed interval explicitly

* Fix tests
2019-05-24 17:28:04 -04:00
Chris Roberson 1a2ec835e8
Remove improper usage (#37099) 2019-05-24 15:36:27 -04:00
Chris Roberson 3da94ccb0d
Once the buffer has any events, the collector is always ready (#36995) 2019-05-24 09:08:38 -04:00
Chris Roberson c87e8811cb
[Monitoring/Telemetry] Force collectors to indicate when they are ready (#36153)
* Initial code to force collectors to indicate when they are ready

* Add and fix tests

* Remove debug

* Add ready check in api call

* Fix prettier complaints

* Return 503 if not all collectors are ready

* PR feedback

* Add retry logic for  usage collection in the reporting tests

* Fix incorrect boomify usage

* Fix more issues with the tests

* Just add debug I guess

* More debug

* Try and handle this exception

* Try and make the tests more defensive and remove console logs

* Retry logic here too

* Debug for the reporting tests failure

* I don't like this, but lets see if it works

* Move the retry logic into the collector set directly

* Add support for this new collector

* Localize this

* This shouldn't be static on the class, but rather static for the entire runtime
2019-05-20 13:03:24 -04:00
igoristic 3d3e071c6e
Fixed default timestamp sort and added tests (#35640)
* Fixed default timestamp sort and added tests

* Removed duplicate functionality

* Fixed unit tests

* Removed debug code

* Update helpers.js
2019-05-03 11:32:28 -04:00
Ahmad Bamieh 27de17abbb
Monitoring telemetry collection interval (#34609)
* Only collect usage data once a day from kibana monitoring

* isUsageCollector

* bulk uploader tests

* linting

* condition filter

* checkout yarn.lock from master

* update mappings for functional tests

* debugging for refactoring

* support legacy mappings

* self code review

* isUsageCollector

* fix mock

* live coding session with pickypg

* self code review

* Update x-pack/plugins/xpack_main/server/lib/telemetry/monitoring/get_high_level_stats.js

Co-Authored-By: Bamieh <ahmadbamieh@gmail.com>

* update mappings
2019-04-27 03:38:05 +03:00
Chris Roberson 33f1123dbe
[Monitoring] Metricbeat migration status logic (#34871)
* Initial logic and tests for this

* Improve test

* Some cleanup and adding api integration tests

* Add comments

* Account for no documents returned

* Add detection logic and tests

* Ensure these fields are optional

* Update detection logic

* Beats, logstash and apm can only possibly exist

* Fix some issues with APM

* Fix tests

* Small updates based on needing to also include the filebeat index

* Fix issue with the reduce

* PR feedback

* More PR feedback

* Add additional tests

* Add additional tests
2019-04-17 09:17:37 -04:00
igoristic 8fde4df6ce
Allow empty and null key types (#35016) 2019-04-16 03:14:41 -07:00
Chris Roberson 6a3aadc9f2
[Monitoring] Introducing Logs UI (#31275)
* Initial implementation

* More logs UI work

* Remove unnecessary code

* Add support to build a logs url based on the cluster and/or node uuid

* Deep link directly

* Update link

* Use CCS to access remote filebeat data

* Fix existing tests

* Add log specific api integration tests

* Localization

* Adding more localization

* Adding unit tests for logs ui

* Client side unit tests, configuration for log fetch count, adding visual callout for why we can't detect logs

* Remove debug

* Fix localization issue

* Update tests

* PR feedback

* Update import

* Format the count to avoid a huge string of numbers

* Use @timestamp instead

* Handle scenario where the time period is not right but the type exists

* Update jest tests

* Update api tests

* Text changes

* Add periods

* Update tests
2019-04-15 08:45:47 -04:00
CJ Cenizal 7a4b3ced60
Update copy to refer to Cross-Cluster Search/Replication. (#33872) 2019-03-27 19:53:19 -07:00
Shaunak Kashyap 2f9ad0a814
Improve performance of the Logstash Pipeline Viewer (#33793)
Resolves #27513.

_This PR is a combination of #31293 (the code changes) + #33570 (test updates). These two PRs were individually reviewed and merged into a feature branch. This combo PR here simply sets up the merge from the feature branch to `master`._

Summary of changes, taken from #31293:

## Before this PR
The Logstash Pipeline Viewer UI would make a single Kibana API call to fetch all the information necessary to render the Logstash pipeline. This included information necessary to render the detail drawer that opens up when a user clicks on an individual vertex in the pipeline.

Naturally, this single API call fetched _a lot_ of data, not just from the Kibana server but also, in turn, from Elasticsearch as well. The "pro" of this approach was that the user would see instantaneous results if they clicked on a vertex in a pipeline and opened the detail drawer for that vertex. The "cons" were the amount of computation Elasticsearch had to perform and the amount of data being transferred over the wire between Elasticsearch and the Kibana server as well as between the Kibana server and the browser.

## With this PR
This PR makes the Kibana API call to fetch data necessary for **initially** rendering the pipeline — that is, with the detail drawer closed — much lighter. When the user clicks on a vertex in a pipeline, a second API call is then made to fetch data necessary for the detail drawer.

## Gains, by the numbers

Based on a simple, 1-input, 1-filter, and 1-output pipeline.

* Before this PR, the Elasticsearch `logstash_stats` API responses (multiple calls were made using the `composite` aggregation over the `date_histogram` aggregation) generated a total of 1228 aggregation buckets (before any `filter_path`s were applied but across all `composite` "pages"). With this PR, the single `logstash_stats` API response (note that this is just for the initial rendering of the pipeline, with the detail drawer closed) generated 12 buckets (also before any `filter_path`s were applied). That's a **99.02% reduction** in number of buckets.

* Before this PR, the Elasticsearch `logstash_stats` API responses added up to 70319 bytes. With this PR, the single `logstash_stats` API response for the same pipeline is 746 bytes. That's a **98.93% reduction** in size.

* Before this PR, the Elasticsearch `logstash_state` API response was 7718 bytes. With this PR, the API response for the same pipeline is 2328 bytes. That's a **69.83% reduction** in size.

* Before this PR the Kibana API response was 51777 bytes. With this PR, the API response for the same pipeline is 2567 bytes (again, note that this is just for the initial rendering of the pipeline, with the detail drawer closed). That's a **95.04% reduction** in size.
2019-03-26 06:27:20 -07:00
Spencer 2e232c2e31
[@kbn/expect] "fork" expect.js into repo (#33761)
* [@kbn/expect] "fork" expect.js into repo

* [eslint] autofix references to expect.js

* [tslint] autofix all expect.js imports

* now that expect.js is in strict mode, avoid reassigning fn.length
2019-03-25 09:56:48 -07:00
Jonathan Budzenski 4d60e86287
[monitoring] only create license check if separate monitoring cluster (#33590) 2019-03-22 10:22:11 -05:00
Daniil Suleiman 748c18b8f4 [types removal] Remove type from bulk_uploader in monitoring (#32315)
* [types removal] Remove type from bulk_uploader in monitoring

* Remove type from get_settings_collector

* Revert changes
2019-03-05 12:52:32 +03:00
Mike Place 4e9b7ef112
Minor change to stack monitoring tooltips (#31855)
* Minor change to stack monitoring tooltips

In the Linux documentation and source code, cgroups are always referred to without
capitalization and should be here as well.

* Update Jest snapshots

* Update more test fixtures
2019-03-04 20:45:23 +00:00
Spencer 369bef316a
[eslint] require final newline (#32265)
We have had `insert_final_newline = true` in our `.editorconfig` file since April 2015, but never validated it with eslint. I'm a little tired of extra changes showing up in PRs because some people use editors which respect the `.editorconfig` file and some don't, so I figured we might want to enable the rule in eslint so that the can be autofixed.

Votes requested please :)
2019-02-28 18:01:29 -08:00
Aleh Zasypkin 0835cd30ca
Introduce Elasticsearch service. (#28344) 2019-02-28 17:22:07 +02:00
Jonathan Budzenski 8ef0ea7fab
[monitoring] only start bulk uploader once (#31307) 2019-02-21 11:28:01 -06:00