Skip to content

Conversation

@agalenilesh
Copy link

Summary

This PR fixes the handling of metrics with aliases in the library to align with the Sparkplug specification. Previously, every metric was required to have a name when creating data messages, but the specification allows metrics with aliases to exclude the name. The changes introduce an alias-to-name mapping, and the logic is updated to handle metrics with either a name or alias.

Changes

When setting up metrics, if a metric has an alias, it is stored in the _names_mapping dictionary, which maps the alias to the metric name.
When updating metrics, we first check if the name is None and, if so, look up the alias in _names_mapping. If neither a name nor a valid alias is found, a ValueError is raised.

@agalenilesh agalenilesh requested a review from matteosox as a code owner May 30, 2025 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant