[PR 13] Usage Analytics + Audit
- Dominant language
- Rust
- Stars
- 40
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Implement skill download tracking and audit events for usage analytics.
## What to implement
### Audit Events
- `Operation::SkillDownload` event on pull/content retrieval
- `Operation::SkillSync` event on `/v1/` route hits (lazy mode)
### Download Counts
- Increment `download_count` on every `GET /v1/skill/...` hit
- Include in skill listing response
### UI
- Download badge on `SkillGridCard`
- Weekly usage chart on skill detail page
## Files to modify
- `crates/opsml_server/src/core/v1/route.rs` — increment download_count on /v1/ routes
- `crates/opsml_types/src/contracts/mod.rs` — add `Operation::SkillDownload`, `Operation::SkillSync`
- UI components — add download badge and usage chart
## Verification
```bash
cargo test -p opsml-server -- --nocapture --test-threads=1
# Pull skill → check audit log → verify count increments in listing response
```
## Depends on
- #361 (PR 12)
Contributor guide
Research direction
Check dependency #361 first, then read crates/opsml_server/src/core/v1/route.rs and crates/opsml_types/src/contracts/mod.rs. Run the provided cargo test command and locate the SkillGridCard and skill detail page UI components. Done means both audit operations are recorded, GET /v1/skill/... updates and exposes download_count, and the UI shows the badge and weekly usage chart.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- analytics, api, backend, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100