Repository navigation
feat(mqtt): drive telemetry collection on the broker worker - #14115
Merged
Merged
Conversation
The broker's OpenTelemetry adapter uses an ExportingReader, which only exports when collect() is called. onWorkerStart scheduled the per-project usage flush but never drove telemetry collection, so http/realtime/worker/ cli all exported while the broker's mqtt.* instruments never reached the endpoint. Capture $telemetry in onWorkerStart and tick collect() every 60s next to the usage flush, matching the other entrypoints. collect() is a no-op on NoTelemetry, so this is safe when no exporter is configured. Co-Authored-By: Claude Opus 4.8 <[email protected]>
🟢 Tier S · Ready to merge
The MQTT broker captures its telemetry adapter in the worker-start callback and schedules collection every 60 seconds when telemetry is enabled. The existing usage flush and Redis subscription bridge remain unchanged. Latest changes: The newest commit skips registering the collection timer for the no-op telemetry adapter.
📂 Walkthrough · 1
Reviewed the commits since |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
CE always resolves telemetry to NoTelemetry (app/init/resources.php), so an unconditional collect() tick is a no-op timer self-hosted. Gate it on a real adapter; cloud binds OpenTelemetry on the container, so the tick arms there and stays off everywhere else. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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]>
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The MQTT broker records
mqtt.*instruments but never exports them — the series are absent in Grafana.The
OpenTelemetryadapter uses anExportingReader, which only exports whencollect()is called. Every other entrypoint drives it with aTimer::tick(60_000, fn () => $telemetry->collect())in its worker start (app/http.php,app/realtime.php,app/worker.php,app/cli.php). The broker'sonWorkerStartalready ticks for the per-project usage flush, but it never captured$telemetryand never calledcollect().Change
Capture
$telemetryinonWorkerStartand tickcollect()every 60s, right next to the existing usage flush. The broker isSWOOLE_BASEsingle-process, so the top-level$telemetryinstance is the same one the instruments record into — collecting it in-worker flushes the real data.collect()is a no-op onNoTelemetry, so this is safe when no exporter is configured (the default).This is the server-ce half of the fix; the cloud entrypoint that constructs the broker's
OpenTelemetryadapter is appwrite-labs/cloud#6288, which tracksserver-ceviadev-mainand will pull this once merged. Together they makemqtt_*populate the dashboard in appwrite-labs/monitoring#568.Verification
php -lclean,composer lintpasses.collect()is defined on the telemetry adapter and already driven identically by the other four entrypoints.Co-Authored-By: Claude Opus 4.8 [email protected]
🤖 Generated with Claude Code