Repository navigation
edac: Fix printf-style formatting in slog call - #3759
Merged
Merged
Conversation
The Debug call added in prometheus#3734 passes printf verbs and positional arguments to slog, which does not format them. The format string is logged verbatim and the arguments are consumed as key/value pairs, so controller and channel numbers become attribute keys: a duplicate key when the two are equal, and otherwise a key whose name changes on every iteration. Under --log.format=json that is an object with a repeated key, and parsers silently drop one of the values. The csrow number and the error, the two things worth reading, are the only parts that survive, and they appear as values of meaningless keys. %w compounds it: that is an fmt.Errorf directive and not a valid Printf verb, left behind when the error return this replaced was converted to a log line. Pass the values as named attributes instead. Metric output is unchanged. Signed-off-by: Adam Butler <[email protected]>
Member
|
/workflow-approve |
ArthurSens
enabled auto-merge (squash)
August 21, 2026 14:29
Merged
SuperQ
added a commit
that referenced
this pull request
Nov 18, 2026
The behavior of `node_cpu_frequency_hertz` has changed. There are two different sources of data for this metric. One from the `cpu` collector, one from the `cpufreq` collector. Due to historical feature migrations the `cpufreq` collector shares the same subsystem as the `cpu` collector. This caused conflicting data behavior. An attempt to fix this was introduced in #3318. This behavior has been reverted to the previous behavior in #3795. A new flag (`--collector.cpufreq.enable-cpufreq-prefix`) has been introduced that gives the `cpufreq` a dedicated metric name subsystem (`node_cpufreq_...`). This will likely be the default in v2. * [CHANGE] netstat: Use procfs parsers for netstat, snmp and snmp6 #3796 * [CHANGE] edac: Fix no data results #3863 * [CHANGE] nvme: Deprecate metric nvme_namespace_capacity_bytes #3899 * [FEATURE] Add tainted collector for /proc/sys/kernel/tainted #3745 * [FEATURE] Add resctrl collector #3797 * [ENHANCEMENT] netstat: Add new FreeBSD metrics #3334 * [ENHANCEMENT] Add `chip` label to DRM metrics #3572 * [ENHANCEMENT] diskstats: add device-mapper backing device info metric #3676 * [ENHANCEMENT] textfile: support UTF-8 metric and label names #3729 * [ENHANCEMENT] ksmd: add general_profit metric #3778 #3894 * [BUGFIX] edac: Fix printf-style formatting in slog call #3759 * [BUGFIX] fibre_channel: fix crash when attempting to dereference invalid counters #3573 * [BUGFIX] thermal: Fix collecting Darwin temperatures without CPU power status #3767 * [BUGFIX] fibrechannel: Fix for ppc64le #3769 * [BUGFIX] cpu: Revert dup cpu frequency, add node_cpufreq flag #3795 * [BUGFIX] infiniband: skip sysfs reads for excluded devices #3824 * [BUGFIX] bcache: Fix btree_read_average_duration_seconds unit #3828 Signed-off-by: Ben Kochie <[email protected]>
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.
@SuperQ — small follow-up to #3734.
That PR converted the
ch*_ue_counterror return into a debug log, and thefmt.Errorfformat string came across with it.slogdoes no formatting, so the verbs are logged literally and the arguments after the message are consumed as key/value pairs:controllerNumberbecame a key withcsrowNumberas its value, andchannelNumberbecame a second key with the error as its value, so the controller/csrow/channel the message meant to report are no longer readable and the record carries0twice. Where the controller and channel numbers differ the second key is named after the channel instead, so the key set changes from one iteration to the next. Under--log.format=jsonthat is an object with a repeated key, and parsers silently drop one of the values.%wcompounds it: that is anfmt.Errorfdirective, not a validPrintfverb.After:
Reproduces on the existing fixtures:
mc0/csrow2hasch0_ce_countbut noch0_ue_count, so running with--log.level=debugagainstcollector/fixtures/syshits the branch. Present in v1.12.1 and on master. Metric output is unchanged — 20node_edacseries before and after, identical — andgofmt,go vetandend-to-end-test.share clean.On why CI didn't catch it, in case it's useful:
go vet's slog analyzer only fires when a key-position argument isn't a string or the arguments don't pair up, and here the count is even and all three are strings, so the call looks well formed to it. The e2e test does execute this line with debug logging enabled, but only diffs the metrics output. I have a smallgo/asttest that rejects Printf verbs in slog messages across the collector package — happy to raise it separately if you'd want it, equally happy to leave it.