Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-18 Thread via GitHub


mjsax merged PR #14560:
URL: https://github.com/apache/kafka/pull/14560


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-18 Thread via GitHub


mjsax commented on PR #14560:
URL: https://github.com/apache/kafka/pull/14560#issuecomment-1769844494

   The Jenkins UI is a mess -- you can click on "Tests" in the top menu bar to 
see failing tests.
   
   ```
   New failing - 16
   Build / JDK 8 and Scala 2.12 / testTimeouts() – 
org.apache.kafka.controller.QuorumControllerTest
   <1s
   Build / JDK 17 and Scala 2.13 / testTaskRequestWithOldStartMsGetsUpdated() – 
org.apache.kafka.trogdor.coordinator.CoordinatorTest
   2m 0s
   Build / JDK 21 and Scala 2.13 / [2] tlsProtocol=TLSv1.2, useInlinePem=true – 
org.apache.kafka.common.network.SslTransportLayerTest
   19s
   Build / JDK 21 and Scala 2.13 / shouldHaveSamePositionBoundActiveAndStandBy 
– org.apache.kafka.streams.integration.ConsistencyVectorIntegrationTest
   14s
   Build / JDK 21 and Scala 2.13 / testTaskRequestWithOldStartMsGetsUpdated() – 
org.apache.kafka.trogdor.coordinator.CoordinatorTest
   2m 0s
   Build / JDK 11 and Scala 2.13 / testSingleIP() – 
org.apache.kafka.clients.ClusterConnectionStatesTest
   <1s
   Build / JDK 11 and Scala 2.13 / testSingleIP() – 
org.apache.kafka.clients.ClusterConnectionStatesTest
   <1s
   Build / JDK 11 and Scala 2.13 / testReplicateSourceDefault() – 
org.apache.kafka.connect.mirror.integration.IdentityReplicationIntegrationTest
   3m 28s
   Build / JDK 11 and Scala 2.13 / testRestartReplication() – 
org.apache.kafka.connect.mirror.integration.MirrorConnectorsIntegrationBaseTest
   1m 4s
   Build / JDK 11 and Scala 2.13 / 
testNoConsumeWithoutDescribeAclViaAssign(String).quorum=kraft – 
kafka.api.DelegationTokenEndToEndAuthorizationWithOwnerTest
   13s
   Build / JDK 11 and Scala 2.13 / [1] error=UNKNOWN_SERVER_ERROR – 
kafka.coordinator.transaction.ProducerIdManagerTest
   15s
   Build / JDK 11 and Scala 2.13 / executeTieredStorageTest(String).quorum=zk – 
org.apache.kafka.tiered.storage.integration.EnableRemoteLogOnTopicTest
   39s
   Build / JDK 11 and Scala 2.13 / 
shouldAddAndRemoveNamedTopologiesBeforeStartingAndRouteQueriesToCorrectTopology()
 – org.apache.kafka.streams.integration.NamedTopologyIntegrationTest
   1m 11s
   Build / JDK 11 and Scala 2.13 / 
shouldInvokeUserDefinedGlobalStateRestoreListener() – 
org.apache.kafka.streams.integration.RestoreIntegrationTest
   1m 17s
   Build / JDK 11 and Scala 2.13 / 
shouldInvokeUserDefinedGlobalStateRestoreListener() – 
org.apache.kafka.streams.integration.RestoreIntegrationTest
   1m 12s
   Build / JDK 11 and Scala 2.13 / 
shouldHonorEOSWhenUsingCachingAndStandbyReplicas – 
org.apache.kafka.streams.integration.StandbyTaskEOSMultiRebalanceIntegrationTest
   2m 24s
   Existing failures - 3
   Build / JDK 17 and Scala 2.13 / testRackAwareRangeAssignor(String).quorum=zk 
– integration.kafka.server.FetchFromFollowerIntegrationTest
   37s
   Build / JDK 21 and Scala 2.13 / testRackAwareRangeAssignor(String).quorum=zk 
– integration.kafka.server.FetchFromFollowerIntegrationTest
   40s
   Build / JDK 21 and Scala 2.13 / testRackAwareRangeAssignor(String).quorum=zk 
– integration.kafka.server.FetchFromFollowerIntegrationTest
   ```
   
   But this is all just flaky tests (your PR should be be even able to break 
anything).
   
   Merging.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-18 Thread via GitHub


apoorvmittal10 commented on PR #14560:
URL: https://github.com/apache/kafka/pull/14560#issuecomment-1768991359

   > I don't have any questions to add. LGTM
   
   Thanks @wcarlson5. I have checked the build it passes but gives below 
warning which marks the build as failed. Is there something I an do to fix it?
   
   ```
   **/build/test-results/**/TEST-*.xml
   — Archive JUnit-formatted test results
   14s
   Recording test results
   
   [Checks API] No suitable checks publisher found.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-17 Thread via GitHub


apoorvmittal10 commented on code in PR #14560:
URL: https://github.com/apache/kafka/pull/14560#discussion_r1362737991


##
clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java:
##
@@ -4385,6 +4385,11 @@ public FenceProducersResult 
fenceProducers(Collection transactionalIds,
 return new FenceProducersResult(future.all());
 }
 
+@Override
+public Uuid clientInstanceId(Duration timeout) {
+throw new UnsupportedOperationException();

Review Comment:
   Other than test files I do not see other classes writing additional message 
hence omitted.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-17 Thread via GitHub


apoorvmittal10 commented on code in PR #14560:
URL: https://github.com/apache/kafka/pull/14560#discussion_r1362736361


##
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java:
##
@@ -1660,6 +1663,34 @@ default FenceProducersResult 
fenceProducers(Collection transactionalIds)
 FenceProducersResult fenceProducers(Collection transactionalIds,
 FenceProducersOptions options);
 
+/**
+ * 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.
+ *
+ * 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 admin
+ * client to complete the request.
+ *
+ * If telemetry is disabled, the method will throw {@link 
IllegalStateException}.
+ *
+ * Client telemetry is controlled by the {@link 
AdminClientConfig#ENABLE_METRICS_PUSH_CONFIG}
+ * configuration option.
+ *
+ * @param timeout The maximum time to wait for admin client to determine 
its client instance ID.
+ *The value should 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
+ *admin client is otherwise unusable.
+ * @throws IllegalArgumentException If the {@code timeout} is negative.
+ * @throws IllegalStateException If telemetry is not enabled.

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-17 Thread via GitHub


apoorvmittal10 commented on code in PR #14560:
URL: https://github.com/apache/kafka/pull/14560#discussion_r1362732755


##
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java:
##
@@ -1660,6 +1663,34 @@ default FenceProducersResult 
fenceProducers(Collection transactionalIds)
 FenceProducersResult fenceProducers(Collection transactionalIds,
 FenceProducersOptions options);
 
+/**
+ * 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.
+ *
+ * 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 admin
+ * client to complete the request.
+ *
+ * If telemetry is disabled, the method will throw {@link 
IllegalStateException}.

Review Comment:
I thought about it and kept it continue the disabled case from previous 
para. But it might be good to remove it as it's redundant.
   
   Removed, done at all places.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-17 Thread via GitHub


apoorvmittal10 commented on code in PR #14560:
URL: https://github.com/apache/kafka/pull/14560#discussion_r1362731201


##
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java:
##
@@ -1660,6 +1663,34 @@ default FenceProducersResult 
fenceProducers(Collection transactionalIds)
 FenceProducersResult fenceProducers(Collection transactionalIds,
 FenceProducersOptions options);
 
+/**
+ * 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.
+ *

Review Comment:
   Thanks, done at all places.



##
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java:
##
@@ -1660,6 +1663,34 @@ default FenceProducersResult 
fenceProducers(Collection transactionalIds)
 FenceProducersResult fenceProducers(Collection transactionalIds,
 FenceProducersOptions options);
 
+/**
+ * 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.
+ *
+ * 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 admin
+ * client to complete the request.
+ *
+ * If telemetry is disabled, the method will throw {@link 
IllegalStateException}.
+ *
+ * Client telemetry is controlled by the {@link 
AdminClientConfig#ENABLE_METRICS_PUSH_CONFIG}
+ * configuration option.
+ *
+ * @param timeout The maximum time to wait for admin client to determine 
its client instance ID.
+ *The value should be non-negative. Specifying a timeout 
of zero means do not

Review Comment:
   Thanks, done at all places.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-17 Thread via GitHub


mjsax commented on code in PR #14560:
URL: https://github.com/apache/kafka/pull/14560#discussion_r1362644942


##
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java:
##
@@ -1660,6 +1663,34 @@ default FenceProducersResult 
fenceProducers(Collection transactionalIds)
 FenceProducersResult fenceProducers(Collection transactionalIds,
 FenceProducersOptions options);
 
+/**
+ * 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.
+ *
+ * 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 admin
+ * client to complete the request.
+ *
+ * If telemetry is disabled, the method will throw {@link 
IllegalStateException}.
+ *
+ * Client telemetry is controlled by the {@link 
AdminClientConfig#ENABLE_METRICS_PUSH_CONFIG}
+ * configuration option.
+ *
+ * @param timeout The maximum time to wait for admin client to determine 
its client instance ID.
+ *The value should be non-negative. Specifying a timeout 
of zero means do not

Review Comment:
   `should be` -> `must be` ?



##
clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java:
##
@@ -4385,6 +4385,11 @@ public FenceProducersResult 
fenceProducers(Collection transactionalIds,
 return new FenceProducersResult(future.all());
 }
 
+@Override
+public Uuid clientInstanceId(Duration timeout) {
+throw new UnsupportedOperationException();

Review Comment:
   nit: `UnsupportedOperationException("Not implemented yet.");`



##
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java:
##
@@ -1660,6 +1663,34 @@ default FenceProducersResult 
fenceProducers(Collection transactionalIds)
 FenceProducersResult fenceProducers(Collection transactionalIds,
 FenceProducersOptions options);
 
+/**
+ * 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.
+ *

Review Comment:
   Insert `` tag to get proper JavaDocs rendering (similar below)



##
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java:
##
@@ -1660,6 +1663,34 @@ default FenceProducersResult 
fenceProducers(Collection transactionalIds)
 FenceProducersResult fenceProducers(Collection transactionalIds,
 FenceProducersOptions options);
 
+/**
+ * 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.
+ *
+ * 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 admin
+ * client to complete the request.
+ *
+ * If telemetry is disabled, the method will throw {@link 
IllegalStateException}.
+ *
+ * Client telemetry is controlled by the {@link 
AdminClientConfig#ENABLE_METRICS_PUSH_CONFIG}
+ * configuration option.
+ *
+ * @param timeout The maximum time to wait for admin client to determine 
its client instance ID.
+ *The value should 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
+ *admin client is otherwise unusable.
+ * @throws IllegalArgumentException If the {@code timeout} is negative.
+ * @throws IllegalStateException If telemetry is not enabled.

Review Comment:
   ```suggestion
* @throws IllegalStateException If telemetry is not enabled, ie, config 
`{@code enable.metrics.push}` is set to `{@code false}`.
   ```



##
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java:
##
@@ -1660,6 +1663,34 @@ default FenceP

Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-17 Thread via GitHub


mjsax commented on code in PR #14560:
URL: https://github.com/apache/kafka/pull/14560#discussion_r1362638521


##
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java:
##
@@ -1660,6 +1663,34 @@ default FenceProducersResult 
fenceProducers(Collection transactionalIds)
 FenceProducersResult fenceProducers(Collection transactionalIds,
 FenceProducersOptions options);
 
+/**
+ * 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.
+ *
+ * If telemetry is enabled, this will first require a connection to the 
cluster to generate

Review Comment:
   ```suggestion
* If telemetry is enabled, this will first require a connection to 
the cluster to generate
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-17 Thread via GitHub


mjsax commented on code in PR #14560:
URL: https://github.com/apache/kafka/pull/14560#discussion_r1362638521


##
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java:
##
@@ -1660,6 +1663,34 @@ default FenceProducersResult 
fenceProducers(Collection transactionalIds)
 FenceProducersResult fenceProducers(Collection transactionalIds,
 FenceProducersOptions options);
 
+/**
+ * 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.
+ *
+ * If telemetry is enabled, this will first require a connection to the 
cluster to generate

Review Comment:
   ```suggestion
* If telemetry is enabled, this will first require a connection to 
the cluster to generate
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-16 Thread via GitHub


apoorvmittal10 commented on code in PR #14560:
URL: https://github.com/apache/kafka/pull/14560#discussion_r1361306135


##
clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java:
##
@@ -385,6 +391,10 @@ public class ProducerConfig extends AbstractConfig {
 atLeast(0L),
 Importance.LOW,
 
CommonClientConfigs.RETRY_BACKOFF_MAX_MS_DOC)
+.define(ENABLE_METRICS_PUSH_CONFIG,
+Type.BOOLEAN, true,

Review Comment:
   Missed it, thanks again.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-16 Thread via GitHub


apoorvmittal10 commented on code in PR #14560:
URL: https://github.com/apache/kafka/pull/14560#discussion_r1361305832


##
clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java:
##
@@ -1892,6 +1892,37 @@ public Map 
committed(final Set

Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-16 Thread via GitHub


apoorvmittal10 commented on code in PR #14560:
URL: https://github.com/apache/kafka/pull/14560#discussion_r1361305410


##
clients/src/main/java/org/apache/kafka/clients/CommonClientConfigs.java:
##
@@ -105,6 +105,10 @@ public class CommonClientConfigs {
 public static final int RETRY_BACKOFF_EXP_BASE = 2;
 public static final double RETRY_BACKOFF_JITTER = 0.2;
 
+public static final String ENABLE_METRICS_PUSH_CONFIG = 
"enable.metrics.push";
+public static final String ENABLE_METRICS_PUSH_DOC = "Kafka client 
telemetry provides Kafka operators improved visibility over the behavior and 
internals of the clients that use the cluster." +

Review Comment:
   Changed the text. Thanks :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-16 Thread via GitHub


apoorvmittal10 commented on code in PR #14560:
URL: https://github.com/apache/kafka/pull/14560#discussion_r1361305203


##
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java:
##
@@ -1660,6 +1662,34 @@ default FenceProducersResult 
fenceProducers(Collection transactionalIds)
 FenceProducersResult fenceProducers(Collection transactionalIds,
 FenceProducersOptions options);
 
+/**
+ * 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 destination(s).
+ *
+ * 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 admin
+ * client to complete the request.
+ *
+ * If telemetry is disabled, the method will throw {@link 
IllegalStateException}.
+ *
+ * Client telemetry is controlled by the {@link 
AdminClientConfig#ENABLE_METRICS_PUSH_CONFIG}
+ * configuration option.
+ *
+ * @param timeout The maximum time to wait for admin client to determine 
its client instance ID.
+ *The value should 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
+ *admin client is otherwise unusable.
+ * @throws IllegalArgumentException If the {@code timeout} is negative.
+ * @throws IllegalStateException If telemetry is not enabled.
+ * @return The client's assigned instance id used for metrics collection.
+ */
+String clientInstanceId(Duration timeout);

Review Comment:
   My bad, corrected everywhere.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-16 Thread via GitHub


AndrewJSchofield commented on code in PR #14560:
URL: https://github.com/apache/kafka/pull/14560#discussion_r1361262191


##
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java:
##
@@ -1660,6 +1662,34 @@ default FenceProducersResult 
fenceProducers(Collection transactionalIds)
 FenceProducersResult fenceProducers(Collection transactionalIds,
 FenceProducersOptions options);
 
+/**
+ * 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 destination(s).
+ *
+ * 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 admin
+ * client to complete the request.
+ *
+ * If telemetry is disabled, the method will throw {@link 
IllegalStateException}.
+ *
+ * Client telemetry is controlled by the {@link 
AdminClientConfig#ENABLE_METRICS_PUSH_CONFIG}
+ * configuration option.
+ *
+ * @param timeout The maximum time to wait for admin client to determine 
its client instance ID.
+ *The value should 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
+ *admin client is otherwise unusable.
+ * @throws IllegalArgumentException If the {@code timeout} is negative.
+ * @throws IllegalStateException If telemetry is not enabled.
+ * @return The client's assigned instance id used for metrics collection.
+ */
+String clientInstanceId(Duration timeout);

Review Comment:
   The return type is Uuid in the final version of the KIP.



##
clients/src/main/java/org/apache/kafka/clients/CommonClientConfigs.java:
##
@@ -105,6 +105,10 @@ public class CommonClientConfigs {
 public static final int RETRY_BACKOFF_EXP_BASE = 2;
 public static final double RETRY_BACKOFF_JITTER = 0.2;
 
+public static final String ENABLE_METRICS_PUSH_CONFIG = 
"enable.metrics.push";
+public static final String ENABLE_METRICS_PUSH_DOC = "Kafka client 
telemetry provides Kafka operators improved visibility over the behavior and 
internals of the clients that use the cluster." +

Review Comment:
   The KIP says "Whether to enable pushing of client metrics to the cluster, if 
the cluster has a client metrics subscription which matches this client." which 
sounds like a better description to me.



##
clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java:
##
@@ -4385,6 +4385,11 @@ public FenceProducersResult 
fenceProducers(Collection transactionalIds,
 return new FenceProducersResult(future.all());
 }
 
+@Override
+public String clientInstanceId(Duration timeout) {

Review Comment:
   Uuid



##
clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java:
##
@@ -1892,6 +1892,37 @@ public Map 
committed(final Set newOff
 endOffsets.putAll(newOffsets);
 }
 
+@Override
+public String clientInstanceId(Duration timeout) {

Review Comment:
   Uuid



##
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java:
##
@@ -1252,6 +1252,37 @@ public List partitionsFor(String topic) {
 return Collections.unmodifiableMap(this.metrics.metrics());
 }
 
+/**
+ * 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 destination(s).
+ *
+ * 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.
+ *
+ * If telemetry is disabled, the method will throw {@link 
IllegalStateException}.
+ *
+ * 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 should be non-negative. Specifying a timeout 
of zero means do not
+ 

Re: [PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-16 Thread via GitHub


apoorvmittal10 commented on PR #14560:
URL: https://github.com/apache/kafka/pull/14560#issuecomment-1765226156

   @AndrewJSchofield @mjsax Please review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] KAFKA-15613: Client API definition and configurations (KIP-714) [kafka]

2023-10-16 Thread via GitHub


apoorvmittal10 opened a new pull request, #14560:
URL: https://github.com/apache/kafka/pull/14560

   Initial PR for [KIP-714 Client API and 
Configurations](https://cwiki.apache.org/confluence/display/KAFKA/KIP-714%3A+Client+metrics+and+observability#KIP714:Clientmetricsandobservability-ClientAPI)
 - [KAFKA-15613](https://issues.apache.org/jira/browse/KAFKA-15613).
   
   This PR defines interface changes for accessing client instance id for 
clients. Also includes clients configuration changes.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org