[ 
https://issues.apache.org/jira/browse/HDDS-16719?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chi-Hsuan Huang updated HDDS-16719:
-----------------------------------
    Description: 
Follow-up to HDDS-16611.

{{OMMetrics}} declares {{numSnapshotActive}}, {{numSnapshotDeleted}} and 
{{numTenants}} as {{MutableCounterLong}}, but they behave like gauges:
* {{decNumSnapshotActive()}}, {{decNumSnapshotDeleted()}} and 
{{decNumTenants()}} decrement with {{incr(-1)}}.
* {{setNumSnapshotActive()}} and {{setNumSnapshotDeleted()}} emulate a set via 
{{incr(num - currVal)}}. The caller in {{OzoneManager}} already names these 
values {{activeGauge}} and {{deletedGauge}}.

As a result, {{/prom}} exports them as {{# TYPE counter}}, and Prometheus 
treats any decrease as a counter reset. The bundled OM Snapshot dashboard only 
plots the raw values, so it is not affected today. Any {{rate()}} or 
{{increase()}} query on these metrics would report wrong values.

Proposed changes:
* Switch the three fields to {{MutableGaugeLong}} and use {{set()}} in the two 
setters.
* Update {{TestOmMetrics}} to read {{NumSnapshotActive}} and 
{{NumSnapshotDeleted}} with {{getLongGauge}} instead of {{getLongCounter}}.

Metric names in {{/jmx}} and {{/prom}} stay the same.


  was:
Follow\-up to HDDS\-16611.

{{OMMetrics}} declares {{numSnapshotActive}}, {{numSnapshotDeleted}} and 
{{numTenants}} as {{MutableCounterLong}}, but they behave like gauges:
\* {{decNumSnapshotActive\(\)}}, {{decNumSnapshotDeleted\(\)}} and 
{{decNumTenants\(\)}} decrement with {{incr\(\-1\)}}.
\* {{setNumSnapshotActive\(\)}} and {{setNumSnapshotDeleted\(\)}} emulate a set 
via {{incr\(num \- currVal\)}}. The caller in {{OzoneManager}} already names 
these values {{activeGauge}} and {{deletedGauge}}.

As a result, {{/prom}} exports them as {{# TYPE counter}}, and Prometheus 
treats any decrease as a counter reset. The bundled OM Snapshot dashboard only 
plots the raw values, so it is not affected today. Any {{rate\(\)}} or 
{{increase\(\)}} query on these metrics would report wrong values.

Proposed changes:
\* Switch the three fields to {{MutableGaugeLong}} and use {{set\(\)}} in the 
two setters.
\* Update {{TestOmMetrics}} to read {{NumSnapshotActive}} and 
{{NumSnapshotDeleted}} with {{getLongGauge}} instead of {{getLongCounter}}.

Metric names in {{/jmx}} and {{/prom}} stay the same.


> Use MutableGaugeLong for snapshot and tenant counts in OMMetrics
> ----------------------------------------------------------------
>
>                 Key: HDDS-16719
>                 URL: https://issues.apache.org/jira/browse/HDDS-16719
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: Ozone Manager
>            Reporter: Chi-Hsuan Huang
>            Assignee: Chi-Hsuan Huang
>            Priority: Minor
>
> Follow-up to HDDS-16611.
> {{OMMetrics}} declares {{numSnapshotActive}}, {{numSnapshotDeleted}} and 
> {{numTenants}} as {{MutableCounterLong}}, but they behave like gauges:
> * {{decNumSnapshotActive()}}, {{decNumSnapshotDeleted()}} and 
> {{decNumTenants()}} decrement with {{incr(-1)}}.
> * {{setNumSnapshotActive()}} and {{setNumSnapshotDeleted()}} emulate a set 
> via {{incr(num - currVal)}}. The caller in {{OzoneManager}} already names 
> these values {{activeGauge}} and {{deletedGauge}}.
> As a result, {{/prom}} exports them as {{# TYPE counter}}, and Prometheus 
> treats any decrease as a counter reset. The bundled OM Snapshot dashboard 
> only plots the raw values, so it is not affected today. Any {{rate()}} or 
> {{increase()}} query on these metrics would report wrong values.
> Proposed changes:
> * Switch the three fields to {{MutableGaugeLong}} and use {{set()}} in the 
> two setters.
> * Update {{TestOmMetrics}} to read {{NumSnapshotActive}} and 
> {{NumSnapshotDeleted}} with {{getLongGauge}} instead of {{getLongCounter}}.
> Metric names in {{/jmx}} and {{/prom}} stay the same.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to