chore: absorb telemetry into packages/telemetry by loks0n · Pull Request #13731 · appwrite/appwrite · GitHub
Skip to content

chore: absorb telemetry into packages/telemetry - #13731

Merged
ChiragAgg5k merged 54 commits into
mainfrom
feat/absorb-telemetry
Sep 22, 2026
Merged

ChiragAgg5k merged 54 commits into
mainfrom
feat/absorb-telemetry

Conversation

@loks0n

@loks0n loks0n commented Sep 16, 2026

Copy link
Copy Markdown
Member

Summary

Fifth package on the plan in rfc/monorepo.md, one package per PR. Three commits:

  1. Add 'packages/telemetry/' from commit 852e76c8…: subtree import from the mirror, full history; the mirror ruleset updated by the same absorb run.
  2. chore(telemetry): mirror plumbing: mirror.yml pointed here, README banner refreshed.
  3. refactor: load telemetry from packages/: src/Telemetry and tests/Telemetry flattened, tests under Utopia\\Telemetry\\Tests\\, the OTLP transport tests that bind a loopback Swoole server moved to tests/E2E/ with a test:e2e script (no compose file needed), standalone PHPStan config at the package's own level max, standalone Rector config. Nine vendored packages require utopia-php/telemetry; the root now replaces it and hoists its four third-party requirements (nyholm/psr7, open-telemetry/exporter-otlp, open-telemetry/sdk, symfony/http-client). The lock drops only utopia-php/telemetry.

Drift, checked

Appwrite ran 0.4.10. The mirror head is one merge past the 0.4.11 tag (a per-call cost optimisation). Since 0.4.8 the only public-surface change is an added exporter wrapper class; nothing removed or re-signed, so the nine dependants are unaffected.

Known local-only failure

bin/monorepo test telemetry's e2e tier segfaults on macOS (Swoole 6 + PHP 8.5) in one retry-timing test, reproduced on the untouched import; the Linux runner passed it on #13721, which carried the same files.

Merging

Merge with a merge commit, not a squash, so the subtree annotation survives for the split.

Verification

  • bin/monorepo validate: all packages valid; bin/monorepo check telemetry clean
  • bin/monorepo test telemetry: unit tier 24 tests green (e2e tier: see above)
  • vendor/bin/phpunit --testsuite packages: 223 tests, 4 skipped
  • Root PHPStan clean on every Appwrite file consuming Utopia\\Telemetry; composer validate valid; dump-autoload without PSR-4 warnings

🤖 Generated with Claude Code

eldadfux and others added 30 commits November 11, 2024 15:25
feat(testing): ship testing adapter
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Implements an asynchronous gauge whose value is collected via a callback
at export time, following the OpenTelemetry observable instrument pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… calls

Register the OTel-level callback once in the constructor and delegate to a
single replaceable closure, so calling observe() again replaces rather than
adds another callback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…try adapter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
loks0n and others added 11 commits July 8, 2026 12:07
chore(telemetry): drop unused ext-opentelemetry requirement
docs: enforce documentation style with Vale
fix(telemetry): register instruments on first write
…ion-suggest

fix(telemetry): make ext-protobuf a suggestion, not a requirement
chore: stop committing package lock files
…trics

fix(telemetry): omit empty metrics from OTLP exports
…ad-pooled-connection

fix(telemetry): retry an export once when the pooled connection is reset mid-request
perf(telemetry, circuit-breaker): record less per call on the cache path
…57a97b3704'

git-subtree-dir: packages/telemetry
git-subtree-mainline: ca3c55a
git-subtree-split: 852e76c
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Fifth package on the plan in rfc/monorepo.md. Imported from the mirror
with history (the preceding subtree merge), src/Telemetry flattened to
src/, tests/Telemetry flattened to tests/ under Utopia\Telemetry\Tests\,
the OTLP transport tests that bind a loopback Swoole server moved to
tests/E2E/, the package PHPStan config standalone at its own level max,
rector.php standalone with phpunitCodeQuality dropped.

Nine vendored packages require utopia-php/telemetry; the root now replaces
it and hoists its four third-party requirements (nyholm/psr7,
open-telemetry/exporter-otlp, open-telemetry/sdk, symfony/http-client).
The lock drops only utopia-php/telemetry.

Appwrite ran 0.4.10; the mirror head is one merge past the 0.4.11 tag and
the only public-surface change since 0.4.8 is an added exporter wrapper.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@loks0n loks0n self-assigned this Sep 16, 2026
@greptile-apps

greptile-apps Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Comment thread packages/telemetry/composer.json
Comment on lines +47 to +51
public function testConstructorParsesEndpointCorrectly(): void
{
$transport = new Swoole('https://otel.example.com:4318/v1/metrics?foo=bar');

$this->assertSame(ContentTypes::PROTOBUF, $transport->contentType());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Tests provide false coverage

These tests claim to cover endpoint parsing, headers, timeouts, pool sizing, socket buffers, query strings, and default ports, but merely assert the unrelated content type. They would remain green if every named behavior were broken. The same implementation-coupled pattern appears in LazyInstrumentTest.php, which asserts adapter storage arrays and object identity. This violates the repository directive to test observable behavior rather than mirror source parameters or configuration, so the requirement must be satisfied before merging.

Context Used: Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/telemetry/tests/Adapter/OpenTelemetry/Swoole/TransportTest.php
Line: 47-51

Comment:
**Tests provide false coverage**

These tests claim to cover endpoint parsing, headers, timeouts, pool sizing, socket buffers, query strings, and default ports, but merely assert the unrelated content type. They would remain green if every named behavior were broken. The same implementation-coupled pattern appears in `LazyInstrumentTest.php`, which asserts adapter storage arrays and object identity. This violates the repository directive to test observable behavior rather than mirror source parameters or configuration, so the requirement must be satisfied before merging.

**Context Used:** Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pre-existing in the imported library at mirror commit 852e76c (the 0.4.11 release). An absorb PR relocates the package with its history and does not change library behaviour or tests, matching #13723, #13798, #13804 and #13829. Strengthening these transport tests belongs in its own change against packages/telemetry.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That’s fair. Since this PR only relocates the imported package and preserves the tests from mirror commit 852e76c, the weak assertions are pre-existing and not an absorption regression. I’ll withdraw this as a merge blocker; strengthening the transport (and analogous lazy-instrument) tests is appropriately handled in a follow-up change against packages/telemetry.

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → feat/absorb-telemetry (after).

Metric Before After Change
🚀 Requests/sec 202.71 204.89 ⚪ +1.1%
⏱️ Latency P50 84.29 ms 84.62 ms ⚪ +0.4%
⏱️ Latency P95 204.91 ms 197.6 ms ⚪ -3.6%
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 84.62 197.6 12,711 204.89 -7.31
Account 158.19 288.03 669 11.14 -45.25
TablesDB 81.95 152.47 6,913 113.14 -7.47
Storage 77.62 179.74 3,345 56.71 +17.34
Functions 121.27 235.84 1,784 30.91 -13.54

Top API waits (after)

API request Max wait (ms)
functions.variables.update 491.21
functions.create 422.05
storage.files.create 420.51
tablesdb.rows.update 420.47
account.name.update 411.29

Prettier flags the file on every commit that stages it, which blocks
merging main into feature branches; quotes and trailing newline only.
# Conflicts:
#	composer.json
#	composer.lock
#	mongo-init.js
@ChiragAgg5k

Copy link
Copy Markdown
Member

…ent traffic test

curl under Swoole's coroutine hook fails on CI without reaching the API,
so the six creates never happened and every receiver timed out waiting
for events. Race the creates through the client's curl_multi batch
instead, keep the five receivers as coroutines, and move every assertion
outside the scheduler so a failure is reported instead of killing the
process. The same pattern was removed from the client in 3194210.
Comment thread tests/e2e/Services/Realtime/RealtimeCustomClientTest.php
@ChiragAgg5k
ChiragAgg5k merged commit 7eab5f1 into main Sep 22, 2026
156 of 162 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the feat/absorb-telemetry branch September 22, 2026 15:52
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.

5 participants