Skip to content

Java/iot3core: add retain span attribute#555

Merged
mathieu1fb merged 2 commits into
Orange-OpenSource:masterfrom
mathieu1fb:iot3core-add-retain-span-attribute
Jul 7, 2026
Merged

Java/iot3core: add retain span attribute#555
mathieu1fb merged 2 commits into
Orange-OpenSource:masterfrom
mathieu1fb:iot3core-add-retain-span-attribute

Conversation

@mathieu1fb

Copy link
Copy Markdown
Collaborator

What's new

A new iot3.core.mqtt.retain span attribute has been added to the Java IoT3 Core SDK consumer spans.

Close #545

What to do

Review code change.

Signed-off-by: Mathieu LEFEBVRE <mathieu1.lefebvre@orange.com>
@mathieu1fb mathieu1fb added this to the Sprint 22 milestone Jul 6, 2026
@mathieu1fb mathieu1fb requested a review from ymorin-orange July 6, 2026 09:31
@mathieu1fb mathieu1fb self-assigned this Jul 6, 2026
@mathieu1fb mathieu1fb added this to Kanban Jul 6, 2026
@mathieu1fb mathieu1fb added the Java label Jul 6, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Kanban Jul 6, 2026
receivedSpan.setAttribute(AttributeKey.stringKey("iot3.core.mqtt.topic"),
publish.getTopic().toString());
receivedSpan.setAttribute(AttributeKey.booleanKey("iot3.core.mqtt.retain"),
publish.isRetain());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In python, the SDK only sets the flag when it is true; it is missing when retain is false. See python/iot3/src/iot3/core/mqtt.py#L345

What about tracking the retain flag for messages that are published in retain? Ditto, in python, it is set to true on published messafges psoted in retain, missing otherwise. See python/iot3/src/iot3/core/mqtt.py#L208

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback, I will align the behaviour of the Java SDK with what you did.

Note: this attribute is only present for retained messages (received and published), absent otherwise.

Signed-off-by: Mathieu LEFEBVRE <mathieu1.lefebvre@orange.com>
@mathieu1fb mathieu1fb force-pushed the iot3core-add-retain-span-attribute branch from 6a7a5db to 6fcc8ff Compare July 6, 2026 12:27
@mathieu1fb mathieu1fb requested a review from ymorin-orange July 6, 2026 12:28

@ymorin-orange ymorin-orange left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Simple enough Java code that I could actually understand the diff. ;-)

@mathieu1fb mathieu1fb merged commit 83f5a4a into Orange-OpenSource:master Jul 7, 2026
121 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Kanban Jul 7, 2026
@mathieu1fb mathieu1fb deleted the iot3core-add-retain-span-attribute branch July 7, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Java/IoT3Core: add retain attribute to spans

2 participants