Context
Usage Event Analytics đã có dashboard/resource tabs cho tool, skill, mcp_tool, runtime_tool, và backend có path ghi usage events cho skill activation.
Tuy nhiên khi sử dụng skills thực tế, phần usage analytics của skills trên dashboard hình như không tăng số đếm. Điều này làm dashboard không phản ánh đúng mức độ sử dụng skill, khó biết skill nào đang được invoke nhiều, skill nào lỗi, và skill nào cần cải thiện.
Observed behavior
- Kích hoạt/sử dụng skills nhưng dashboard Usage Analytics tab
skill không thấy số đếm thay đổi.
- Có cảm giác skill usage events không được ghi, không được rollup, hoặc frontend/API đang không query đúng dữ liệu.
- Các tab khác như tool/runtime/MCP có thể vẫn hoạt động, nhưng skill analytics cần được kiểm tra riêng.
Expected behavior
Khi một skill được kích hoạt hoặc chạy qua các đường phổ biến, usage analytics phải ghi nhận được:
- skill name/slug;
- activation source, ví dụ
use_skill, slash command, command invocation;
- call count;
- error count nếu có;
- channel/agent/user/team context nếu có;
- thời điểm/bucket để dashboard hiển thị theo range filter.
Dashboard Usage Analytics tab skill phải tăng số đếm sau khi skill được sử dụng và dữ liệu được refresh/rollup.
Places to inspect
Relevant areas found in current dev branch:
- backend skill usage event paths:
internal/agent/usage_events.go
recordToolUsageEvent(...) maps canonical tool use_skill to UsageEventTypeSkillActivation and UsageResourceTypeSkill
recordSkillSlashUsageEvent(...) records slash-command skill activation
internal/tools/use_skill.go defines use_skill as observability marker
- storage/rollup:
internal/store/pg/usage_event.go
internal/store/sqlitestore/usage_events.go
internal/tracing/snapshot_worker.go
- API/UI:
/v1/usage/events/summary
/v1/usage/events/breakdown
/v1/usage/events/timeseries
ui/web/src/pages/usage/hooks/use-usage-event-analytics.ts
ui/web/src/pages/usage/components/usage-event-analytics-panel.tsx
Recent related work:
- usage event analytics dashboard was added recently on
dev.
- skill self-evolution metrics also has a separate
skill_usage_metrics path, so confirm dashboard is not accidentally expecting that table instead of usage_events.
Reproduction steps
- Start GoClaw on latest
dev.
- Open Usage Analytics dashboard.
- Select the
skill resource tab.
- Trigger a skill in a normal chat/session, for example via
use_skill + reading the skill, or a slash skill command if available.
- Refresh dashboard after a reasonable delay / rollup interval.
- Observe whether skill call count changes.
Possible causes to verify
recordToolUsageEvent may not run for use_skill in some execution paths.
tracing.TraceIDFromContext(ctx) may be nil, causing early return and dropping the event.
- Slash-command activation may use
recordSkillSlashUsageEvent, but normal managed skill activation may not consistently pass through the same path.
use_skill tool may be hidden/special-cased in a way that does not generate the expected tool result event.
- Usage events may be inserted, but hourly rollup/snapshot does not include the current bucket yet.
- UI may only query rollup tables, while recent events are not visible until the next hourly aggregation.
resource_type=skill filtering may mismatch stored values.
- There may be confusion between
usage_events and skill_usage_metrics.
Acceptance criteria
- Skill activation is recorded reliably for normal
use_skill flows.
- Skill activation is recorded reliably for slash-command skill flows.
- Dashboard Usage Analytics tab
skill shows updated counts for selected time range.
- API endpoints return non-zero rows for skill usage after a skill is used:
GET /v1/usage/events/summary?resource_type=skill&...
GET /v1/usage/events/breakdown?resource_type=skill&group_by=resource&...
GET /v1/usage/events/timeseries?resource_type=skill&...
- If rollup is intentionally delayed, dashboard should either:
- include recent unrolled events, or
- clearly communicate the delay so users do not think tracking is broken.
- Tests cover both
use_skill and slash-command skill activation.
- Tests cover tenant isolation and channel/agent filters for skill events.
- No double-counting when a skill is activated once.
Notes
This is likely a tracking/rollup/API/UI integration bug, not a request to redesign the analytics UI. The first goal is to make the existing skill usage counters trustworthy.
Context
Usage Event Analytics đã có dashboard/resource tabs cho
tool,skill,mcp_tool,runtime_tool, và backend có path ghi usage events cho skill activation.Tuy nhiên khi sử dụng skills thực tế, phần usage analytics của skills trên dashboard hình như không tăng số đếm. Điều này làm dashboard không phản ánh đúng mức độ sử dụng skill, khó biết skill nào đang được invoke nhiều, skill nào lỗi, và skill nào cần cải thiện.
Observed behavior
skillkhông thấy số đếm thay đổi.Expected behavior
Khi một skill được kích hoạt hoặc chạy qua các đường phổ biến, usage analytics phải ghi nhận được:
use_skill, slash command, command invocation;Dashboard Usage Analytics tab
skillphải tăng số đếm sau khi skill được sử dụng và dữ liệu được refresh/rollup.Places to inspect
Relevant areas found in current
devbranch:internal/agent/usage_events.gorecordToolUsageEvent(...)maps canonical tooluse_skilltoUsageEventTypeSkillActivationandUsageResourceTypeSkillrecordSkillSlashUsageEvent(...)records slash-command skill activationinternal/tools/use_skill.godefinesuse_skillas observability markerinternal/store/pg/usage_event.gointernal/store/sqlitestore/usage_events.gointernal/tracing/snapshot_worker.go/v1/usage/events/summary/v1/usage/events/breakdown/v1/usage/events/timeseriesui/web/src/pages/usage/hooks/use-usage-event-analytics.tsui/web/src/pages/usage/components/usage-event-analytics-panel.tsxRecent related work:
dev.skill_usage_metricspath, so confirm dashboard is not accidentally expecting that table instead ofusage_events.Reproduction steps
dev.skillresource tab.use_skill+ reading the skill, or a slash skill command if available.Possible causes to verify
recordToolUsageEventmay not run foruse_skillin some execution paths.tracing.TraceIDFromContext(ctx)may be nil, causing early return and dropping the event.recordSkillSlashUsageEvent, but normal managed skill activation may not consistently pass through the same path.use_skilltool may be hidden/special-cased in a way that does not generate the expected tool result event.resource_type=skillfiltering may mismatch stored values.usage_eventsandskill_usage_metrics.Acceptance criteria
use_skillflows.skillshows updated counts for selected time range.GET /v1/usage/events/summary?resource_type=skill&...GET /v1/usage/events/breakdown?resource_type=skill&group_by=resource&...GET /v1/usage/events/timeseries?resource_type=skill&...use_skilland slash-command skill activation.Notes
This is likely a tracking/rollup/API/UI integration bug, not a request to redesign the analytics UI. The first goal is to make the existing skill usage counters trustworthy.