Skip to content

Commit

Permalink
[Custom threshold] Add dev documentation (elastic#177484)
Browse files Browse the repository at this point in the history
## Summary

Add a dev document about how to generate data and create a custom
threshold rule.
  • Loading branch information
maryam-saeidi authored Feb 22, 2024
1 parent 1d4057f commit 46952f8
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions x-pack/plugins/observability/dev_docs/custom_threshold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Custom threshold rule

Custom threshold rule is GA since 8.13.

## Development & testing

### With data forge

> [!TIP]
> The following commands uses [kbn-data-forge](../../../../packages/kbn-data-forge/README.md) to generate some data for testing Custom threshold rule.
Basic command to generate host data for 7 hosts:
```sh
node x-pack/scripts/data_forge.js \
--events-per-cycle 7 \
--lookback now-20m \
--install-kibana-assets \
--dataset fake_hosts
```

Get help with the data forge tool: `node x-pack/scripts/data_forge.js --help`

#### Create a Custom threshold rule

- First create a data view as shown below:

<img src="./images/data_forge_data_view.png" width="800"/>

- Then you can adjust the rule to alert based on CPU usage:

<img src="./images/data_forge_custom_threshold_rule_cpu.png" width="500"/>

### With synthtrace

> [!TIP]
> The following commands uses [kbn-apm-synthtrace](../../../../packages/kbn-apm-synthtrace) to generate some data for testing Custom threshold rule.
Basic command to generate APM data for 3 services:
```sh
node scripts/synthtrace simple_trace.ts --local --live
```

#### Create a Custom threshold rule

- First create a data view as shown below:

<img src="./images/synthtrace_data_view.png" width="800"/>

- Then you can adjust the rule to alert based on CPU usage:

<img src="./images/synthtrace_custom_threshold_rule.png" width="500"/>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 46952f8

Please sign in to comment.