forked from opensearch-project/data-prepper
-
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 the opensearch source (opensearch-project#3304)
Add metrics for the opensearch source Signed-off-by: Taylor Gray <[email protected]>
- Loading branch information
1 parent
a3c0b07
commit eff31fe
Showing
12 changed files
with
297 additions
and
27 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
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
50 changes: 50 additions & 0 deletions
50
...ensearch/dataprepper/plugins/source/opensearch/metrics/OpenSearchSourcePluginMetrics.java
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,50 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.plugins.source.opensearch.metrics; | ||
|
||
import io.micrometer.core.instrument.Counter; | ||
import io.micrometer.core.instrument.Timer; | ||
import org.opensearch.dataprepper.metrics.PluginMetrics; | ||
|
||
public class OpenSearchSourcePluginMetrics { | ||
|
||
static final String DOCUMENTS_PROCESSED = "documentsProcessed"; | ||
static final String INDICES_PROCESSED = "indicesProcessed"; | ||
static final String INDEX_PROCESSING_TIME_ELAPSED = "indexProcessingTime"; | ||
static final String PROCESSING_ERRORS = "processingErrors"; | ||
|
||
private final Counter documentsProcessedCounter; | ||
private final Counter indicesProcessedCounter; | ||
private final Counter processingErrorsCounter; | ||
private final Timer indexProcessingTimeTimer; | ||
|
||
public static OpenSearchSourcePluginMetrics create(final PluginMetrics pluginMetrics) { | ||
return new OpenSearchSourcePluginMetrics(pluginMetrics); | ||
} | ||
|
||
private OpenSearchSourcePluginMetrics(final PluginMetrics pluginMetrics) { | ||
documentsProcessedCounter = pluginMetrics.counter(DOCUMENTS_PROCESSED); | ||
indicesProcessedCounter = pluginMetrics.counter(INDICES_PROCESSED); | ||
processingErrorsCounter = pluginMetrics.counter(PROCESSING_ERRORS); | ||
indexProcessingTimeTimer = pluginMetrics.timer(INDEX_PROCESSING_TIME_ELAPSED); | ||
} | ||
|
||
public Counter getDocumentsProcessedCounter() { | ||
return documentsProcessedCounter; | ||
} | ||
|
||
public Counter getIndicesProcessedCounter() { | ||
return indicesProcessedCounter; | ||
} | ||
|
||
public Counter getProcessingErrorsCounter() { | ||
return processingErrorsCounter; | ||
} | ||
|
||
public Timer getIndexProcessingTimeTimer() { | ||
return indexProcessingTimeTimer; | ||
} | ||
} |
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
Oops, something went wrong.