Bug 2050737

Summary: Remove metrics and events for master port offsets
Product: OpenShift Container Platform Reporter: Aneesh Puttur <aputtur>
Component: Cloud Native EventsAssignee: Aneesh Puttur <aputtur>
Cloud Native Events sub component: Cloud Event Proxy QA Contact: obochan <obochan>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: aos-bugs, aputtur, ijolliff, jacding, keyoung, obochan
Version: 4.10   
Target Milestone: ---   
Target Release: 4.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2047308 Environment:
Last Closed: 2022-03-10 16:43:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2047308    
Bug Blocks:    

Comment 4 obochan 2022-03-02 08:00:17 UTC
Aneesh please the status of the issue from what i see it isn't solved , correct me if i am wrong .
there 2 scenarios for that :
1 events are enabled
2 events are disabled

What we can see if when the events are enabled we realtime clock and slave interface with x(I.E ens5fx)
When they are disabled we see on the inteface with the x.

you have all the logs attached and metric you can see below, as shared with you over the slack.

Events are enabled
[obochan@obochan ptp_goLang]$ oc -n openshift-ptp exec linuxptp-daemon-zg77d -c linuxptp-daemon-container -- curl 127.0.0.1:9091/metrics | grep "openshift_ptp_clock"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3426    0  3426    0     0  3345k      0 --:--:-- --:--:-- --:--:-- 3345k
# HELP openshift_ptp_clock_state 0 = FREERUN, 1 = LOCKED, 2 = HOLDOVER
# TYPE openshift_ptp_clock_state gauge
openshift_ptp_clock_state{iface="CLOCK_REALTIME",node="cnfde4.ptp.lab.eng.bos.redhat.com",process="phc2sys"} 1
openshift_ptp_clock_state{iface="ens5fx",node="cnfde4.ptp.lab.eng.bos.redhat.com",process="ptp4l"} 1

Events are disabled
[obochan@obochan ptp_goLang]$ oc -n openshift-ptp exec linuxptp-daemon-npkk4 -c linuxptp-daemon-container -- curl 127.0.0.1:9091/metrics | grep "openshift_ptp_clock"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2340    0  2340    0     0  2285k      0 --:--:-- --:--:-- --:--:-- 2285k
# HELP openshift_ptp_clock_state 0 = FREERUN, 1 = LOCKED, 2 = HOLDOVER
# TYPE openshift_ptp_clock_state gauge
openshift_ptp_clock_state{iface="ens5fx",node="cnfde4.ptp.lab.eng.bos.redhat.com",process="ptp4l"} 1

Comment 5 Aneesh Puttur 2022-03-02 15:28:30 UTC
@obochan,
 It works as expected.
 The Ptp state is generated only for offset values. 
When you are running nonevent options and you see RMS offset for clock_realtime, which cannot be used to indicate PTP  state.

ptp4l[10379.482]: [ptp4l.0.config] master offset          0 s2 freq   -1001 path delay       361
phc2sys[10379.530]: [ptp4l.0.config] CLOCK_REALTIME rms    8 max    8 freq -86744 +/-   0 delay   576 +/-   0
phc2sys[10379.531]: [ptp4l.0.config] ens1f3 rms   33 max   33 freq  -5465 +/-   0 delay  3713 +/-   0

From this log,  You can see  only the master offset is valid to indicate the PTP state (Freerun,locked)
Hence you will see only one PTP state for  slave port (ensfX)

`
openshift_ptp_clock_state{iface="ens5fx",node="cnfde4.ptp.lab.eng.bos.redhat.com",process="ptp4l"} 1
`

But while using event with the following required options

`
ptp4lOpts: "-2 --summary_interval -4" 
phc2sysOpts: "-a -r -m -n 24 -N 8 -R 16"
`

You get the following metrics 

`
phc2sys[9732.869]: [ptp4l.0.config] CLOCK_REALTIME phc offset         8 s2 freq  -86702 delay    518
phc2sys[9732.923]: [ptp4l.0.config] ens1f3 phc offset         1 s2 freq   -5404 delay   3968
ptp4l[9732.923]: [ptp4l.0.config] master offset          7 s2 freq    -979 path delay       361
ptp4l[9732.978]: [ptp4l.0.config] master offset         -3 s2 freq    -996 path delay       361
`

Here you will see the PTP state for both CLOCK_REALTIME and master offset ( the master port (ens1f3) offset is ignored from reporting )
Because  we see offset between the  port and GM, and offset between port and system clock 

`
openshift_ptp_clock_state{iface="CLOCK_REALTIME",node="cnfde4.ptp.lab.eng.bos.redhat.com",process="phc2sys"} 1
openshift_ptp_clock_state{iface="ens5fx",node="cnfde4.ptp.lab.eng.bos.redhat.com",process="ptp4l"} 1
`

Comment 6 obochan 2022-03-02 15:31:24 UTC
Following the clarification form Aneesh i move the issue to verified

Comment 8 errata-xmlrpc 2022-03-10 16:43:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.10.3 security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:0056