feat(common.opcua): Add debug info for nodes not in server namespace (#14676)
This commit is contained in:
parent
3591546a1a
commit
c981bb7819
|
|
@ -391,7 +391,13 @@ func (o *OpcUAInputClient) initLastReceivedValues() {
|
|||
func (o *OpcUAInputClient) UpdateNodeValue(nodeIdx int, d *ua.DataValue) {
|
||||
o.LastReceivedData[nodeIdx].Quality = d.Status
|
||||
if !o.StatusCodeOK(d.Status) {
|
||||
o.Log.Errorf("status not OK for node %v: %v", o.NodeMetricMapping[nodeIdx].Tag.FieldName, d.Status)
|
||||
// Verify NodeIDs array has been built before trying to get item; otherwise show '?' for node id
|
||||
if len(o.NodeIDs) > nodeIdx {
|
||||
o.Log.Errorf("status not OK for node %v (%v): %v", o.NodeMetricMapping[nodeIdx].Tag.FieldName, o.NodeIDs[nodeIdx].String(), d.Status)
|
||||
} else {
|
||||
o.Log.Errorf("status not OK for node %v (%v): %v", o.NodeMetricMapping[nodeIdx].Tag.FieldName, '?', d.Status)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -172,8 +172,16 @@ func (o *SubscribeClient) StartStreamValues(ctx context.Context) (<-chan telegra
|
|||
}
|
||||
o.Log.Debug("Monitoring items")
|
||||
|
||||
for _, res := range resp.Results {
|
||||
for idx, res := range resp.Results {
|
||||
if !o.StatusCodeOK(res.StatusCode) {
|
||||
// Verify NodeIDs array has been built before trying to get item; otherwise show '?' for node id
|
||||
if len(o.OpcUAInputClient.NodeIDs) > idx {
|
||||
o.Log.Debugf("Failed to create monitored item for node %v (%v)",
|
||||
o.OpcUAInputClient.NodeMetricMapping[idx].Tag.FieldName, o.OpcUAInputClient.NodeIDs[idx].String())
|
||||
} else {
|
||||
o.Log.Debugf("Failed to create monitored item for node %v (%v)", o.OpcUAInputClient.NodeMetricMapping[idx].Tag.FieldName, '?')
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("creating monitored item failed with status code: %w", res.StatusCode)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue