MetricsRegistry access
@Inject
MetricsRegistry metrics;
@Override
protected void afterModelCall(ModelResponse r, AgentContext ctx) {
metrics.counter("my.custom.metric",
Tag.of("agent", name()),
Tag.of("cache_hit", String.valueOf(r.cached())))
.increment();
}Advertisement
Tag conventions
Stick to the standard ADK tags where they fit: agent, model, tenant, session, tool. Add custom tags for your business.
Advertisement
Watch cardinality
Tags with high cardinality (user_id, request_id) blow up metric stores. Bucket or hash instead.