Skip to content
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

birth metrics not passed to FireNodeBirthRecevied #92

Closed
jeff-pf opened this issue Mar 26, 2024 · 1 comment
Closed

birth metrics not passed to FireNodeBirthRecevied #92

jeff-pf opened this issue Mar 26, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@jeff-pf
Copy link

jeff-pf commented Mar 26, 2024

Using the sample example application - OnApplicationVersionBNodeBirthReceived is not receiving the birth metrics.

Looking at ShouldVersionBMetricBeAdded - shouldbeAdded is always false since the metrics are not in KnownMetrics

            // Name only is set.

            // Check if the metric is known.
            if (!this.knownMetricsByName.TryGetValue(metric.Name, out var foundMetric))
            {
                shouldbeAdded = false;
                this.Logger?.LogError("The metric {Metric} is removed because it is unknown.", metric);
            }

Am I missing something? There would not be any know metrics until added from a birth message.

@SeppPenner SeppPenner self-assigned this Mar 27, 2024
@SeppPenner SeppPenner added the question Further information is requested label Mar 27, 2024
@SeppPenner
Copy link
Owner

There would not be any know metrics until added from a birth message.

Yes, and this is desired.

All metrics must be known in advance, e.g.

private static readonly List<VersionBData.Metric> VersionBMetricsApplication =
[
    new VersionBData.Metric("temperatureApplication", VersionBData.DataType.Float, 1.20f),
    new VersionBData.Metric("climateactiveApplication", VersionBData.DataType.Boolean, true)
    {
        Properties = new VersionBData.PropertySet
        {
            Keys = ["ON", "OFF"],
            Values =
            [
                new(VersionBData.DataType.Int8, 1)
                {
                },
                new(VersionBData.DataType.Int8, 0)
                {
                }
            ]
        }
    }
];

var application = new VersionB.SparkplugApplication(VersionBMetricsApplication, SparkplugSpecificationVersion.Version22);

Afterwards, you can Start the node / application to run or Stop it. The rest should be done automatically. I have changed the order of the examples however (Register event handlers before anything else happens), maybe that was also an issue (See 8b72a43)...

For more information, you can check #85 as well, where we discussed this.

Concluding:

  • Metrics must be known in advance.
  • If an unknown metric is received, it will be dropped (I agree, that this might change in the future as in the specs this would mean to send a Node Rebirth command as well though).
  • I will try to add Unable to send NBIRTH Message explicitly. #44 as soon as possible to do a custom node rebirth which would result in new known metrics as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants