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

eval: add counter for unknown messages #1605

Merged
merged 1 commit into from
Feb 8, 2024
Merged
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 @@ -37,6 +37,8 @@ import com.netflix.atlas.eval.model.LwcSubscription
private[stream] class LwcToAggrDatapoint(context: StreamContext)
extends GraphStage[FlowShape[List[AnyRef], List[AggrDatapoint]]] {

private val unknown = context.registry.counter("atlas.eval.unknownMessages")

private val in = Inlet[List[AnyRef]]("LwcToAggrDatapoint.in")
private val out = Outlet[List[AggrDatapoint]]("LwcToAggrDatapoint.out")

Expand Down Expand Up @@ -75,18 +77,23 @@ private[stream] class LwcToAggrDatapoint(context: StreamContext)
}

private def pushDatapoint(dp: LwcDatapoint): Option[AggrDatapoint] = {
state.get(dp.id).map { sub =>
// TODO, put in source, for now make it random to avoid dedup
nextSource += 1
val expr = sub.expr
val step = sub.step
AggrDatapoint(dp.timestamp, step, expr, nextSource.toString, dp.tags, dp.value)
state.get(dp.id) match {
case Some(sub) =>
// TODO, put in source, for now make it random to avoid dedup
nextSource += 1
val expr = sub.expr
val step = sub.step
Some(AggrDatapoint(dp.timestamp, step, expr, nextSource.toString, dp.tags, dp.value))
case None =>
unknown.increment()
None
}
}

private def pushDiagnosticMessage(diagMsg: LwcDiagnosticMessage): Unit = {
state.get(diagMsg.id).foreach { sub =>
context.log(sub.expr, diagMsg.message)
state.get(diagMsg.id) match {
case Some(sub) => context.log(sub.expr, diagMsg.message)
case None => unknown.increment()
}
}

Expand Down
Loading