-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Kafka add counters v1 uw2 #33503
Kafka add counters v1 uw2 #33503
Conversation
5b28665
to
5f28d22
Compare
Run Java PreCommit |
Run Java_IOs_Direct PreCommit |
Run Java_Pulsar_IO_Direct PreCommit |
Run Python_Coverage PreCommit |
Run Java PreCommit |
2 similar comments
Run Java PreCommit |
Run Java PreCommit |
tests failing due to #28957 |
Run Java PreCommit |
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
assign set of reviewers @johnjcasey @sjvanrossum flakey tests - want to get the review started in the meanwhile, but will wait on the tests to pass before I merge. |
Assigning reviewers. If you would like to opt out of this review, comment R: @kennknowles for label java. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
Run Java PreCommit |
2 similar comments
Run Java PreCommit |
Run Java PreCommit |
Would you mind adding some more context on what this change is doing?
2 questions:
|
Run Java PreCommit |
Run Java_GCP_IO_Direct PreCommit |
* 'supportsMetricsDeletion' is enabled. | ||
*/ | ||
@Override | ||
public void recordBacklogBytes(String topicName, int partitionId, long backlogBytes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's confusing how
KafkaSinkMetrics.createBacklogGauge(MetricName.named("KafkaSink", backlogs.getKey()));
and
Metrics.gauge(KafkaSinkMetrics.getMetricGaugeName(topicName, partitionId));
are different from just looking here.
From looking into the code, one sets perWorkerMetric when creating the DelegatingMetric. This is confusing because it is still a per-worker metric we are just reporting here, it is just in the MetricName.
Could we change things to be consistent? For example, what if KafkaMetrics always set the per-worker label and then the dataflow metric container looks for per-worker metric label and handles them differently if it wants to instead of the separate perWorkerGauge method?
It seems complicated that this kafkasinkmetrics has to know about the two possible reporting paths and which one works with different runners. For example, what if the non-sdf kakfa impl is run on v2 via the SDF wrapper? Or what if we supported SDF impl on v1?
eb4432e
to
8620b36
Compare
043392b
to
bdc7b6f
Compare
bdc7b6f
to
8e7785b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I like how it is keeping the interfaces simpler.
...ker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingStepMetricsContainer.java
Outdated
Show resolved
Hide resolved
@@ -388,7 +372,8 @@ private void deleteStaleCounters( | |||
@VisibleForTesting | |||
Iterable<PerStepNamespaceMetrics> extractPerWorkerMetricUpdates() { | |||
ConcurrentHashMap<MetricName, Long> counters = new ConcurrentHashMap<MetricName, Long>(); | |||
ConcurrentHashMap<MetricName, Long> gauges = new ConcurrentHashMap<MetricName, Long>(); | |||
ConcurrentHashMap<MetricName, Long> per_worker_gauges = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I don't think this (or counters) needs to be Concurrent. How about using ImmutableMapBuilder and then build when passing to convert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, that should be done for all of them, will do that in the followup clean up CL.
gauges.put(k, val); | ||
v.reset(); | ||
// Check if metric name has the per worker label set | ||
if (k.getLabels().containsKey("PER_WORKER_METRIC") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be optimized by keeping the perWorkerGauges and populating it by doing this labels check when the gauge is created.
Could add a comment about possible optimization and do it when fixing the other metric types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that makes sense, so we don't have to check each time we process an update.
...ker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingStepMetricsContainer.java
Outdated
Show resolved
Hide resolved
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaMetrics.java
Outdated
Show resolved
Hide resolved
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaSinkMetrics.java
Outdated
Show resolved
Hide resolved
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaSinkMetrics.java
Outdated
Show resolved
Hide resolved
727229b
to
08a259f
Compare
...rs/core-java/src/main/java/org/apache/beam/runners/core/metrics/MonitoringInfoConstants.java
Outdated
Show resolved
Hide resolved
08a259f
to
8e89e97
Compare
Run Java PreCommit |
1 similar comment
Run Java PreCommit |
Run Java_PVR_Prism_Loopback PreCommit |
Run Python_Dataframes PreCommit |
Run Python_Dataframes PreCommit 3.10 |
Run Java PreCommit |
3 similar comments
Run Java PreCommit |
Run Java PreCommit |
Run Java PreCommit |
Add per worker metadata on metrics propaged over FnApi. This is on top of #33408
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123
), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.