Xuanwo opened a new pull request, #8773:
URL: https://github.com/apache/opendal/pull/8773

   # Which issue does this PR close?
   
   N/A. This fixes a verified bug in `core/layers/prometheus-client` and 
`core/layers/fastmetrics`.
   
   # Rationale for this change
   
   `OperationLabels` derives `Eq, Hash` over `MetricLabels`, which includes 
`root`. When `disable_label_root(true)` is configured, `EncodeLabelSet::encode` 
omits the `root` label, but `Family` still keys entries by the full label set. 
Sharing one layer between two operators with `root("/a")` and `root("/b")` 
therefore stores two entries that encode to the same label set, so Prometheus 
receives duplicate series with split counts. This is invalid exposition and 
makes aggregation depend on which series is read.
   
   # What changes are included in this PR?
   
   - Normalize `root` in the `Family` key when the root label is not encoded, 
so the key matches the emitted label set.
   - Add regression tests for both metric layers that assert roots aggregate 
into one series (`2`) when the root label is disabled and remain separate (`1` 
each) by default.
   
   # Are there any user-facing changes?
   
   With `disable_label_root(true)`, metrics from operators that share a layer 
and differ only in root now aggregate into one series instead of emitting 
duplicate series. The public API is unchanged.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - **Harness:** Pi coding agent
   - **Model:** `group/deepseek` (identifier reported by the harness; version 
not exposed)
   - **Effort:** max
   - **Role:** AI authored the fix and regression tests, ran format, clippy, 
and tests, and prepared this PR. Assumption: the tests call 
`MetricsIntercept::observe` with explicit labels because Memory derives its 
namespace from an allocation address, so two Memory operators cannot share the 
namespace required to reproduce the duplicate series.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to