Repository navigation
Add optional app option sent with every log and metric - #5
Merged
Merged
Conversation
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.
Merge only after the backend change is deployed
The production API rejects unknown body fields with HTTP 400 until the backend change in logdash-io/logdash.io (branch
malini/01J81668FC698FE4F1F86F87AA) is live.Until then, every log and metric sent with
appset is rejected, and the SDK drops it silently.Instances without
appsend exactly the same payloads as before.Do not merge, tag or release to Packagist before that deploy.
What
New optional
appoption onLogdash::create().A domain key is shared by all apps of a domain, and
appnames the app sending the data, so the dashboard can filter by it.appset: everyPOST /logsandPUT /metricsbody carries"app": "<value>", trimmed.appunset, empty or blank: the key is left out, no null and no empty string.app. The server cuts it to 64 characters.namespacewith metrics, so the backend's newnamespacefield onPUT /metricsdoes not affect it.Interaction with #4
#4 moves logs to
POST /logs/batchand queues metrics.Whichever PR merges second adds the
appline to the twoqueue->add([...])arrays, so every batch entry and every metric carries it, and callsflush()in the new tests before reading the bodies.Tests
New tests run the SDK against PHP's built-in server and check the bodies it receives for logs and metrics, with and without
app.They fail on
mainand catch dropping, nulling or not trimmingapp.composer qa(PHPCS, parallel-lint, PHPStan, PHPUnit) passes in the repo's PHP 8.1 Docker image, 25 of 25 test runs green.CI
The
testjob now runscomposer run-script test, so PHPUnit runs on every pull request; before, CI ran only PHPStan and PHPCS.Also fixes what actionlint reports on the workflow:
actions/cache@v3is bumped tov4, and$GITHUB_OUTPUTis quoted in the tag step.