Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteInterfaceRoleMetrics(process, ptpInterface string)
- func DeletePTPHAMetrics(profile string)
- func DeleteProcessStatusMetricsForConfig(node string, cfgName string, process ...string)
- func DeleteSyncEMetrics(process, configName string, synceStats stats.SyncEStats)
- func DeleteThresholdMetrics(profile string)
- func DeletedPTPMetrics(clockType, processName, eventResourceName string)
- func FindInLogForCfgFileIndex(out string) int
- func GetSyncState(state string) ptp.SyncState
- func GetSyncStateID(state string) float64
- func RegisterMetrics(nodeName string)
- func UpdateInterfaceRoleMetrics(process, ptpInterface string, role types.PtpPortRole)
- func UpdateNmeaStatusMetrics(process, iface string, status float64)
- func UpdatePTPHaMetrics(profile string, status int64)
- func UpdatePTPMetrics(metricsType, process, eventResourceName string, ...)
- func UpdatePTPOffsetMetrics(metricsType, process, eventResourceName string, offset float64)
- func UpdateProcessStatusMetrics(process, cfgName string, status int64)
- func UpdateSyncEClockQlMetrics(process, cfgName string, iface string, networkOption int, device string, ...)
- func UpdateSyncEQLMetrics(process, cfgName string, iface string, networkOption int, device string, ...)
- func UpdateSyncStateMetrics(process, iface string, state ptp.SyncState)
- type PTPEventManager
- func (p *PTPEventManager) AddPTPConfig(fileName types.ConfigName, ptpCfg *ptp4lconf.PTP4lConfig)
- func (p *PTPEventManager) DeletePTPConfig(key types.ConfigName)
- func (p *PTPEventManager) DeleteStats(name types.ConfigName, key types.IFace)
- func (p *PTPEventManager) DeleteStatsConfig(key types.ConfigName)
- func (p *PTPEventManager) ExtractMetrics(msg string)
- func (p *PTPEventManager) GenPTPEvent(ptpProfileName string, oStats *stats.Stats, eventResourceName string, ...)
- func (p *PTPEventManager) GetGPSFixState(gpsFix int64, syncState ptp.SyncState) (state ptp.SyncState)
- func (p *PTPEventManager) GetMockEvent() ptp.EventType
- func (p *PTPEventManager) GetPTPCloudEvents(data ceevent.Data, eventType ptp.EventType) (*cloudevents.Event, error)
- func (p *PTPEventManager) GetPTPConfig(configName types.ConfigName) *ptp4lconf.PTP4lConfig
- func (p *PTPEventManager) GetPTPConfigDeepCopy(configName types.ConfigName) *ptp4lconf.PTP4lConfig
- func (p *PTPEventManager) GetPTPEventsData(state ptp.SyncState, ptpOffset int64, source string, eventType ptp.EventType) *ceevent.Data
- func (p *PTPEventManager) GetStats(name types.ConfigName) stats.PTPStats
- func (p *PTPEventManager) GetStatsForInterface(name types.ConfigName, iface types.IFace) *stats.Stats
- func (p *PTPEventManager) HAProfiles() (profiles []string)
- func (p *PTPEventManager) IsHAProfile(name string) bool
- func (p *PTPEventManager) MockTest(t bool)
- func (p *PTPEventManager) NodeName() string
- func (p *PTPEventManager) ParseDPLLLogs(processName, configName, output string, fields []string, ...)
- func (p *PTPEventManager) ParseGMLogs(processName, configName, output string, fields []string, ...)
- func (p *PTPEventManager) ParseGNSSLogs(processName, configName, output string, fields []string, ...)
- func (p *PTPEventManager) ParsePTP4l(processName, configName, profileName, output string, fields []string, ...)
- func (p *PTPEventManager) ParseSyncELogs(processName, configName, output string, fields []string, ...)
- func (p *PTPEventManager) PrintStats() string
- func (p *PTPEventManager) PtpThreshold(profileName string, resetCh bool) ptpConfig.PtpClockThreshold
- func (p *PTPEventManager) PublishClockClassEvent(clockClass float64, source string, eventType ptp.EventType)
- func (p *PTPEventManager) PublishEvent(state ptp.SyncState, ptpOffset int64, source string, eventType ptp.EventType)
- func (p *PTPEventManager) ResetMockEvent()
- type SyncELogData
Constants ¶
const ( // FreeRunOffsetValue when sync state is FREERUN FreeRunOffsetValue = -9999999999999999 // ClockRealTime is the slave ClockRealTime = "CLOCK_REALTIME" // MasterClockType is the slave sync slave clock to master MasterClockType = "master" // GNSS ... GNSS = "GNSS" // DPLL ... DPLL = "DPLL" // ClockClass number ClockClass = "CLOCK_CLASS" // PtpProcessDown ... process is down PtpProcessDown int64 = 0 // PtpProcessUp process is up PtpProcessUp int64 = 1 // UNAVAILABLE Nmea and Pps status UNAVAILABLE float64 = 0 // AVAILABLE Nmea and Pps status AVAILABLE float64 = 1 )
Variables ¶
var ( // PtpOffset metrics for offset PtpOffset = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "offset_ns", Help: "", }, []string{"from", "process", "node", "iface"}) // PtpMaxOffset metrics for max offset PtpMaxOffset = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "max_offset_ns", Help: "", }, []string{"from", "process", "node", "iface"}) // PtpFrequencyAdjustment metrics to show frequency adjustment PtpFrequencyAdjustment = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "frequency_adjustment_ns", Help: "", }, []string{"from", "process", "node", "iface"}) // PtpDelay metrics to show delay PtpDelay = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "delay_ns", Help: "", }, []string{"from", "process", "node", "iface"}) // SyncState metrics to show current clock state SyncState = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "clock_state", Help: "0 = FREERUN, 1 = LOCKED, 2 = HOLDOVER", }, []string{"process", "node", "iface"}) // NmeaStatus metrics to show current nmea status NmeaStatus = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "nmea_status", Help: "0 = UNAVAILABLE, 1 = AVAILABLE", }, []string{"process", "node", "iface"}) // Threshold metrics to show current ptp threshold Threshold = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "threshold", Help: "", }, []string{"threshold", "node", "profile"}) // InterfaceRole metrics to show current interface role InterfaceRole = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "interface_role", Help: "0 = PASSIVE, 1 = SLAVE, 2 = MASTER, 3 = FAULTY, 4 = UNKNOWN, 5 = LISTENING", }, []string{"process", "node", "iface"}) // ClockClassMetrics metrics to show current clock class for the node ClockClassMetrics = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "clock_class", Help: "6 = Locked, 7 = PRC unlocked in-spec, 52/187 = PRC unlocked out-of-spec, 248 = Default, 255 = Slave Only Clock", }, []string{"process", "node"}) // ProcessStatus ... update process status ProcessStatus = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "process_status", Help: "0 = DOWN, 1 = UP", }, []string{"process", "node", "config"}) // ProcessReStartCount update process status cound ProcessReStartCount = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "process_restart_count", Help: "", }, []string{"process", "node", "config"}) // PTPHAMetrics metrics to show current ha profiles PTPHAMetrics = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "ha_profile_status", Help: "0 = INACTIVE 1 = ACTIVE", }, []string{"process", "node", "profile"}) // SynceClockQL metrics to show current synce Clock Qulity SynceClockQL = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "synce_clock_quality", Help: "network_option1: ePRTC = 32 PRTC = 34 PRC = 257 SSU-A = 259 SSU-B = 263 EEC1 = 266 QL-DNU = 270 network_option2: ePRTC = 34 PRTC = 33 PRS = 256 STU = 255 ST2 = 262 TNC = 259 ST3E =268 EEC2 = 265 PROV = 269 QL-DUS = 270", }, []string{"process", "node", "profile", "network_option", "iface", "device"}) // SynceQLInfo metrics to show current QL values SynceQLInfo = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ptpNamespace, Subsystem: ptpSubsystem, Name: "synce_ssm_ql", Help: "network_option1: ePRTC: {0, 0x2, 0x21}, PRTC: {1, 0x2, 0x20}, PRC: {2, 0x2, 0xFF}, SSUA: {3, 0x4, 0xFF}, SSUB: {4, 0x8, 0xFF}, EEC1: {5, 0xB, 0xFF}, QL-DNU: {6,0xF,0xFF} " + " network_option2 ePRTC: {0, 0x1, 0x21}, PRTC: {1, 0x1, 0x20}, PRS: {2, 0x1, 0xFF}, STU: {3, 0x0, 0xFF}, ST2: {4, 0x7, 0xFF}, TNC: {5, 0x4, 0xFF}, ST3E: {6, 0xD, 0xFF}, EEC2: {7, 0xA, 0xFF}, PROV: {8, 0xE, 0xFF}, QL-DUS: {9,0xF,0xFF}", }, []string{"process", "node", "profile", "network_option", "iface", "device", "ql_type"}) )
Functions ¶
func DeleteInterfaceRoleMetrics ¶
func DeleteInterfaceRoleMetrics(process, ptpInterface string)
DeleteInterfaceRoleMetrics ... delete interface role metrics
func DeletePTPHAMetrics ¶
func DeletePTPHAMetrics(profile string)
DeletePTPHAMetrics ... delete ptp ha metrics
func DeleteProcessStatusMetricsForConfig ¶
DeleteProcessStatusMetricsForConfig ...
func DeleteSyncEMetrics ¶
func DeleteSyncEMetrics(process, configName string, synceStats stats.SyncEStats)
DeleteSyncEMetrics ... delete synce metrics
func DeleteThresholdMetrics ¶
func DeleteThresholdMetrics(profile string)
DeleteThresholdMetrics ... delete threshold metrics
func DeletedPTPMetrics ¶
func DeletedPTPMetrics(clockType, processName, eventResourceName string)
DeletedPTPMetrics ... update metrics for deleted ptp config
func FindInLogForCfgFileIndex ¶
FindInLogForCfgFileIndex ... find config name from the log
func GetSyncState ¶
GetSyncState ... get state id for metrics
func GetSyncStateID ¶
GetSyncStateID ... get state id for metrics
func RegisterMetrics ¶
func RegisterMetrics(nodeName string)
RegisterMetrics ... register metrics for all side car plugins
func UpdateInterfaceRoleMetrics ¶
func UpdateInterfaceRoleMetrics(process, ptpInterface string, role types.PtpPortRole)
UpdateInterfaceRoleMetrics ... update interface role metrics
func UpdateNmeaStatusMetrics ¶
UpdateNmeaStatusMetrics ... update nmea status metrics
func UpdatePTPHaMetrics ¶
UpdatePTPHaMetrics ... update ptp ha status metrics
func UpdatePTPMetrics ¶
func UpdatePTPMetrics(metricsType, process, eventResourceName string, offset, maxOffset, frequencyAdjustment, delay float64)
UpdatePTPMetrics ... update ptp metrics
func UpdatePTPOffsetMetrics ¶
UpdatePTPOffsetMetrics ... update ptp offset metrics
func UpdateProcessStatusMetrics ¶
UpdateProcessStatusMetrics -- update process status metrics
func UpdateSyncEClockQlMetrics ¶
func UpdateSyncEClockQlMetrics(process, cfgName string, iface string, networkOption int, device string, value float64)
UpdateSyncEClockQlMetrics ... update synce clock quality metrics
func UpdateSyncEQLMetrics ¶
func UpdateSyncEQLMetrics(process, cfgName string, iface string, networkOption int, device string, qlType string, value byte)
UpdateSyncEQLMetrics ... update QL metrics
func UpdateSyncStateMetrics ¶
UpdateSyncStateMetrics ... update sync state metrics
Types ¶
type PTPEventManager ¶
type PTPEventManager struct { Stats map[types.ConfigName]stats.PTPStats // PtpConfigMapUpdates holds ptp-configmap updated details PtpConfigMapUpdates *ptpConfig.LinuxPTPConfigMapUpdate // Ptp4lConfigInterfaces holds interfaces and its roles, after reading from ptp4l config files Ptp4lConfigInterfaces map[types.ConfigName]*ptp4lconf.PTP4lConfig // contains filtered or unexported fields }
PTPEventManager ... for PTP
func NewPTPEventManager ¶
func NewPTPEventManager(resourcePrefix string, publisherTypes map[ptp.EventType]*types.EventPublisherType, nodeName string, config *common.SCConfiguration) (ptpEventManager *PTPEventManager)
NewPTPEventManager to manage events and metrics
func (*PTPEventManager) AddPTPConfig ¶
func (p *PTPEventManager) AddPTPConfig(fileName types.ConfigName, ptpCfg *ptp4lconf.PTP4lConfig)
AddPTPConfig ... Add PtpConfigUpdate obj
func (*PTPEventManager) DeletePTPConfig ¶
func (p *PTPEventManager) DeletePTPConfig(key types.ConfigName)
DeletePTPConfig ... delete ptp obj
func (*PTPEventManager) DeleteStats ¶
func (p *PTPEventManager) DeleteStats(name types.ConfigName, key types.IFace)
DeleteStats ... delete stats obj
func (*PTPEventManager) DeleteStatsConfig ¶
func (p *PTPEventManager) DeleteStatsConfig(key types.ConfigName)
DeleteStatsConfig ... delete stats obj
func (*PTPEventManager) ExtractMetrics ¶
func (p *PTPEventManager) ExtractMetrics(msg string)
ExtractMetrics ... extract metrics from ptp logs.
func (*PTPEventManager) GenPTPEvent ¶
func (p *PTPEventManager) GenPTPEvent(ptpProfileName string, oStats *stats.Stats, eventResourceName string, ptpOffset int64, clockState ptp.SyncState, eventType ptp.EventType)
GenPTPEvent ... generate events form the logs
func (*PTPEventManager) GetGPSFixState ¶
func (p *PTPEventManager) GetGPSFixState(gpsFix int64, syncState ptp.SyncState) (state ptp.SyncState)
GetGPSFixState ... returns gps state by computing gpsFix and offset derived state
func (*PTPEventManager) GetMockEvent ¶
func (p *PTPEventManager) GetMockEvent() ptp.EventType
GetMockEvent ...
func (*PTPEventManager) GetPTPCloudEvents ¶
func (p *PTPEventManager) GetPTPCloudEvents(data ceevent.Data, eventType ptp.EventType) (*cloudevents.Event, error)
GetPTPCloudEvents ...GetEvent events
func (*PTPEventManager) GetPTPConfig ¶
func (p *PTPEventManager) GetPTPConfig(configName types.ConfigName) *ptp4lconf.PTP4lConfig
GetPTPConfig ... Add PtpConfigUpdate obj
func (*PTPEventManager) GetPTPConfigDeepCopy ¶
func (p *PTPEventManager) GetPTPConfigDeepCopy(configName types.ConfigName) *ptp4lconf.PTP4lConfig
GetPTPConfigDeepCopy ... Add PtpConfigUpdate obj
func (*PTPEventManager) GetPTPEventsData ¶
func (p *PTPEventManager) GetPTPEventsData(state ptp.SyncState, ptpOffset int64, source string, eventType ptp.EventType) *ceevent.Data
GetPTPEventsData ... get PTP event data object
func (*PTPEventManager) GetStats ¶
func (p *PTPEventManager) GetStats(name types.ConfigName) stats.PTPStats
GetStats ... get stats
func (*PTPEventManager) GetStatsForInterface ¶
func (p *PTPEventManager) GetStatsForInterface(name types.ConfigName, iface types.IFace) *stats.Stats
GetStatsForInterface ... get stats for interface
func (*PTPEventManager) HAProfiles ¶
func (p *PTPEventManager) HAProfiles() (profiles []string)
HAProfiles ... if profile for ha found pass the settings
func (*PTPEventManager) IsHAProfile ¶
func (p *PTPEventManager) IsHAProfile(name string) bool
IsHAProfile ... if profile for ha found pass
func (*PTPEventManager) MockTest ¶
func (p *PTPEventManager) MockTest(t bool)
MockTest ... use for test only
func (*PTPEventManager) ParseDPLLLogs ¶
func (p *PTPEventManager) ParseDPLLLogs(processName, configName, output string, fields []string, ptpStats stats.PTPStats)
ParseDPLLLogs ... parse logs for various events
func (*PTPEventManager) ParseGMLogs ¶
func (p *PTPEventManager) ParseGMLogs(processName, configName, output string, fields []string, ptpStats stats.PTPStats)
ParseGMLogs ... parse logs for various events
func (*PTPEventManager) ParseGNSSLogs ¶
func (p *PTPEventManager) ParseGNSSLogs(processName, configName, output string, fields []string, ptpStats stats.PTPStats)
ParseGNSSLogs ... parse logs for various events
func (*PTPEventManager) ParsePTP4l ¶
func (p *PTPEventManager) ParsePTP4l(processName, configName, profileName, output string, fields []string, ptpInterface ptp4lconf.PTPInterface, ptp4lCfg *ptp4lconf.PTP4lConfig, ptpStats stats.PTPStats)
ParsePTP4l ... parse ptp4l for various events
func (*PTPEventManager) ParseSyncELogs ¶
func (p *PTPEventManager) ParseSyncELogs(processName, configName, output string, fields []string, ptpStats stats.PTPStats)
ParseSyncELogs ... parse logs for various events
func (*PTPEventManager) PrintStats ¶
func (p *PTPEventManager) PrintStats() string
PrintStats .... for debug
func (*PTPEventManager) PtpThreshold ¶
func (p *PTPEventManager) PtpThreshold(profileName string, resetCh bool) ptpConfig.PtpClockThreshold
PtpThreshold ... return ptp threshold resetCh will reset any closed channel
func (*PTPEventManager) PublishClockClassEvent ¶
func (p *PTPEventManager) PublishClockClassEvent(clockClass float64, source string, eventType ptp.EventType)
PublishClockClassEvent ...publish events
func (*PTPEventManager) PublishEvent ¶
func (p *PTPEventManager) PublishEvent(state ptp.SyncState, ptpOffset int64, source string, eventType ptp.EventType)
PublishEvent ...publish events
func (*PTPEventManager) ResetMockEvent ¶
func (p *PTPEventManager) ResetMockEvent()
ResetMockEvent ...