forked from opensearch-project/opensearch-spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add metrics for query types (opensearch-project#891) (opensearch-proj…
…ect#901) (cherry picked from commit 9d504ea) Signed-off-by: Tomoyuki Morita <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
19bc8df
commit 0c6f2d4
Showing
5 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...t-spark-integration/src/main/scala/org/opensearch/flint/spark/sql/IndexMetricHelper.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.flint.spark.sql | ||
|
||
import org.opensearch.flint.core.metrics.{MetricConstants, MetricsUtil} | ||
|
||
trait IndexMetricHelper { | ||
def emitCreateIndexMetric(autoRefresh: Boolean): Unit = { | ||
MetricsUtil.incrementCounter(MetricConstants.QUERY_CREATE_INDEX_COUNT_METRIC) | ||
if (autoRefresh) { | ||
MetricsUtil.incrementCounter(MetricConstants.QUERY_CREATE_INDEX_AUTO_REFRESH_COUNT_METRIC) | ||
} else { | ||
MetricsUtil.incrementCounter(MetricConstants.QUERY_CREATE_INDEX_MANUAL_REFRESH_COUNT_METRIC) | ||
} | ||
} | ||
|
||
def emitRefreshIndexMetric(): Unit = { | ||
MetricsUtil.incrementCounter(MetricConstants.QUERY_REFRESH_COUNT_METRIC) | ||
} | ||
|
||
def emitAlterIndexMetric(): Unit = { | ||
MetricsUtil.incrementCounter(MetricConstants.QUERY_ALTER_COUNT_METRIC) | ||
} | ||
|
||
def emitDropIndexMetric(): Unit = { | ||
MetricsUtil.incrementCounter(MetricConstants.QUERY_DROP_COUNT_METRIC) | ||
} | ||
|
||
def emitVacuumIndexMetric(): Unit = { | ||
MetricsUtil.incrementCounter(MetricConstants.QUERY_VACUUM_COUNT_METRIC) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters