feat(inputs.opcua): Add namespace URI support#17906
feat(inputs.opcua): Add namespace URI support#17906mstrandboge merged 3 commits intoinfluxdata:masterfrom
Conversation
Add support for OPC UA namespace URIs (nsu=) as an alternative to namespace indices (ns=) in both inputs.opcua and inputs.opcua_listener plugins. This allows users to configure nodes using stable namespace URIs instead of numeric indices that can change on server restart.
Add namespace_uri field to sample configuration for both inputs.opcua and inputs.opcua_listener plugins.
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
| ```toml | ||
| [[inputs.opcua.nodes]] | ||
| name = "ServerStatus" | ||
| namespace = "0" | ||
| identifier_type = "i" | ||
| identifier = "2256" | ||
| ``` |
There was a problem hiding this comment.
Just a question for understanding the matter. As we touch this part anyway, wouldn't it be easier do define something like
[inputs.opcua_listener.metric]
name = "my_metric"
[inputs.opcua_listener.metric.fields]
ServerStatus = "ns=0;i=2256"
MyInfo = "nsu=http://opcfoundation.org/UA/;s=foo"
[inputs.opcua_listener.metric.tags]
location = "main building"
device = "typesetter"This is more compact, less error prone (you cannot define duplicate fields) and easier to graps as it defines how a metric looks like and uses the notation used for Node IDs in OPCUA, isn't it?
There was a problem hiding this comment.
Ok, let's implement the feature in the current form and add the more compact configuration later if we want to...
Summary
Adds support for OPC UA namespace URIs (
nsu=) as an alternative to namespace indices (ns=) in bothinputs.opcuaandinputs.opcua_listenerplugins.This enhancement allows users to configure nodes using stable namespace URIs instead of numeric indices that can change when OPC UA servers restart, making configurations more robust and portable.
New Configuration Option
namespace_urifield to node and group configurationsnamespace(index) field with mutual exclusion validationExample Usage
Before (using namespace index):
After (using namespace URI):
Breaking Changes
None - this is purely additive. Existing configurations using namespace continue to work unchanged.
Checklist
Related issues
resolves #14417