Skip to content

Allow adding of details using maps with Health.Builder #14299

@michael-pratt

Description

@michael-pratt

In some cases I would like to add a map of details when using Health.Builder. Currently the builder class only allows for adding details one at a time after object construction, and it would be helpful if I could add an entire map of details, some thing like:

Health.Builder health = Health.unknown();
Map<String, Object> details = ...; // grab a map of details from somewhere
health.withDetails(details);

I assume the new withDetails(Map<String, Object>) method could just delegate to Map.putAll(Map<String, Object>) under the hood, and the semantics of overwriting existing keys is the same as if I called withDetail(String, Object) multiple times.

A lot of my health indicators pull multiple maps from other sources, so I'd rather not have to combine them into a single map that is known prior to the creation of the Health object.

I'm happy to submit a PR for this if it helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions