Repository navigation
[DO NOT MERGE] [BEAM-4775] Portable metrics over the job-server API - #7641
ryan-williams wants to merge 27 commits into
Conversation
797b3f8 to
6a21a6b
Compare
- MetricKey - MetricName - MetricQueryResults - MetricsContainerStepMap
6a21a6b to
497e9f6
Compare
ryan-williams
left a comment
There was a problem hiding this comment.
Highlighting a couple things for discussion / TODOs for myself
| } | ||
| } | ||
|
|
||
| message Metric { |
There was a problem hiding this comment.
FYI: I moved these into the model/pipeline module, where they are depended on by model/fn-execution and model/job-management modules.
They are in their own file there, beam_pipeline_metrics.proto.
There was a problem hiding this comment.
+1, I was about to suggest exactly this.
Could you perhaps break that out as a separate PR that we can get in while we are still working on the rest?
| message DistributionData { | ||
| oneof distribution { | ||
| IntDistributionData int_distribution_data = 1; | ||
| DoubleDistributionData double_distribution_data = 2; |
There was a problem hiding this comment.
TODO: per discussion with @ajamato, I think we were leaning toward only supporting the Int-types for now; existing Java metrics hard-code longs for counters, distributions, and gauges.
| option java_outer_classname = "PipelineMetrics"; | ||
|
|
||
| message MetricKey { | ||
| string step = 1; |
There was a problem hiding this comment.
This MetricKey and MetricName mimic classes in Java and Python, and represent them over the wire.
TODO: use these to replace the SDK-specific classes?
@ajamato's new scheme (in #7624) identifies PCollection-scoped metrics by a null "step" value.
TODO: should they be abandoned over the wire (and in SDKs?) in favor of URNs?
| * Update Flink's internal metrics ({@link this#flinkCounterCache}) with the latest metrics for a | ||
| * given step. | ||
| */ | ||
| void updateMetrics(String stepName) { |
There was a problem hiding this comment.
The "step name" had an incorrect value in portable contexts, pertaining to the name of a fused stage.
This now queries metrics for all steps that the metricsAccumulator has data for.
TODO: verify non-portable Flink code-paths didn't rely on this in any way.
| .get() | ||
| .getJobMetrics(JobApi.GetJobMetricsRequest.newBuilder().setJobIdBytes(jobId).build()); | ||
| List<JobApiMetrics.MetricStatus> statuses = response.getMetricStatusesList(); | ||
| List<MetricResult<Long>> counters = new ArrayList<>(); |
There was a problem hiding this comment.
TODO: factor the proto→Java conversions here out to Protos.java
| /** Return the metric results for the gauges that matched the filter. */ | ||
| public abstract Iterable<MetricResult<GaugeResult>> getGauges(); | ||
|
|
||
| static <T> void printMetrics(String type, Iterable<MetricResult<T>> metrics, PrintStream ps) { |
| oneof data { | ||
| CounterData counter_data = 1; | ||
| DistributionData distribution_data = 2; | ||
| ExtremaData extrema_data = 3; |
There was a problem hiding this comment.
TODO: ExtremaData isn't populated or consumed in the SDKs (afaik)
| @Override | ||
| public MetricResults metrics() { | ||
| throw new UnsupportedOperationException("Not yet implemented."); | ||
| if (metricResults == null) { |
There was a problem hiding this comment.
The semantics are currently that this should be called once the state is DONE, and at that time it fetches + caches the MetricsResults object for this job from the job server.
TODO: bypass caching the MetricResults object until the state becomes DONE, so that metrics() can be polled while a job is running.
| } | ||
| } | ||
|
|
||
| // Data associated with a Counter or Gauge metric. |
There was a problem hiding this comment.
TODO: support gauges being sent as CounterData
…, PTransformFunctionRegistry, remove use of MetricContainerKey due to risk of accesing heap for every element
497e9f6 to
85e066e
Compare
|
Let me know when you want to continue the review here. I would love to use this as a way to start writing tests for Metrics using the Dataflow Runner and the Unified Local Runner. |
|
see #7823 |
(Superseded by #7823)
(also fixes BEAM-4776 (Java) and BEAM-4777 (Python)
This currently sits on top of ajamato#1 (which adds a couple of tweaks to #7624) and #7656.
The last 11 commits (beginning with
add GetJobMetrics RPC, associated protos) are hopefully well-differentiated, and represent the actual new functionality not covered by the PRs it's based on.With this merged:
attemptedmetrics if there are nocommittedmetrics)Submitting now to start CI-debugging, and also to seed some design discussions.
CC: @ajamato @mxm @robertwb @angoenka @tweise
Post-Commit Tests Status (on master branch)