Skip to content

Fix: msdms log fields emit dash instead of -1 for unset milestones#12900

Merged
bryancall merged 2 commits intoapache:masterfrom
bryancall:msdms-dash-for-unset-milestones
Feb 21, 2026
Merged

Fix: msdms log fields emit dash instead of -1 for unset milestones#12900
bryancall merged 2 commits intoapache:masterfrom
bryancall:msdms-dash-for-unset-milestones

Conversation

@bryancall
Copy link
Contributor

@bryancall bryancall commented Feb 19, 2026

Problem

The MSDMS milestone logging fields emit -1 as a literal string when a milestone is unset (i.e., difference_msec() returns -1 because one or both milestones never fired). Log parsers must treat -1 as a magic sentinel to distinguish "0 ms" (valid sub-millisecond timing) from "not applicable."

Changes

  • Add unmarshal_milestone_diff() function -- outputs a single - character when the marshalled milestone difference equals the -1 sentinel (milestone was unset), instead of emitting the literal string -1. Makes log parsing cleaner: parsers distinguish "0 ms" from "not applicable" without checking for magic integers.
  • Wire MSDMS container to new unmarshal function -- LogField.cc now assigns unmarshal_milestone_diff instead of the generic unmarshal_int_to_str for MSDMS fields.
  • Only map the -1 sentinel, not all negatives -- preserves potentially useful debug info from reversed milestone pairs (end < start).

Testing

Add unmarshal_milestone_diff() which outputs a single "-" character
when the marshalled value is negative (milestone was unset), instead
of the literal string "-1". This makes log parsing cleaner -- parsers
can distinguish between "0 ms" (a valid timing) and "not applicable"
without checking for a magic integer value.

The MSDMS container now uses this new unmarshal function instead of
the generic unmarshal_int_to_str.
@bryancall bryancall added this to the 10.2.0 milestone Feb 19, 2026
@bryancall bryancall self-assigned this Feb 19, 2026
@bryancall bryancall requested a review from Copilot February 19, 2026 22:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR changes how msdms (milestone-delta-in-ms) log fields are rendered in ASCII logs so that unset milestone deltas are emitted as a single - character rather than -1, making downstream parsing distinguish “not applicable” from valid numeric timings.

Changes:

  • Add LogAccess::unmarshal_milestone_diff() to render milestone deltas as - when the marshalled value indicates “unset”.
  • Switch LogField’s MSDMS container to use unmarshal_milestone_diff instead of the generic integer unmarshaller.
  • Expose the new unmarshal helper via LogAccess.h.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/proxy/logging/LogField.cc Uses the new milestone-delta unmarshaller for MSDMS container fields.
src/proxy/logging/LogAccess.cc Implements unmarshal_milestone_diff() to customize formatting of milestone deltas.
include/proxy/logging/LogAccess.h Declares the new unmarshal helper in the LogAccess API.
Comments suppressed due to low confidence (1)

src/proxy/logging/LogAccess.cc:651

  • For consistency with the other integer unmarshal helpers (e.g., unmarshal_int_to_str()), the buffer-size guard here should follow the same convention (required_len < len). Using len >= 1 allows writing when the destination buffer is exactly 1 byte, where other int-to-string helpers would treat it as an overrun. Consider changing this to require 1 < len (or otherwise align it with the established checks in this file).
  if (val < 0) {
    if (len >= 1) {
      dest[0] = '-';
      return 1;
    }
    DBG_UNMARSHAL_DEST_OVERRUN
    return -1;

Copilot correctly noted that val < 0 would also catch reversed
milestone pairs (end < start), hiding potentially useful debug
info.  Tighten to val == -1 which is the specific "missing"
sentinel returned by difference_msec() when a milestone is unset.
@bryancall bryancall closed this Feb 20, 2026
@bryancall bryancall reopened this Feb 20, 2026
@bryancall bryancall requested a review from cmcfarlen February 21, 2026 01:19
@bryancall bryancall merged commit 3d73f1c into apache:master Feb 21, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants