-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENG-380: Use Extended-NodeID strings #109
base: master
Are you sure you want to change the base?
Conversation
restore server_info
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
client, err := opcua.NewClient(endpoint, opcua.AuthAnonymous()) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
err = client.Connect(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(major) You should be reusing the Client that is initialized from the connect method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion , reading the namespace array can be done at the place where we gather Server info while trying to connect.
} | ||
|
||
func ReadNamespaceArray(endpoint string) ([]string, error) { | ||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) Formatting seems bit off here.
return nil, err | ||
} | ||
|
||
namespaceArray, ok := resp.Results[0].Value.Value().([]string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(style) This seems like an Hungarian notation in variable names. Please use namespaces
instead of namespaceArray
I will need some advice here since this seems to work just fine by:
i=2255
[]string
ua.ParseExpandedNodeID
since this checks for the namespace-uri (If provided) and returning the related index to get a format like e.g.<ns=4; s= i=1>
(I removed the Printf's for this draft)
What is still quite poor (imo):
context-handling
maybe at least some Info-logging to see if namespace was proven correctly here?
should be only usable through feature-flag (currently)
creating a new connection since it could be more intentional to move this to here:
benthos-umh/opcua_plugin/server_info.go
Lines 21 to 112 in aa2177b
resolves Using Expanded-NodeId-Strings rather then regular NodeId-String in configuration #5
(when finished)