-
Notifications
You must be signed in to change notification settings - Fork 14.8k
KAFKA-19773: Include push interval in ClientTelemetryReceiver context #20672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f92152c
KAFKA-19773: Include push interval in ClientTelemetryReceiver context
see-quick 276dfec
mickael review
see-quick 33844ac
eof
see-quick 6fade3f
spotbugs issues
see-quick fff2f78
review from andrew
see-quick ce92468
a nit with `isTelemetryExporterConfigured`
see-quick 776ade2
update dynamicbrokerconfig naming to reflect clientTelemetryExporterP…
see-quick 65f8677
add test case for dynamic configuration within client telemetry exporter
see-quick 59b29b6
remove prefix impornts and directly import it
see-quick 73f3348
be more strict on verify part with exactly once interactions
see-quick 4b1fb23
mickael review simplification
see-quick f16831e
add also intergration tests for streams and clients + address Andrew
see-quick 2279146
support just new API in streams tests
see-quick 21f98bc
checkstyle
see-quick bf6e26f
proper formatting
see-quick e7f1ee2
adjust import control
see-quick 2aa3bc4
adjust javadoc to mention just new API
see-quick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
clients/src/main/java/org/apache/kafka/server/telemetry/ClientTelemetryContext.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.kafka.server.telemetry; | ||
|
|
||
| import org.apache.kafka.server.authorizer.AuthorizableRequestContext; | ||
|
|
||
| /** | ||
| * {@code ClientTelemetryContext} provides context information for client telemetry requests, | ||
| * including the push interval. | ||
| */ | ||
| public interface ClientTelemetryContext { | ||
|
|
||
| /** | ||
| * Returns the interval at which the client pushes telemetry metrics to the broker. | ||
| * This is the interval from the subscription. | ||
| * <p> | ||
| * Note that for the initial metric push and pushes following a subscription update | ||
| * or error, a jitter (between 0.5x and 1.5x of this interval) is applied to avoid | ||
| * multiple clients sending requests simultaneously. | ||
| * <p> | ||
| * This value can be used by metrics exporters to determine when metrics should be | ||
| * considered stale or expired. | ||
| * | ||
| * @return the push interval in milliseconds from the subscription | ||
| */ | ||
| int pushIntervalMs(); | ||
|
|
||
| /** | ||
| * Returns the authorization context for the client request. | ||
| * | ||
| * @return the client request context for the corresponding {@code PushTelemetryRequest} API call | ||
| */ | ||
| AuthorizableRequestContext authorizableRequestContext(); | ||
| } | ||
38 changes: 38 additions & 0 deletions
38
clients/src/main/java/org/apache/kafka/server/telemetry/ClientTelemetryExporter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.kafka.server.telemetry; | ||
|
|
||
| /** | ||
| * {@code ClientTelemetryExporter} defines the behavior for telemetry exporters on the broker side | ||
| * which receive and export client telemetry metrics and provides additional context including the | ||
| * push interval. | ||
| */ | ||
| public interface ClientTelemetryExporter { | ||
|
|
||
| /** | ||
| * Called by the broker when a client reports telemetry metrics. The telemetry context | ||
| * includes the push interval and authorization details which can be used by the metrics | ||
| * exporter to manage metric lifecycle and retrieval of additional client information. | ||
| * <p> | ||
| * This method may be called from the request handling thread, and as such should avoid blocking. | ||
| * | ||
| * @param context the client telemetry context including push interval and request authorization context | ||
| * @param payload the encoded telemetry payload as sent by the client | ||
| */ | ||
| void exportMetrics(ClientTelemetryContext context, ClientTelemetryPayload payload); | ||
| } |
36 changes: 36 additions & 0 deletions
36
clients/src/main/java/org/apache/kafka/server/telemetry/ClientTelemetryExporterProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.kafka.server.telemetry; | ||
|
|
||
| import org.apache.kafka.common.metrics.MetricsReporter; | ||
|
|
||
| /** | ||
| * A {@link MetricsReporter} may implement this interface to indicate support for collecting client | ||
| * telemetry on the server side using the new exporter API. | ||
| */ | ||
| public interface ClientTelemetryExporterProvider { | ||
|
|
||
| /** | ||
| * Called by the broker to fetch instance of {@link ClientTelemetryExporter}. | ||
| * <p> | ||
| * This instance may be cached by the broker. | ||
| * | ||
| * @return broker side instance of {@link ClientTelemetryExporter} | ||
| */ | ||
| ClientTelemetryExporter clientTelemetryExporter(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.