Skip to content

Commit

Permalink
Once more... Managing, Monitoring, Tuning. (#2653)
Browse files Browse the repository at this point in the history
Signed-off-by: Naarcha-AWS <naarcha@amazon.com>
  • Loading branch information
Naarcha-AWS authored Feb 6, 2023
1 parent 0249991 commit 45834d6
Show file tree
Hide file tree
Showing 67 changed files with 1,481 additions and 84 deletions.
2 changes: 2 additions & 0 deletions _api-reference/cluster-api/cluster-awareness.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: Cluster routing and awareness
nav_order: 20
parent: Cluster APIs
has_children: false
redirect_from:
- /api-reference/cluster-awareness/
---

# Cluster routing and awareness
Expand Down
2 changes: 2 additions & 0 deletions _api-reference/cluster-api/cluster-decommission.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: Cluster decommission
nav_order: 30
parent: Cluster APIs
has_children: false
redirect_from:
- /api-reference/cluster-decommission/
---

# Cluster decommission
Expand Down
1 change: 1 addition & 0 deletions _api-reference/cluster-api/cluster-health.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title: Cluster health
nav_order: 40
parent: Cluster APIs
has_children: false
redirect_from: /api-reference/cluster-health/
---

# Cluster health
Expand Down
2 changes: 2 additions & 0 deletions _api-reference/cluster-api/cluster-stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: Cluster stats
nav_order: 60
parent: Cluster APIs
has_children: false
redirect_from:
- /api-reference/cluster-stats/
---

# Cluster stats
Expand Down
1 change: 1 addition & 0 deletions _api-reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: default
title: REST API reference
nav_order: 1
has_toc: true
redirect_from:
- /opensearch/rest-api/
---
Expand Down
68 changes: 34 additions & 34 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permalink: /:path/
opensearch_version: 2.5.0
opensearch_dashboards_version: 2.5.0
opensearch_major_minor_version: 2.5
lucene_version: 9_4_2
lucene_version: 9_4_1

# Build settings
markdown: kramdown
Expand Down Expand Up @@ -37,40 +37,43 @@ collections:
opensearch:
permalink: /:collection/:path/
output: true
im-plugin:
permalink: /:collection/:path/
output: true
dashboards:
permalink: /:collection/:path/
output: true
security:
tuning-your-cluster:
permalink: /:collection/:path/
output: true
security:
permalink: /:collection/:path/
output: true
security-analytics:
permalink: /:collection/:path/
output: true
search-plugins:
permalink: /:collection/:path/
output: true
im-plugin:
output: true
ml-commons-plugin:
permalink: /:collection/:path/
output: true
replication-plugin:
neural-search-plugin:
permalink: /:collection/:path/
output: true
observability-plugin:
output: true
tuning-your-cluster:
permalink: /:collection/:path/
output: true
ml-commons-plugin:
monitoring-your-cluster:
permalink: /:collection/:path/
output: true
neural-search-plugin:
observing-your-data:
permalink: /:collection/:path/
output: true
monitoring-plugins:
permalink: /:collection/:path/
output: true
notifications-plugin:
ml-commons-plugin:
permalink: /:collection/:path/
output: true
job-scheduler-plugin:
neural-search-plugin:
permalink: /:collection/:path/
output: true
clients:
Expand Down Expand Up @@ -106,41 +109,38 @@ just_the_docs:
opensearch:
name: OpenSearch
nav_fold: true
im-plugin:
name: Managing Indexes
nav_fold: true
dashboards:
name: OpenSearch Dashboards
nav_fold: true
tuning-your-cluster:
name: Tuning your cluster
nav_fold: true
security:
name: Security in OpenSearch
nav_fold: true
security-analytics:
name: Security analytics plugin
nav_fold: true
search-plugins:
name: Search plugins
nav_fold: true
im-plugin:
name: Index management plugin
nav_fold: true
replication-plugin:
name: Replication plugin
nav_fold: true
observability-plugin:
name: Observability plugin
name: Search
nav_fold: true
ml-commons-plugin:
name: ML Commons plugin
name: Machine learning
nav_fold: true
neural-search-plugin:
name: Neural Search plugin
nav_fold: true
monitoring-plugins:
name: Monitoring plugins
name: Neural Search
nav_fold: true
notifications-plugin:
name: Notifications plugin
tuning-your-cluster:
name: Tuning your cluster
nav_fold: true
monitoring-your-cluster:
name: Monitoring your cluster
nav_fold: true
job-scheduler-plugin:
name: Job Scheduler plugin
observing-your-data:
name: Observing your data
nav_fold: true
clients:
name: Clients
Expand Down Expand Up @@ -226,4 +226,4 @@ exclude:
- vendor/gems/
- vendor/ruby/
- README.md
- .idea
- .idea
2 changes: 1 addition & 1 deletion _data-prepper/peer-forwarder.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ nav_order: 12

# Peer Forwarder

Peer Forwarder is an HTTP service that performs peer forwarding of an `event` between Data Prepper nodes for aggregation. This HTTP service uses a hash-ring approach to aggregate events and determine which Data Prepper node it should handle on a given trace before rerouting it to that node. Currently, Peer Forwarder is supported by the `aggregate`, `service_map_stateful`, and `otel_trace_raw` [processors]({{site.url}}{{site.baseurl}}/data-prepper/configuration/processors/processors/).
Peer Forwarder is an HTTP service that performs peer forwarding of an `event` between Data Prepper nodes for aggregation. This HTTP service uses a hash-ring approach to aggregate events and determine which Data Prepper node it should handle on a given trace before rerouting it to that node. Currently, Peer Forwarder is supported by the `aggregate`, `service_map_stateful`, and `otel_trace_raw` [processors]({{site.url}}{{site.baseurl}}/data-prepper/pipelines/configuration/processors/processors/).

Peer Forwarder groups events based on the identification keys provided by the supported processors. For `service_map_stateful` and `otel_trace_raw`, the identification key is `traceId` by default and cannot be configured. The `aggregate` processor is configured using the `identification_keys` configuration option. From here, you can specify which keys to use for Peer Forwarder. See [Aggregate Processor page](https://github.com/opensearch-project/data-prepper/tree/main/data-prepper-plugins/aggregate-processor#identification_keys) for more information about identification keys.

Expand Down
132 changes: 132 additions & 0 deletions _monitoring-your-cluster/job-scheduler/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
layout: default
title: Job Scheduler
nav_order: 1
has_children: false
has_toc: false
redirect_from:
- /job-scheduler-plugin/index/
---

# Job Scheduler

The OpenSearch Job Scheduler plugin provides a framework that can be used to build schedules for common tasks performed on your cluster. You can use Job Scheduler’s Service Provider Interface (SPI) to define schedules for cluster management tasks such as taking snapshots, managing your data’s lifecycle, and running periodic jobs. Job Scheduler has a sweeper that listens for updated events on the OpenSearch cluster and a scheduler that manages when jobs run.

You can install the Job Scheduler plugin by following the standard [OpenSearch plugin installation]({{site.url}}{{site.baseurl}}/install-and-configure/install-opensearch/plugins/) process. The sample-extension-plugin example provided in the [Job Scheduler GitHub repository](https://github.com/opensearch-project/job-scheduler) provides a complete example of utilizing Job Scheduler when building a plugin. To define schedules, you build a plugin that implements the interfaces provided in the Job Scheduler library. You can schedule jobs by specifying an interval, or you can use a Unix cron expression such as `0 12 * * ?`, which runs at noon every day, to define a more flexible schedule.

## Building a plugin for Job Scheduler

OpenSearch plugin developers can extend the Job Scheduler plugin to schedule jobs to perform on the cluster. Jobs you can schedule include running aggregation queries against raw data, saving the aggregated data to a new index every hour, or continuing to monitor the shard allocation by calling the OpenSearch API and then posting the output to a webhook.

For examples of building a plugin that uses the Job Scheduler plugin, see the Job Scheduler [README](https://github.com/opensearch-project/job-scheduler/blob/main/README.md).

## Defining an endpoint

You can configure your plugin's API endpoint by referencing the [example](https://github.com/opensearch-project/job-scheduler/blob/main/sample-extension-plugin/src/main/java/org/opensearch/jobscheduler/sampleextension/SampleExtensionRestHandler.java) `SampleExtensionRestHandler.java` file. Set the endpoint URL that your plugin will expose with `WATCH_INDEX_URI`:

```java
public class SampleExtensionRestHandler extends BaseRestHandler {
public static final String WATCH_INDEX_URI = "/_plugins/scheduler_sample/watch";
```

You can define the job configuration by [extending](https://github.com/opensearch-project/job-scheduler/blob/main/sample-extension-plugin/src/main/java/org/opensearch/jobscheduler/sampleextension/SampleJobParameter.java) `ScheduledJobParameter`. You can also define the fields used by your plugin, like `indexToWatch`, as shown in the [example](https://github.com/opensearch-project/job-scheduler/blob/main/sample-extension-plugin/src/main/java/org/opensearch/jobscheduler/sampleextension/SampleJobParameter.java) `SampleJobParameter` file. This job configuration will be saved as a document in an index you define, as shown in [this example](https://github.com/opensearch-project/job-scheduler/blob/main/sample-extension-plugin/src/main/java/org/opensearch/jobscheduler/sampleextension/SampleExtensionPlugin.java#L54).

## Configuring parameters

You can configure your plugin's parameters by referencing the [example](https://github.com/opensearch-project/job-scheduler/blob/main/sample-extension-plugin/src/main/java/org/opensearch/jobscheduler/sampleextension/SampleJobParameter.java) `SampleJobParameter.java` file and modifying it to fit your needs:

```java
/**
* A sample job parameter.
* <p>
* It adds an additional "indexToWatch" field to {@link ScheduledJobParameter}, which stores the index
* the job runner will watch.
*/
public class SampleJobParameter implements ScheduledJobParameter {
public static final String NAME_FIELD = "name";
public static final String ENABLED_FILED = "enabled";
public static final String LAST_UPDATE_TIME_FIELD = "last_update_time";
public static final String LAST_UPDATE_TIME_FIELD_READABLE = "last_update_time_field";
public static final String SCHEDULE_FIELD = "schedule";
public static final String ENABLED_TIME_FILED = "enabled_time";
public static final String ENABLED_TIME_FILED_READABLE = "enabled_time_field";
public static final String INDEX_NAME_FIELD = "index_name_to_watch";
public static final String LOCK_DURATION_SECONDS = "lock_duration_seconds";
public static final String JITTER = "jitter";

private String jobName;
private Instant lastUpdateTime;
private Instant enabledTime;
private boolean isEnabled;
private Schedule schedule;
private String indexToWatch;
private Long lockDurationSeconds;
private Double jitter;
```

Next, configure the request parameters you would like your plugin to use with Job Scheduler. These will be based on the variables you declare when configuring your plugin. The following example shows the request parameters you set when building your plugin:

```java
public SampleJobParameter(String id, String name, String indexToWatch, Schedule schedule, Long lockDurationSeconds, Double jitter) {
this.jobName = name;
this.indexToWatch = indexToWatch;
this.schedule = schedule;

Instant now = Instant.now();
this.isEnabled = true;
this.enabledTime = now;
this.lastUpdateTime = now;
this.lockDurationSeconds = lockDurationSeconds;
this.jitter = jitter;
}

@Override
public String getName() {
return this.jobName;
}

@Override
public Instant getLastUpdateTime() {
return this.lastUpdateTime;
}

@Override
public Instant getEnabledTime() {
return this.enabledTime;
}

@Override
public Schedule getSchedule() {
return this.schedule;
}

@Override
public boolean isEnabled() {
return this.isEnabled;
}

@Override
public Long getLockDurationSeconds() {
return this.lockDurationSeconds;
}

@Override public Double getJitter() {
return jitter;
}
```

The following table describes the request parameters configured in the previous example. All the request parameters shown are required.

| Field | Data type | Description |
:--- | :--- | :---
| getName | String | Returns the name of the job. |
| getLastUpdateTime | Time unit | Returns the time that the job was last run. |
| getEnabledTime | Time unit | Returns the time that the job was enabled. |
| getSchedule | Unix cron | Returns the job schedule formatted in Unix cron syntax. |
| isEnabled | Boolean | Indicates whether or not the job is enabled. |
| getLockDurationSeconds | Integer | Returns the duration of time for which the job is locked. |
| getJitter | Integer | Returns the defined jitter value. |

The logic used by your job should be defined by a class extended from `ScheduledJobRunner` in the `SampleJobParameter.java` sample file, such as `SampleJobRunner`. While the job is running, there is a locking mechanism you can use to prevent other nodes from running the same job. First, [acquire](https://github.com/opensearch-project/job-scheduler/blob/main/sample-extension-plugin/src/main/java/org/opensearch/jobscheduler/sampleextension/SampleJobRunner.java#L96) the lock. Then make sure to release the lock before the [job finishes](https://github.com/opensearch-project/job-scheduler/blob/main/sample-extension-plugin/src/main/java/org/opensearch/jobscheduler/sampleextension/SampleJobRunner.java#L116).

For more information, see the Job Scheduler [sample extension](https://github.com/opensearch-project/job-scheduler/blob/main/sample-extension-plugin/src/main/java/org/opensearch/jobscheduler/sampleextension/SampleJobParameter.java) directory in the [Job Scheduler GitHub repo](https://github.com/opensearch-project/job-scheduler).
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ layout: default
title: API
parent: Performance Analyzer
nav_order: 1
redirect_from:
- /monitoring-plugins/pa/api/
---

# Performance Analyzer API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ layout: default
title: Create PerfTop Dashboards
parent: Performance Analyzer
nav_order: 2
redirect_from:
- /monitoring-plugins/pa/dashboards/
---

# PerfTop dashboards
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ nav_order: 58
has_children: true
redirect_from:
- /monitoring-plugins/pa/
- /monitoring-plugins/pa/index/
---

# Performance analyzer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: API
parent: Root Cause Analysis
grand_parent: Performance Analyzer
nav_order: 1
redirect_from:
- /monitoring-plugins/pa/rca/api/
---

# RCA API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: Root Cause Analysis
nav_order: 50
parent: Performance Analyzer
has_children: true
redirect_from:
- /monitoring-plugins/pa/rca/index/
---

# Root Cause Analysis
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: RCA Reference
parent: Root Cause Analysis
grand_parent: Performance Analyzer
nav_order: 3
redirect_from:
- /monitoring-plugins/pa/rca/reference/
---

# RCA reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ layout: default
title: Metrics Reference
parent: Performance Analyzer
nav_order: 3
redirect_from:
- /monitoring-plugins/pa/reference/
---

# Metrics reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ layout: default
title: Anomaly detection API
parent: Anomaly detection
nav_order: 1
redirect_from:
- /monitoring-plugins/ad/api/
---

# Anomaly detection API
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
layout: default
title: Anomaly detection
nav_order: 46
nav_order: 90
has_children: true
redirect_from:
- /monitoring-plugins/ad/
- /monitoring-plugins/ad/index/
---

# Anomaly detection
Expand Down
Loading

0 comments on commit 45834d6

Please sign in to comment.