[ 
https://issues.apache.org/jira/browse/BEAM-4775?focusedWorklogId=209744&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-209744
 ]

ASF GitHub Bot logged work on BEAM-4775:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Mar/19 20:09
            Start Date: 07/Mar/19 20:09
    Worklog Time Spent: 10m 
      Work Description: ryan-williams commented on pull request #7934: 
[BEAM-4775] add GetJobMetrics RPC
URL: https://github.com/apache/beam/pull/7934#discussion_r263475335
 
 

 ##########
 File path: 
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MonitoringInfoMetricName.java
 ##########
 @@ -112,12 +135,27 @@ public boolean equals(Object o) {
     return this.urn.equals(other.urn) && this.labels.equals(other.labels);
   }
 
+  /**
+   * String-representation of this {@link MonitoringInfoMetricName} with a 
custom delimiter.
+   *
+   * <p>See discussion on {@link MetricKey#toString}; metric "label" info is 
currently split between
+   * {@link MetricKey#stepName} and {@link MonitoringInfoMetricName#labels} 
(the former holds {@link
+   * SimpleMonitoringInfoBuilder#PTRANSFORM_LABEL ptransform} info, and the 
latter {@link
+   * SimpleMonitoringInfoBuilder#PCOLLECTION_LABEL info}.
+   *
+   * <p>For now, we bake in the assumption here that {@link 
MonitoringInfoMetricName#toString} is
+   * only responsible for inlining the pcollection label to the string 
representation.
+   *
+   * <p>Later, {@link MonitoringInfoMetricName} and {@link MetricKey} will be 
merged, and this
+   * handling unified.
+   */
   @Override
-  public String toString() {
-    StringBuilder builder = new StringBuilder();
-    builder.append(this.urn.toString());
-    builder.append(" ");
-    builder.append(this.labels.toString());
-    return builder.toString();
+  public String toString(String delimiter) {
+    StringBuilder sb = new StringBuilder();
+    if (labels.containsKey(PCOLLECTION_LABEL)) {
 
 Review comment:
   I tried to explain it at length in the javadoc of this method, above. If 
that explanation isn't clear let me know.
   
   To paraphrase: MonitoringInfoMetricName is an awkward object that I remove 
in #7915, but have to deal with here to make job metrics RPC workable without 
depending on that refactor. If we decide to go with #7915 first then we could 
avoid this intermediate state.
   
   MIMN is awkward because it stores labels, but MetricName (which it extends) 
normally doesn't (MetricKey does; currently just the ptransform label, but 
that's also expanded in #7915).
   
   This was the simplest way to make `toString` work for existing call-sites 
that want [a ptransform xor pcollection label], without doing the larger 
cleanup in #7915.
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 209744)
    Time Spent: 34h 50m  (was: 34h 40m)

> JobService should support returning metrics
> -------------------------------------------
>
>                 Key: BEAM-4775
>                 URL: https://issues.apache.org/jira/browse/BEAM-4775
>             Project: Beam
>          Issue Type: Bug
>          Components: beam-model
>            Reporter: Eugene Kirpichov
>            Assignee: Ryan Williams
>            Priority: Major
>              Labels: triaged
>          Time Spent: 34h 50m
>  Remaining Estimate: 0h
>
> Design doc: [https://s.apache.org/get-metrics-api].
> h1. Relevant PRs in flight:
> h2. Approved / Ready to merge:
> None atm.
> h2. Ready for Review:
>  * [#7971|https://github.com/apache/beam/pull/7971]: Flink portable metrics: 
> get ptransform from MonitoringInfo, not stage name
>  ** this is a simpler, Flink-specific PR that is basically duplicated inside 
> each of the following two, so may be worth trying to merge in first
>  * [#7934|https://github.com/apache/beam/pull/7934]: add GetJobMetrics RPC, 
> Java+Python SDK support for it
>  * #[7915|https://github.com/apache/beam/pull/7915]: use MonitoringInfo data 
> model in Java SDK metrics
> h2. Iterating / Discussing:
>  * [#7868|https://github.com/apache/beam/pull/7868]: MonitoringInfo URN tweaks
> h2. Merged
>  * [#7867|https://github.com/apache/beam/pull/7867]: key MetricResult by a 
> MetricKey
>  * [#7938|https://github.com/apache/beam/pull/7938]: move MonitoringInfo 
> protos to model/pipeline module
>  * [#7883|https://github.com/apache/beam/pull/7883]: Add 
> MetricQueryResults.allMetrics() helper
>  * [#7866|https://github.com/apache/beam/pull/7866]: move function helpers 
> from fn-harness to sdks/java/core
>  * [#7890|https://github.com/apache/beam/pull/7890]: consolidate MetricResult 
> implementations
> h2. Closed
>  * [#7876|https://github.com/apache/beam/pull/7876]: Clean up metric protos; 
> support integer distributions, gauges
> h1. Likely pieces still to come:
> Per recent discussion with [~robertwb], I'm going to move the MonitoringInfo 
> protos into the {{model/pipeline}} module, which the Job API, Fn API, and 
> sdks/java/core all depend on already, as it's a good/central place for them.
> h1. Previous Description:
> [https://github.com/apache/beam/blob/master/model/job-management/src/main/proto/beam_job_api.proto]
>  currently doesn't appear to have a way for JobService to return metrics to a 
> user, even though 
> [https://github.com/apache/beam/blob/master/model/fn-execution/src/main/proto/beam_fn_api.proto]
>  includes support for reporting SDK metrics to the runner harness.
> Metrics are apparently necessary to run any ValidatesRunner tests because 
> PAssert needs to validate that the assertions succeeded. However, this 
> statement should be double-checked: perhaps it's possible to somehow work 
> with PAssert without metrics support.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to