Skip to content

Add usage report for jf api#3479

Open
ehl-jf wants to merge 3 commits into
masterfrom
JGC-485-api-usage-reporting
Open

Add usage report for jf api#3479
ehl-jf wants to merge 3 commits into
masterfrom
JGC-485-api-usage-reporting

Conversation

@ehl-jf
Copy link
Copy Markdown
Contributor

@ehl-jf ehl-jf commented May 11, 2026

Summary

Wires jf api into the existing usage-reporting and metrics pipeline used by other top-level commands:

  • Collects the flags the user set and forwards them to commands.CollectMetrics("api", …).
  • Runs commands.ReportUsage in a goroutine alongside the HTTP call, with a --timeout-bounded wait and recover so reporting can't crash or hang jf api.
  • Adds a reportUsageFn indirection to make the reporting path unit-testable without HTTP.
  • Bumps jfrog-cli-core to pick up the CollectMetrics API.

Test plan

Six new unit tests in general/api/cli_test.go covering metrics collection, the timeout-bounded wait helper, the disabled-reporting env var, panic recovery, slow-reporter timeout cutoff, and fast-reporter happy path.


  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • The pull request is targeting the master branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....

@github-actions
Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@ehl-jf ehl-jf added safe to test Approve running integration tests on a pull request improvement Automatically generated release notes labels May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Automatically generated release notes safe to test Approve running integration tests on a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants