Skip to content

chore(avatars): report photo storage through unified storage - #14129

Merged
Meldiron merged 1 commit into
mainfrom
chore/photos-unified-storage
Oct 5, 2026
Merged

Meldiron merged 1 commit into
mainfrom
chore/photos-unified-storage

Conversation

@Meldiron

@Meldiron Meldiron commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Follow-up to #13949. Per review on appwrite-labs/cloud#6169, the per-service *.storage metrics are deprecated in favour of the unified storage metric split by resourceType.

  • StatsResources writes photo bytes (sum of users.photoSize) as storage with resourceType: photos and service: avatars, instead of avatars.storage.
  • METRIC_AVATARS_STORAGE is removed from app/init/constants.php and from the StatsUsage skip list. Nothing reads it.

Test Plan

  • php -l and Pint pass on the changed files.
  • No endpoint or test read avatars.storage. CI runs the full suite.

🤖 Generated with Claude Code

The per-service storage metrics are deprecated in favour of the unified
storage metric split by resourceType. Write photo bytes there under the
photos resourceType and drop avatars.storage.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@ghost

ghost commented Oct 5, 2026

Copy link
Copy Markdown

🔵 Tier A · Mergeable after minor fixes

The metric contract change lacks regression coverage in the existing usage E2E suite.

Photo storage is now emitted as the unified storage gauge with service: avatars and resourceType: photos. The deprecated avatar-storage constant and its StatsUsage skip-list entry are removed.

Verdict New comments Fixed Still open
✅ Approved 1 0 0
Finding Where
🟡 Cover photo storage attribution through the usage API src/Appwrite/Platform/Workers/StatsResources.php:290
Fix with agent prompt
### Issue 1
src/Appwrite/Platform/Workers/StatsResources.php:290
**Cover photo storage attribution through the usage API**

The existing usage E2E suite tests gauge queries, but no test covers this changed metric contract. Please add a regression that uploads a photo and polls `storage` filtered by `service: avatars` and `resourceType: photos`, asserting the reported bytes so a metric or tag regression cannot silently hide photo usage.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
📂 Walkthrough · 3
File Change
app/init/constants.php Remove the deprecated avatar-storage metric constant.
src/Appwrite/Platform/Workers/StatsResources.php Emit photo bytes under the unified storage metric and photo tags.
src/Appwrite/Platform/Workers/StatsUsage.php Remove the obsolete metric from the event skip list.

Reviewed 6906bdc · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · Looks good to merge. Summary

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → chore/photos-unified-storage (after).

Metric Before After Change
🚀 Requests/sec 208.25 211.17 ⚪ +1.4%
⏱️ Latency P50 83.42 ms 81.55 ms ⚪ -2.2%
⏱️ Latency P95 192.17 ms 191.84 ms ⚪ -0.2%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 81.55 191.84 13,338 211.17 -0.33
Account 158 305.05 702 11.71 +6.49
TablesDB 78.89 143.89 7,254 117.35 -12.7
Storage 74.71 162.89 3,510 58.44 -1.29
Functions 119.44 241.43 1,872 31.76 +18.86

Top API waits (after)

API request Max wait (ms)
account.name.update 475.99
functions.create 446.98
account.prefs.update 409.81
functions.variables.create 393.05
functions.variables.update 336.86

@Meldiron
Meldiron merged commit e52d741 into main Oct 5, 2026
52 checks passed
abnegate added a commit that referenced this pull request Oct 5, 2026
Merges main a2cca78 (#14009, #14106, #14117, #14115, #14119, #14114,
#14101, #14125, #14129, #14127) so cloud#5410 can require a train head
that contains main at or after 0ed7232.

Conflicts: none.

Database 8.0 port: none needed. Main's new code only uses Document
getAttribute/setAttribute and Query::equal/lessThan/orderAsc/limit
(Tasks/Interval.php), all unchanged in database 8.0; no removed
Database::* constants, config collections, or model magic reads.
composer.json and composer.lock are untouched by main, so the train's
database and migration pins stay as they are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants