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

Update the join fetching exception metrics #907

Merged
merged 7 commits into from
Jan 23, 2025
Merged
Changes from 6 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
19 changes: 14 additions & 5 deletions online/src/main/scala/ai/chronon/online/FetcherBase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -597,20 +597,21 @@ class FetcherBase(kvStore: KVStore,
Seq(Right(InvalidEntityException(request.name)))
}
}
request.copy(context = joinContext) -> decomposedTry
(request.copy(context = joinContext), decomposedTry)
}

val groupByRequests = joinDecomposed.flatMap {
case (_, gbTry) =>
case (request, gbTry) =>
val context = request.context.getOrElse(Metrics.Context(Metrics.Environment.JoinFetching, request.name))
gbTry match {
case Failure(ex) => {
ex match {
case _: InvalidEntityException =>
Metrics.Context(Metrics.Environment.JoinFetching).increment("fetch_invalid_join_failure.count")
context.increment("fetch_invalid_join_failure.count")
case _: KeyMissingException =>
Metrics.Context(Metrics.Environment.JoinFetching).increment("fetch_missing_key_failure.count")
context.increment("fetch_missing_key_failure.count")
case _: Exception =>
Metrics.Context(Metrics.Environment.JoinFetching).increment("fetch_join_failure.count")
context.increment("fetch_join_failure.count")
}
Iterator.empty
}
Expand All @@ -629,6 +630,14 @@ class FetcherBase(kvStore: KVStore,
val joinValuesTry = decomposedRequestsTry.map { groupByRequestsWithPrefix =>
groupByRequestsWithPrefix.iterator.flatMap {
case Right(fetchException) => {
val context =
joinRequest.context.getOrElse(Metrics.Context(Metrics.Environment.JoinFetching, joinRequest.name))
fetchException match {
case ex: KeyMissingException =>
context.increment("fetch_missing_key_failure.count")
case ex: Exception =>
context.incrementException(ex)
}
Map(fetchException.getRequestName + "_exception" -> fetchException.getMessage)
}
case Left(PrefixedRequest(prefix, groupByRequest)) => {
Expand Down