@Override
    public Uuid clientInstanceId(Duration timeout) {
        if (!clientTelemetryReporter.isPresent()) {
            throw new IllegalStateException("Telemetry is not enabled. Set config `" + ProducerConfig.ENABLE_METRICS_PUSH_CONFIG + "` to `true`.");
        }

        return ClientTelemetryUtils.fetchClientInstanceId(clientTelemetryReporter.get(), timeout);
    }
Determines the client's unique client instance ID used for telemetry. This ID is unique to
this specific client instance and will not change after it is initially generated.
The ID is useful for correlating client operations with telemetry sent to the broker and
to its eventual monitoring destinations.
<p>
If telemetry is enabled, this will first require a connection to the cluster to generate
the unique client instance ID. This method waits up to {@code timeout} for the producer
client to complete the request.
<p>
Client telemetry is controlled by the {@link ProducerConfig#ENABLE_METRICS_PUSH_CONFIG}
configuration option.

@param timeout The maximum time to wait for producer client to determine its client instance ID.
               The value must be non-negative. Specifying a timeout of zero means do not
               wait for the initial request to complete if it hasn't already.
@throws InterruptException If the thread is interrupted while blocked.
@throws KafkaException If an unexpected error occurs while trying to determine the client
                       instance ID, though this error does not necessarily imply the
                       producer client is otherwise unusable.
@throws IllegalArgumentException If the {@code timeout} is negative.
@throws IllegalStateException If telemetry is not enabled ie, config `{@code enable.metrics.push}`
                              is set to `{@code false}`.
@return The client's assigned instance id used for metrics collection.
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java