refactor(exporter): remove dead MetricFixedString interface method + FixedStringCol class#114
Merged
Merged
Conversation
4 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Removes dead fixed-width string metric support from the exporter abstraction after err_sqlstate moved to LowCardinality(String), leaving no remaining call sites for the fixed-string API.
Changes:
- Removed
MetricFixedString(int len, string_view name)from theStatsExporterinterface. - Removed now-unused overrides from
OTelExporterandClickHouseExporter. - Deleted the ClickHouse-only
FixedStringColimplementation class.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/export/exporter_interface.h |
Drops the MetricFixedString pure virtual from StatsExporter. |
src/export/otel_exporter.cc |
Removes the MetricFixedString override (previously a string_view column). |
src/export/clickhouse_exporter.cc |
Removes MetricFixedString override and deletes the unused FixedStringCol column implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…FixedStringCol class `MetricFixedString` was added in Feb 2026 (commit 9f89f4) when err_sqlstate was the only column in events_raw of type FixedString(5). It had exactly one caller, exactly one width, and was always going to. PR #99 (merged 2026-06-10) changed err_sqlstate from FixedString(5) to LowCardinality(String) and updated the call site from `exporter->MetricFixedString(5, "err_sqlstate")` to `exporter->TagString("err_sqlstate")`. The interface method became unreferenced. PR #104 (merged 2026-06-04 — before #99) had to reproduce MetricFixedString in clickhouse-c by hand-rolling a `FixedStringCol` class, since clickhouse-c has no built-in FixedString column type unlike clickhouse-cpp. That work was correct when authored — the column was still live — but became orphaned a week later when #99 landed. Nobody noticed. Deletes the now-dead virtual + both impls. The CH-native side loses the 27-line FixedStringCol class entirely; the OTel side loses a 3-line forward to MakeSvCol; the interface loses one virtual declaration. Stats_exporter.cc already doesn't reference it. No behavior change — this was unreachable code. -35 LOC. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
212a7f0 to
50bca23
Compare
serprex
approved these changes
Jun 18, 2026
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.
Summary
Remove the
MetricFixedStringinterface method and theFixedStringColclass that implements it. Both became unreferenced when PR #99 changederr_sqlstatefromFixedString(5)toLowCardinality(String). Pure deletion; no behavior change. -35 LOC, three files.Why this is its own PR
MetricFixedStringwas added in commit 9f89f4 (Feb 25 2026, "Extract an interface for statistics reporting") as a one-liner overclickhouse::ColumnFixedStringfrom the clickhouse-cpp library. It served exactly one column (err_sqlstate, width 5).PR #104 (merged 2026-06-04) replaced clickhouse-cpp with clickhouse-c, which doesn't have a built-in fixed-string column class. To preserve the interface contract, the port hand-rolled a 27-line
FixedStringColclass on top of clickhouse-c's lower-levelAppendFixedprimitive. At landing time this was correct —err_sqlstatewas stillFixedString(5)in the schema and the call site was stillMetricFixedString(5, "err_sqlstate").PR #99 (merged 2026-06-10, six days later) changed
err_sqlstatetoLowCardinality(String)because FixedString does not round-trip cleanly through the Arrow IPC pipeline that prod uses, and ~270 SQLSTATE codes are dictionary-friendly. The call site moved toTagString("err_sqlstate"). The interface method and the hand-rolled class became unreachable code in main. Nobody noticed at the time.This PR removes both. The reasoning that pushed
err_sqlstatetoLowCardinality(String)in PR #99 also explains why we don't want to re-add FixedString support to clickhouse-c "for parity" — the only consumer in this codebase was already moved off it deliberately, and any future fixed-width-binary column would hit the same Arrow round-trip issue.Why FixedString isn't the right type for SQLSTATE (in case the question comes up)
FixedString(5)LowCardinality(String)(~270 codes)FixedSizeBinary— not transparently castable toFixedString(N)on the CH sideDictionaryUtf8— round-trips cleanlyThe Arrow round-trip is the deciding factor; storage and query speed both happen to favor LC too.
Test plan
This is a no-op refactor; the deleted code was unreachable.
🤖 Generated with Claude Code
Note
Low Risk
Pure deletion of unreachable interface and implementation code with no remaining call sites.
Overview
Removes
MetricFixedStringfromStatsExporterand drops the ClickHouse-onlyFixedStringColimplementation that backed it.ClickHouseExporterandOTelExporterno longer declare that factory method.This is cleanup after
err_sqlstatemoved toTagString/LowCardinality(String); nothing in the tree still calls the fixed-width metric path. Export behavior is unchanged.Reviewed by Cursor Bugbot for commit 50bca23. Bugbot is set up for automated code reviews on this repo. Configure here.