Remove the usage file - #415
Draft
janvanicek wants to merge 1 commit into
Draft
Conversation
`UsageFile` read `out/usage.json`, validated it and handed it to `Client::addJobUsage()`, which has had an empty body since 2019 — the payload was always discarded. This was the only caller. `UsageFileTest` mocked `addJobUsage` and asserted it was called, so it stayed green against a method that does nothing; that is why this went unnoticed. Requires the matching keboola/dockerbundle change: `Runner::run()` loses its fifth parameter. Merge dockerbundle first, then `composer update keboola/dockerbundle` here.
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.
Context
Linear: PAT-2006
The usage file has never worked. A component could report its own consumption by writing
out/usage.json;job-runner'sUsageFileread it, validated it, and handed it toClient::addJobUsage()— a method with an empty body (// todo implement this) since it was introduced on 2019-07-04 (af3033b). Verified at the version pinned into job-runner's production build (keboola/job-queue-internal-api-php-client25.5.0).job-runnerwas the only caller, and nothing subclassesClient.So
usageDatais[]on every queue v2 job (100% of jobs in the last 90 days — 23,010,147). Nothing consumes it either: zero hits forusageData/usage_dataintelemetry-billing,billing-api,telemetry-billing-gcporconnection, and the telemetrykbc_jobextract has no usage column.UsageFileTestmockedaddJobUsageand asserted it was called, so it stayed green against a method that does nothing — that is why this survived seven years.Only one component in the org writes a usage file:
keboola.ex-google-analytics-v4. Its reports have been discarded all along, so nothing changes for it.Deployment order for this batch
keboola/docker-bundle—Runner::run()loses its fifth parameterkeboola/job-runner— thencomposer update keboola/dockerbundlekeboola/job-queue— removesaddJobUsage()from the client. The standalonekeboola/job-queue-internal-api-php-clientis synced from the monorepo, so it picks this up automatically and then needs a new major tag.keboola/developers-docs+keboola/connection-docs— last, so the docs do not get ahead of the deployed behaviourWhat this PR does
Deletes
src/UsageFile.phpandtests/UsageFileTest.php, and drops the construction and theRunner::run()argument inRunCommand.Blocked on keboola/docker-bundle#810 —
Runner::run()loses its fifth parameter. Merge that first, then runcomposer update keboola/dockerbundleon this branch before merging.Verified:
composer phpcsclean.composer phpstanagainst the current lock reports exactly the two expected index-shift errors (Parameter #5,Parameter #7) and nothing else; built against the docker-bundle branch it reports no errors.Release Notes
Justification, description
UsageFilereadout/usage.json, validated it and passed it toClient::addJobUsage(), which does nothing. This was the only caller anywhere.Plans for Customer Communication
None needed — the feature never had an effect. The docs advertising it are removed in the paired
developers-docsandconnection-docsPRs.Impact Analysis
No API or contract change in this service. One behaviour change inherited from docker-bundle: a malformed
out/usage.jsonno longer fails an otherwise successful job (that validation was the feature's only observable effect, and it had no counterpart onk8sContainers).$component->getConfigurationFormat()was only read here to pickusage.jsonvsusage.yml; it is still used elsewhere for the config file.Deployment Plan
Second in the batch. Requires docker-bundle merged plus a lock bump on this branch. Standard job-runner release afterwards — the DinD executor pod picks up the new image on the next job.
Rollback Plan
Revert this PR and the docker-bundle one, redeploy the previous job-runner image. No state, no migration.
Post-Release Support Plan
Nothing specific. This change cannot make a previously-passing job fail.