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

Add external scheduler metrics #827

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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.";

private MetricConstants() {
// Private constructor to prevent instantiation
}
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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we reuse withMetrics by adding the action in prefix?


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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will HistoricGauge with value one aggregated on client side?

}
}
Loading