This pull request includes several changes to the deserialization logic in the metricshub-agent project, focusing on handling multi-value attributes and updating resource configurations. The most important changes include modifications to the AttributesDeserializer and PostConfigDeserializer classes, as well as updates to the associated tests.
Deserialization Logic Improvements:
AttributesDeserializer.java: Added the MULTI_VALUE_SEPARATOR constant to handle multi-value attributes during deserialization. Updated the deserialize method to use this separator. [1][2]
PostConfigDeserializer.java: Replaced the handling of multiple hosts with handling multiple resources, updated the logic to split multi-value attributes, and added methods to normalize protocol hostnames and determine attribute values. Deprecated the MULTI_HOST_ATTRIBUTE_KEY. [1][2][3][4]
Test Updates:
AgentContextTest.java: Updated test cases to reflect the new resource key format for multi-resource configurations.
AttributesDeserializerTest.java: Modified the test to use the MULTI_VALUE_SEPARATOR constant and adjusted the expected results for multi-value attributes. [1][2]
This pull request includes several changes to the deserialization logic in the
metricshub-agent
project, focusing on handling multi-value attributes and updating resource configurations. The most important changes include modifications to theAttributesDeserializer
andPostConfigDeserializer
classes, as well as updates to the associated tests.Deserialization Logic Improvements:
AttributesDeserializer.java
: Added theMULTI_VALUE_SEPARATOR
constant to handle multi-value attributes during deserialization. Updated thedeserialize
method to use this separator. [1] [2]PostConfigDeserializer.java
: Replaced the handling of multiple hosts with handling multiple resources, updated the logic to split multi-value attributes, and added methods to normalize protocol hostnames and determine attribute values. Deprecated theMULTI_HOST_ATTRIBUTE_KEY
. [1] [2] [3] [4]Test Updates:
AgentContextTest.java
: Updated test cases to reflect the new resource key format for multi-resource configurations.AttributesDeserializerTest.java
: Modified the test to use theMULTI_VALUE_SEPARATOR
constant and adjusted the expected results for multi-value attributes. [1] [2]Testing
Legacy
host.names
host.name
as arrayMultiple attributes as array
host.name
and protocolhostname
as array