Skip to content

Commit

Permalink
Update healthcheck setting name to optimizedHealthcheckId
Browse files Browse the repository at this point in the history
Signed-off-by: Bishoy Boktor <[email protected]>
  • Loading branch information
Bishoy Boktor committed Jun 11, 2021
1 parent 4644c4e commit 45e6ab9
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# This node attribute should assign all nodes of the same cluster an integer value that increments with each new cluster that is spun up
# e.g. in opensearch.yml file you would set the value to a setting using node.attr.cluster_id:
# Should only be enabled if there is a corresponding node attribute created in your OpenSearch config that matches the value here
#opensearch.optimizedHealthcheck: "cluster_id"
#opensearch.optimizedHealthcheckId: "cluster_id"

# If your OpenSearch is protected with basic authentication, these settings provide
# the username and password that the OpenSearch Dashboards server uses to perform maintenance on the OpenSearch Dashboards
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/opensearch/opensearch_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ test('set correct defaults', () => {
],
"ignoreVersionMismatch": false,
"logQueries": false,
"optimizedHealthcheck": undefined,
"optimizedHealthcheckId": undefined,
"password": undefined,
"pingTimeout": "PT30S",
"requestHeadersWhitelist": Array [
Expand Down
6 changes: 3 additions & 3 deletions src/core/server/opensearch/opensearch_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const configSchema = schema.object({
requestTimeout: schema.duration({ defaultValue: '30s' }),
pingTimeout: schema.duration({ defaultValue: schema.siblingRef('requestTimeout') }),
logQueries: schema.boolean({ defaultValue: false }),
optimizedHealthcheck: schema.maybe(schema.string()),
optimizedHealthcheckId: schema.maybe(schema.string()),
ssl: schema.object(
{
verificationMode: schema.oneOf(
Expand Down Expand Up @@ -199,7 +199,7 @@ export class OpenSearchConfig {
* Specifies whether Dashboards should only query the local OpenSearch node when
* all nodes in the cluster have the same node attribute value
*/
public readonly optimizedHealthcheck?: string;
public readonly optimizedHealthcheckId?: string;

/**
* Hosts that the client will connect to. If sniffing is enabled, this list will
Expand Down Expand Up @@ -280,7 +280,7 @@ export class OpenSearchConfig {
this.ignoreVersionMismatch = rawConfig.ignoreVersionMismatch;
this.apiVersion = rawConfig.apiVersion;
this.logQueries = rawConfig.logQueries;
this.optimizedHealthcheck = rawConfig.optimizedHealthcheck;
this.optimizedHealthcheckId = rawConfig.optimizedHealthcheckId;
this.hosts = Array.isArray(rawConfig.hosts) ? rawConfig.hosts : [rawConfig.hosts];
this.requestHeadersWhitelist = Array.isArray(rawConfig.requestHeadersWhitelist)
? rawConfig.requestHeadersWhitelist
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/opensearch/opensearch_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class OpenSearchService

const opensearchNodesCompatibility$ = pollOpenSearchNodesVersion({
internalClient: this.client.asInternalUser,
optimizedHealthcheck: config.optimizedHealthcheck,
optimizedHealthcheckId: config.optimizedHealthcheckId,
log: this.log,
ignoreVersionMismatch: config.ignoreVersionMismatch,
opensearchVersionCheckInterval: config.healthCheckDelay.asMilliseconds(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe('pollOpenSearchNodesVersion', () => {

pollOpenSearchNodesVersion({
internalClient,
optimizedHealthcheck: 'cluster_id',
optimizedHealthcheckId: 'cluster_id',
opensearchVersionCheckInterval: 1,
ignoreVersionMismatch: false,
opensearchDashboardsVersion: OPENSEARCH_DASHBOARDS_VERSION,
Expand All @@ -204,7 +204,7 @@ describe('pollOpenSearchNodesVersion', () => {

pollOpenSearchNodesVersion({
internalClient,
optimizedHealthcheck: 'cluster_id',
optimizedHealthcheckId: 'cluster_id',
opensearchVersionCheckInterval: 1,
ignoreVersionMismatch: false,
opensearchDashboardsVersion: OPENSEARCH_DASHBOARDS_VERSION,
Expand Down Expand Up @@ -233,7 +233,7 @@ describe('pollOpenSearchNodesVersion', () => {

pollOpenSearchNodesVersion({
internalClient,
optimizedHealthcheck: 'cluster_id',
optimizedHealthcheckId: 'cluster_id',
opensearchVersionCheckInterval: 1,
ignoreVersionMismatch: false,
opensearchDashboardsVersion: OPENSEARCH_DASHBOARDS_VERSION,
Expand Down Expand Up @@ -269,7 +269,7 @@ describe('pollOpenSearchNodesVersion', () => {

const opensearchNodesCompatibility$ = pollOpenSearchNodesVersion({
internalClient,
optimizedHealthcheck: 'cluster_id',
optimizedHealthcheckId: 'cluster_id',
opensearchVersionCheckInterval: 100,
ignoreVersionMismatch: false,
opensearchDashboardsVersion: OPENSEARCH_DASHBOARDS_VERSION,
Expand Down Expand Up @@ -309,7 +309,7 @@ describe('pollOpenSearchNodesVersion', () => {

const opensearchNodesCompatibility$ = pollOpenSearchNodesVersion({
internalClient,
optimizedHealthcheck: 'cluster_id',
optimizedHealthcheckId: 'cluster_id',
opensearchVersionCheckInterval: 10,
ignoreVersionMismatch: false,
opensearchDashboardsVersion: OPENSEARCH_DASHBOARDS_VERSION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const getNodeId = async (

export interface PollOpenSearchNodesVersionOptions {
internalClient: OpenSearchClient;
optimizedHealthcheck?: string;
optimizedHealthcheckId?: string;
log: Logger;
opensearchDashboardsVersion: string;
ignoreVersionMismatch: boolean;
Expand Down Expand Up @@ -200,7 +200,7 @@ function compareNodes(prev: NodesVersionCompatibility, curr: NodesVersionCompati

export const pollOpenSearchNodesVersion = ({
internalClient,
optimizedHealthcheck,
optimizedHealthcheckId,
log,
opensearchDashboardsVersion,
ignoreVersionMismatch,
Expand All @@ -215,8 +215,8 @@ export const pollOpenSearchNodesVersion = ({
* For better dashboards resilience, the behaviour is changed to only query the local node when all the nodes have the same cluster_id
* Using _cluster/state/nodes to retrieve the cluster_id of each node from the master node
*/
if (optimizedHealthcheck) {
return from(getNodeId(internalClient, optimizedHealthcheck)).pipe(
if (optimizedHealthcheckId) {
return from(getNodeId(internalClient, optimizedHealthcheckId)).pipe(
mergeMap((nodeId: any) =>
from(
internalClient.nodes.info<NodesInfo>({
Expand Down

0 comments on commit 45e6ab9

Please sign in to comment.