You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In src/SparkplugNet/Core/SparkplugBase.KnownMetricStorage.cs, there is the following piece of code that checks whether an incoming message ONLY contains the metrics that are known, else it will throw an exception.
publicvirtualvoidValidateIncomingMetrics(IEnumerable<T>metrics){foreach(var metric in metrics.Where(metric =>!this.ContainsKey(metric.Name))){thrownew Exception($"Metric {metric.Name} is an unknown metric.");}}
However, in my case, I'm only interested in SOME tags that get send, and I want them to ignore the rest. For instance, let's say I'm interested in the following device metrics:
Configuring the metrics with only the 'temperature' and 'enabled' will result in a thrown exception. This is unwanted behaviour from my side. Same goes for the Node, I am not interested in the Node data, however, when I don't add the metrics to the known list, it will throw an exception as well. I'd rather have them filtered; similarly to the FilterOutgoingMetrics function in SparkplugBase.KnownMetricStorage.cs. The following function solved my problem:
Is there a specific reason an exception is thrown in this case? If so, how would I be able to resolve this issue? If not, shall I create a pull request that has an option to validate or filter the incoming metrics?
The text was updated successfully, but these errors were encountered:
In src/SparkplugNet/Core/SparkplugBase.KnownMetricStorage.cs, there is the following piece of code that checks whether an incoming message ONLY contains the metrics that are known, else it will throw an exception.
However, in my case, I'm only interested in SOME tags that get send, and I want them to ignore the rest. For instance, let's say I'm interested in the following device metrics:
But the device sends the following data:
Configuring the metrics with only the 'temperature' and 'enabled' will result in a thrown exception. This is unwanted behaviour from my side. Same goes for the Node, I am not interested in the Node data, however, when I don't add the metrics to the known list, it will throw an exception as well. I'd rather have them filtered; similarly to the FilterOutgoingMetrics function in SparkplugBase.KnownMetricStorage.cs. The following function solved my problem:
Is there a specific reason an exception is thrown in this case? If so, how would I be able to resolve this issue? If not, shall I create a pull request that has an option to validate or filter the incoming metrics?
The text was updated successfully, but these errors were encountered: