Lee-W commented on code in PR #72786:
URL: https://github.com/apache/airflow/pull/72786#discussion_r4052550053


##########
providers/common/ai/docs/toolsets.rst:
##########
@@ -1237,6 +1237,57 @@ derives one from a method name when there is no 
docstring.
     name and the description are the whole of what the model knows about the
     agent.
 
+Metrics
+^^^^^^^
+
+Every call -- through a lone toolset or a ``FailoverManagedAgentToolset``
+alike -- emits ``managed_agent.invoked``, tagged by ``tool`` and ``platform``,
+whether it succeeds or fails. It is emitted before ``invoke()`` runs, from the
+shared ``call_tool()`` path that every toolset inherits, so a lone toolset
+gets a per-tool call count it would otherwise have no metric for at all, and a
+group gets exactly one increment per call regardless of how many members were
+tried -- an attempt, not an answer, so it keeps moving even during a total
+outage that leaves nothing to divide by otherwise.
+
+For a group, the ``platform`` tag on ``managed_agent.invoked`` is always the
+literal string ``"failover"``, not the cloud that actually answered --
+``agent_ref`` on a group describes the group's own identity, not whichever
+member ends up serving the call. Summing ``managed_agent.invoked`` by
+``platform`` therefore mixes that ``failover`` bucket in with real platform
+names from lone toolsets; filter by ``tool`` instead when a group and its
+members share a dashboard.
+
+``platform`` can also show up as the literal string ``"unknown"``, but only
+when a subclass's ``agent_ref`` returns a dict with no ``platform`` key: the
+tag degrades rather than failing the call over a missing label. It is not the

Review Comment:
   Split in two. 
   
   1. `managed_agent.invoked`
   2. `managed_agent.served` and `managed_agent.failover`
   
   `_resolve_agent_ref` collapses a raised lookup failure and a dict missing 
`platform` into the same stand-in, so the tag alone cannot separate them. 
   
   The warning is what separates them — a raise logs one naming the member, a 
silently missing key does not. That also means `served{platform="unknown"}` can 
climb with no transition warning anywhere in the log, when the member whose 
label failed then answers the call. The guide now says so, so the absence of a 
warning reads as the member's own `agent_ref` rather than its connection.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to