[#3699] Add client ip to downstream message properties#3737
[#3699] Add client ip to downstream message properties#3737jpforevers wants to merge 5 commits intoeclipse-hono:masterfrom
Conversation
jpforevers
commented
Feb 13, 2026
- Add configurable client_ip property for telemetry/event downstream messages across HTTP, MQTT, AMQP, CoAP, Lora, and Sigfox adapters.
- Support tenant and adapter overrides plus source strategy (auto, http-headers, proxy-protocol, remote-address) with Proxy Protocol enablement where applicable.
- Extend integration tests and update API/tenant/adapter documentation to describe new property and configuration.
sophokles73
left a comment
There was a problem hiding this comment.
Thanks for the PR 👍
This looks like a great start. I would like to propose a few changes around the configuration properties.
At the moment you seem to expect the tenant specific configuration to be found in the adapters/ext property of the TenantObject. However, the ext property is meant to be used for custom extensions only, i.e. for properties that (standard) Hono does not know about. In this case, however, we should make support for passing along the device IP a first-class citizen. I therefore suggest that you define the corresponding property names (using kebap-case) in RegistryManagementConstants and define corresponding properties in the Adapter class, e.g.
class Adapter {
...
@JsonProperty(RegistryManagementConstants.FIELD_ADAPTERS_CLIENTIP_ENABLED)
private boolean clientIpEnabled = false;
...
public final boolean isClientIpEnabled() {
return clientIpEnabled;
}
}and analogously for the clientIpSource config property.
You then also need to adapt the Device Registry Management API definition accordingly, to allow setting the properties when creating/updating a tenant.
Based on that, your code can then explicitly invoke TenantObject.getAdapter("http").isClientIpEnabled()
As for the protocol adapter configuration level, we use camel-case for the corresponding system properties. I would suggest to define
interface ProtocolAdapterOptions {
@WithDefault("false")
boolean clientIpEnabled();
@WithDefault("auto")
ClientIpSource clientIpSource();
}The names of the environment variables would then be:
HONO_AMQP_CLIENTIPENABLED
HONO_AMQP_CLIENTIPSOURCE
and the system properties would be
hono.amqp.clientIpEnabled
hono.amqp.clientIpSource
If you want to group/encapsulate them, then I would suggest something like
interface ProtocolAdapterOptions {
ClientIpOptions clientIp();
interface ClientIpOptions {
@WithDefault("false")
boolean enabled();
@WithDefault("auto")
ClientIpSource source();
}
}The names of the environment variables would then be:
HONO_AMQP_CLIENTIP_ENABLED
HONO_AMQP_CLIENTIP_SOURCE
and the system properties would be
hono.amqp.clientIp.enabled
hono.amqp.clientIp.source
adapter-base/src/main/java/org/eclipse/hono/adapter/ProtocolAdapterOptions.java
Outdated
Show resolved
Hide resolved
|
Thank you for the feedback. The updates have been completed according to the suggestions:
Test results:
|
adapter-base/src/main/java/org/eclipse/hono/adapter/ProtocolAdapterProperties.java
Outdated
Show resolved
Hide resolved
|
Thanks for the review! I’ve applied all requested changes (clientIpEnabled naming, removed redundant getter, moved ClientIpSource to core with |
site/documentation/content/api/management/device-registry-v1.yaml
Outdated
Show resolved
Hide resolved
|
Updated docs to clarify client-ip-source behavior across strategies (auto/http-headers/proxy-protocol/remote-address), including fallback rules and non-HTTP behavior. Commit: 34b0178. |
|
Follow-up: I clarified the client-ip-source behavior across all strategies in the docs and pushed the update (commit 34b0178). When you have a moment, could you please re-review? |
|
Hey, I am currently at a conference and won't be able to review for the next few days. I hope to find the time later during the week. Thanks for your patience 🙏 |
site/documentation/content/api/management/device-registry-v1.yaml
Outdated
Show resolved
Hide resolved
tests/src/test/java/org/eclipse/hono/tests/mqtt/MqttPublishTestBase.java
Show resolved
Hide resolved
|
Applied the three latest suggestions: updated the mqtt admin guide client-ip-enabled description, clarified device-registry client-ip-enabled wording, and added assertions for client_ip absence when not enabled (MQTT/AMQP/CoAP/Lora) with a new DownstreamMessageAssertions helper. Commit: 1bb2b14. |