Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 0.5-nexus] Add external scheduler metrics #856

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ public final class MetricConstants {
*/
public static final String CHECKPOINT_DELETE_TIME_METRIC = "checkpoint.delete.processingTime";

/**
* Prefix for externalScheduler metrics
*/
public static final String EXTERNAL_SCHEDULER_METRIC_PREFIX = "externalScheduler.";

/**
* Metric prefix for tracking the index state transitions
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import java.time.Instant
import org.opensearch.flint.common.metadata.log.FlintMetadataLogEntry.IndexState
import org.opensearch.flint.common.scheduler.AsyncQueryScheduler
import org.opensearch.flint.common.scheduler.model.{AsyncQuerySchedulerRequest, LangType}
import org.opensearch.flint.core.metrics.{MetricConstants, MetricsUtil}
import org.opensearch.flint.core.storage.OpenSearchClientUtils
import org.opensearch.flint.spark.FlintSparkIndex
import org.opensearch.flint.spark.refresh.util.RefreshMetricsAspect
Expand Down Expand Up @@ -83,8 +84,16 @@ class FlintSparkJobExternalSchedulingService(
case AsyncQuerySchedulerAction.REMOVE => flintAsyncQueryScheduler.removeJob(request)
case _ => throw new IllegalArgumentException(s"Unsupported action: $action")
}
addExternalSchedulerMetrics(action)

None // Return None for all cases
}
}

private def addExternalSchedulerMetrics(action: AsyncQuerySchedulerAction): Unit = {
val actionName = action.name().toLowerCase()
MetricsUtil.addHistoricGauge(
MetricConstants.EXTERNAL_SCHEDULER_METRIC_PREFIX + actionName + ".count",
1)
}
}
Loading