From 99ba66354117fef9acfe230c7ba73033b1bee6c3 Mon Sep 17 00:00:00 2001 From: Jinsoo <46536764+jinsoor-amzn@users.noreply.github.com> Date: Mon, 2 Dec 2019 14:20:28 -0800 Subject: [PATCH] fix alerting stats API (#128) Fix multi node alerting stats API. --- .../alerting/core/action/node/ScheduledJobStats.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/core/action/node/ScheduledJobStats.kt b/core/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/core/action/node/ScheduledJobStats.kt index cf7d010f..1a0a3e67 100644 --- a/core/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/core/action/node/ScheduledJobStats.kt +++ b/core/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/core/action/node/ScheduledJobStats.kt @@ -43,7 +43,6 @@ class ScheduledJobStats : BaseNodeResponse, ToXContentFragment { lateinit var status: ScheduleStatus var jobSweeperMetrics: JobSweeperMetrics? = null var jobInfos: Array? = null - val nodeRoles = node.roles.map { it.roleName().toUpperCase() } constructor() @@ -84,7 +83,7 @@ class ScheduledJobStats : BaseNodeResponse, ToXContentFragment { override fun toXContent(builder: XContentBuilder, params: ToXContent.Params): XContentBuilder { builder.field("name", node.name) builder.field("schedule_status", status) - builder.field("roles", nodeRoles) + builder.field("roles", node.roles.map { it.roleName().toUpperCase() }) if (jobSweeperMetrics != null) { builder.startObject(RestScheduledJobStatsHandler.JOB_SCHEDULING_METRICS) jobSweeperMetrics!!.toXContent(builder, params)