Histograms
DevelopmenthistogramsHistograms is an Agent Skill for development published in the chromium/chromium repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Manage Chromium histograms and enums metadata. Use this skill when adding code that logs a histogram or when updating metadata in histograms.xml or enums.xml.
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/chromium/chromium/blob/HEAD/agents/skills/histograms/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/histograms, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Histograms
This skill provides guidance and workflows for logging histograms and managing their metadata in the Chromium codebase.
Overview
When adding code that logs a histogram, you must also add metadata about that histogram and any associated enums to ensure they are properly tracked and interpreted.
Guidelines
Metadata Files
- Histograms: Metadata goes in
histograms.xml. - Enums: Metadata about enums goes in
enums.xmlin the same directory as the correspondinghistograms.xml.
Directory Structure
Metadata files are located in subdirectories of
//tools/metrics/histograms/metadata/. The subdirectory name is based on the
first part of the histogram name (e.g., Platform.Foo would likely be in
metadata/platform/). If the correct subdirectory is unclear, ask the user.
Ownership
Histograms must have at least two owners:
- The user who requested the change (usually the primary owner).
- A relevant team (if possible). If you're unsure who to list as the second owner, ask the user.
Expiry Date
Set the expiry date to 3 months in the future from the date you add the histogram, unless a specific date is more appropriate.
Workflow
- Identify the Histogram: Determine the name of the histogram being logged or updated.
- Locate Metadata Directory: Find the appropriate subdirectory in
//tools/metrics/histograms/metadata/. - Update histograms.xml: Add or update the
<histogram>entry. - Update enums.xml (if applicable): If the histogram uses an enum, ensure
the corresponding
<enum>and its<int>values are defined inenums.xml. - Verify: Check
//tools/metrics/histograms/README.mdfor additional policies.