synchronized void updateLabels(Map<String, String> labels) {
        final Resource.Builder resourceBuilder = resource.toBuilder();
        Map<String, String> finalLabels = resource.getAttributesList().stream().collect(Collectors.toMap(
            KeyValue::getKey, kv -> kv.getValue().getStringValue()));
        finalLabels.putAll(labels);

        resourceBuilder.clearAttributes();
        finalLabels.forEach((key, value) -> addAttribute(resourceBuilder, key, value));
        resource = resourceBuilder.build();
    }
Updates the resource labels/tags for the service or library exposing metrics.

@param labels Map of labels to be updated.
clients/src/main/java/org/apache/kafka/common/telemetry/internals/ClientTelemetryProvider.java