Repository navigation
Feat new usage stats - #13463
Feat new usage stats#13463
Conversation
| 'acceptLanguage' => $this->acceptLanguage, | ||
| 'cookie' => $this->cookie, | ||
| 'queryKeys' => $this->queryKeys, | ||
| ]; | ||
|
|
There was a problem hiding this comment.
Request metadata remains empty
When production requests emit usage metrics, request initialization never invokes the five new setters, so protocol, accept, acceptLanguage, cookie, and queryKeys are always recorded as empty strings and the new usage statistics are never collected.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/Appwrite/Usage/Context.php
Line: 274-278
Comment:
**Request metadata remains empty**
When production requests emit usage metrics, request initialization never invokes the five new setters, so `protocol`, `accept`, `acceptLanguage`, `cookie`, and `queryKeys` are always recorded as empty strings and the new usage statistics are never collected.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
@greptile this is already fixed
There was a problem hiding this comment.
Confirmed — this is fixed in the current revision. app/controllers/general.php now populates protocol, accept, acceptLanguage, and queryKeys before usage metrics are emitted, so these fields are no longer always empty. The cookie field is not part of the current implementation. Resolving this comment.
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
# Conflicts: # composer.lock
StatsUsage rebuilt the tag set without the request-attribute dimensions, so the metadata Context queued was discarded before collection. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Conflicts: # composer.json # composer.lock
Use the new utopia-php/http TrustedHeaders constructor argument instead of the removed Request::setTrustedIpHeaders(), and pass the single topic Document to the cursor (getDocument() returns a Document, not an array), resolving both level-4 PHPStan errors on the branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
S3 request metadata stays empty
When an S3 request records network usage, the separate S3 initialization hook omits setProtocol, setAccept, setAcceptLanguage, and setQueryKeys, causing all S3 traffic to be grouped under empty values for these newly queryable dimensions.
Knowledge Base Used:
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/Appwrite/Usage/Context.php
Line: 213-238
Comment:
**S3 request metadata stays empty**
When an S3 request records network usage, the separate S3 initialization hook omits `setProtocol`, `setAccept`, `setAcceptLanguage`, and `setQueryKeys`, causing all S3 traffic to be grouped under empty values for these newly queryable dimensions.
**Knowledge Base Used:**
- [API platform and request surface](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/appwrite/-/docs/api-platform.md)
- [Background processing and scheduling](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/appwrite/-/docs/background-processing.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.The S3 gateway init hook meters network usage through its own context setup and omitted the new protocol, accept, accept-language, and query-key dimensions, so all S3 traffic grouped under empty values. Mirror app/controllers/general.php so S3 requests carry the same fields. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

What does this PR do?
(Provide a description of what this PR does and why it's needed.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)
Related PRs and Issues
Checklist