Skip to content

Autogenerate ProfileEvents and CurrentMetrics descriptions#5749

Merged
Blargian merged 2 commits intomainfrom
autogenerate-events-metrics-descriptions
Mar 16, 2026
Merged

Autogenerate ProfileEvents and CurrentMetrics descriptions#5749
Blargian merged 2 commits intomainfrom
autogenerate-events-metrics-descriptions

Conversation

@alexey-milovidov
Copy link
Member

@alexey-milovidov alexey-milovidov commented Mar 13, 2026

Summary

  • The system.events docs page was missing a list of all individual ProfileEvents entirely
  • The system.metrics page had a manually maintained table (~185 metrics) that could become outdated
  • The system.asynchronous_metrics page had a large manually maintained descriptions section
  • The system.histogram_metrics page had a small manually maintained descriptions section
  • When querying system.events, ClickHouse hides events with zero counters by default (system_events_show_zero_values=0), so any query-based generation would miss unfired events
  • Descriptions embedded in the ClickHouse binary are already Markdown-formatted, so the output uses heading-based format (### MetricName + description paragraph) rather than Markdown tables, to preserve formatting

This PR replaces all hardcoded description lists with autogeneration:

  • generate-events-list.sql — queries system.events with SET system_events_show_zero_values = 1 to include ALL ProfileEvents
  • generate-metrics-list.sql — queries system.metrics for all CurrentMetrics
  • generate-asynchronous-metrics-list.sql — queries system.asynchronous_metrics
  • generate-histogram-metrics-list.sql — queries system.histogram_metrics
  • autogenerate-settings.sh — new generate_descriptions_list() helper that:
    • Runs the SQL query via ClickHouse
    • Automatically adds AUTOGENERATED_DESCRIPTIONS tags to doc pages (no changes needed in the ClickHouse repo)
    • Replaces any existing hardcoded descriptions section
    • Inserts generated content between the tags
  • insert_content_between_tags() now supports custom tag names via optional parameters (backward compatible)

Test plan

  • Run yarn autogenerate-settings and verify all 4 doc pages get complete descriptions:
    • docs/operations/system-tables/events.md — all ProfileEvents including zero-valued ones
    • docs/operations/system-tables/metrics.md — all CurrentMetrics
    • docs/operations/system-tables/asynchronous_metrics.md — all async metrics
    • docs/operations/system-tables/histogram_metrics.md — all histogram metrics
  • Verify Markdown formatting in descriptions renders correctly (backticks, links, etc.)
  • Verify existing autogeneration (column descriptions, settings, functions) still works

🤖 Generated with Claude Code

The system.events documentation page was missing a list of all individual
ProfileEvents. The system.metrics page had a manually maintained table
that could become outdated. This adds autogeneration for both:

- New SQL file for ProfileEvents that uses system_events_show_zero_values=1
  to include ALL events, not just those with non-zero counters
- New SQL file for CurrentMetrics descriptions
- Updated autogenerate-settings.sh to run these queries and inject the
  results into events.md and metrics.md (adding section tags automatically
  if they don't exist, and replacing any existing hardcoded table)
- Made insert_content_between_tags() support custom tag names

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexey-milovidov alexey-milovidov requested a review from a team as a code owner March 13, 2026 22:57
@vercel
Copy link

vercel bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clickhouse-docs Ready Ready Preview, Comment Mar 15, 2026 2:57am
4 Skipped Deployments
Project Deployment Actions Updated (UTC)
clickhouse-docs-jp Ignored Ignored Mar 15, 2026 2:57am
clickhouse-docs-ko Ignored Ignored Preview Mar 15, 2026 2:57am
clickhouse-docs-ru Ignored Ignored Preview Mar 15, 2026 2:57am
clickhouse-docs-zh Ignored Ignored Preview Mar 15, 2026 2:57am

Request Review

@alexey-milovidov
Copy link
Member Author

Formatting is broken.

- Switch SQL output from Markdown tables to heading-based format
  (### MetricName + description paragraph) to properly support Markdown
  in embedded descriptions
- Add autogeneration for asynchronous_metrics and histogram_metrics,
  replacing their hardcoded description sections too
- Refactor repeated code into generate_descriptions_list() helper
- The function handles all cases: replacing existing hardcoded sections,
  inserting before **See Also**, or appending at end of file

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pinku888111222

This comment was marked as off-topic.

@alexey-milovidov
Copy link
Member Author

Remove "The following events are available in ClickHouse OSS:" from the system.events page.

@alexey-milovidov
Copy link
Member Author

It is in the main ClickHouse repo, so ok to merge this first.

@Blargian Blargian self-assigned this Mar 16, 2026
Copy link
Member

@Blargian Blargian left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for pointing out system_events_show_zero_values = 1. That simplifies things greatly.

@Blargian Blargian merged commit 84e1971 into main Mar 16, 2026
17 checks passed
Blargian added a commit to ClickHouse/ClickHouse that referenced this pull request Mar 16, 2026
Remove hardcoded table in favour of autogenerated one introduced in ClickHouse/clickhouse-docs#5749
ivanmantova pushed a commit to ivanmantova/ClickHouse that referenced this pull request Mar 18, 2026
Remove hardcoded table in favour of autogenerated one introduced in ClickHouse/clickhouse-docs#5749
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