Closed NassimBtk closed 3 weeks ago
One comment or suggestion I'd like to make: instead of having a specific host.names
(plural) property that is artificially mapped to several host.name
(singular) attribute, we could use host.name
(singular), and check if it's an array. If it's an array, then it's a "multiple-resource" resource, and we split all attributes that are arrays.
This way, we would remain perfectly generic and could have "multiple-resource" resource using other attributes than host.name(s)
.
WDYT? 😅
Great idea @bertysentry, thank you! We can handle this in a new feature request to add support for host.id
or other attributes as arrays (ensuring matching array lengths 😉).
Further enhancements will be made through https://github.com/sentrysoftware/metricshub/issues/470.
Update
AgentConfig
resources.Details This pull request to
metricshub-agent
introduces changes to thePostConfigDeserializer
class to manage ResourceConfig instances more effectively by resolving multiple host configurations. The most important changes include adding a new method to handle ResourceConfig instances and updating the deserialization logic to incorporate this method.Enhancements to deserialization logic:
metricshub-agent/src/main/java/org/sentrysoftware/metricshub/agent/deserialization/PostConfigDeserializer.java
: ImportedAgentConfig
to manage ResourceConfig instances under the AgentConfig.metricshub-agent/src/main/java/org/sentrysoftware/metricshub/agent/deserialization/PostConfigDeserializer.java
: Updated thedeserialize
method to handleAgentConfig
instances and resolve their resources.New method for ResourceConfig resolution:
metricshub-agent/src/main/java/org/sentrysoftware/metricshub/agent/deserialization/PostConfigDeserializer.java
: AddedresolveResources
method to create newResourceConfig
instances for each host and update the map accordingly.Tests