Skip to content

Gather qemu_binary_specified metrics - #3237

Open
cjreynol wants to merge 4 commits into
google:mainfrom
cjreynol:qemu_binary_flag_metrics
Open

cjreynol wants to merge 4 commits into
google:mainfrom
cjreynol:qemu_binary_flag_metrics

Conversation

@cjreynol

Copy link
Copy Markdown
Collaborator

Not the flag's value, but its existence in the invocation.

This required adding the FlagBase::IsDefaultForIndex helper to account for multi-device cases where the value is provided for some instances and unset is provided for others.

Bug: 476232062

@cjreynol cjreynol self-assigned this Sep 24, 2026
@cjreynol cjreynol added kokoro:force-run Trigger a presubmit build unconditionally. kokoro:run Run e2e tests. labels Sep 24, 2026
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed kokoro:run Run e2e tests. kokoro:force-run Trigger a presubmit build unconditionally. labels Sep 24, 2026
@cjreynol
cjreynol requested a review from jemoreira September 24, 2026 19:29
Comment thread base/cvd/cuttlefish/host/commands/assemble_cvd/flags/qemu_binary_dir.h Outdated
Comment on lines +41 to +45
if (index < is_default_values_.size()) {
return is_default_values_[index];
} else {
return is_default_values_[0];
}

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.

This assumes that is_default_values_ has at least one value, but the default value in the constructor is empty. Calling this in a ~default-constructed object will cause out of bounds errors.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed. Added an is_default_values_.empty() case.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

And fixed the issue you noticed in #3242 with the usage.

@cjreynol
cjreynol force-pushed the qemu_binary_flag_metrics branch from 1a6d21b to cf82ae2 Compare September 24, 2026 23:17
@cjreynol cjreynol added kokoro:force-run Trigger a presubmit build unconditionally. kokoro:run Run e2e tests. labels Sep 24, 2026
@cjreynol
cjreynol requested a review from jemoreira September 24, 2026 23:18
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed kokoro:run Run e2e tests. kokoro:force-run Trigger a presubmit build unconditionally. labels Sep 24, 2026
@cjreynol
cjreynol force-pushed the qemu_binary_flag_metrics branch from cf82ae2 to 2fe60c0 Compare September 24, 2026 23:36
To re-use the same parsing logic from metrics gathering.

Bug: 476232062
The per-index distinction of a provided value versus a default matters
for per-instance existence flag metrics like `qemu_binary_specified`.

For example, if a user passes `--qemu_binary_dir=<value>,unset,<value>`
then the complete `flag_info.is_default` will be false, but the middle
instance should return `false` for `qemu_binary_specified`.

The new field was added to the `FlagBase` constructor with a default
that matches current behavior and avoid updating all the existing calls.
It is trivial for the implementations that call the `from_gflags.h`
helpers where the value is determined, but flags with other
implementations are more complex.  Since the new
`FlagBase::IsDefaultForIndex` is only going to be used for a limited
number of metrics flags, I feel it is safe to defer that work until it
becomes necessary.

Bug: 476232062
Not yet converted for transmission, but available.

Bug: 476232062
@cjreynol
cjreynol force-pushed the qemu_binary_flag_metrics branch from 2fe60c0 to 685ae13 Compare September 25, 2026 18:35
@cjreynol cjreynol added kokoro:force-run Trigger a presubmit build unconditionally. kokoro:run Run e2e tests. labels Sep 25, 2026
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed kokoro:run Run e2e tests. kokoro:force-run Trigger a presubmit build unconditionally. labels Sep 25, 2026

This branch has not been deployed

No deployments
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.

3 participants