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

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

                Author: ASF GitHub Bot
            Created on: 27/Feb/19 04:54
            Start Date: 27/Feb/19 04:54
    Worklog Time Spent: 10m 
      Work Description: ryan-williams commented on pull request #7934: [DO NOT 
MERGE] [BEAM-4775] add GetJobMetrics RPC
URL: https://github.com/apache/beam/pull/7934#discussion_r260589315
 
 

 ##########
 File path: 
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MonitoringInfoMetricName.java
 ##########
 @@ -85,12 +87,33 @@ public String getUrn() {
   }
 
   /** @return The labels associated with this MonitoringInfo. */
-  public HashMap<String, String> getLabels() {
+  public Map<String, String> getLabels() {
     return this.labels;
   }
 
-  public static MonitoringInfoMetricName named(String urn, HashMap<String, 
String> labels) {
-    return new MonitoringInfoMetricName(urn, labels);
+  /**
+   * Polymorphic constructor of {@link MetricName}s.
+   *
+   * <p>If `urn` is a {@link 
SimpleMonitoringInfoBuilder#USER_COUNTER_URN_PREFIX metric}, return a
+   * {@link MetricName} auto-value (which will {@link Object#equals equal} and 
{@link
+   * Object#hashCode hash} consistently with other {@link MetricName}s.
+   *
+   * <p>Otherwise, return a concrete {@link MonitoringInfoMetricName} 
representing a "system"
+   * metric.
+   */
+  public static MetricName named(String urn, Map<String, String> labels) {
+    checkArgument(!Strings.isNullOrEmpty(urn), "MonitoringInfoMetricName urn 
must be non-empty");
 
 Review comment:
   In the MonitoringInfos-everywhere world, it's natural to have MIs that are a 
mix of user- and system-metrics, and want to turn them into SDK reprs (incl. 
MetricNames).
   
   In this PR, I rely on [the ability to correctly make an 
`AutoValue_MetricName` for user-metrics and a `MonitoringInfoMetricName` for 
system metrics in two places]:
   - Flink's bundle-progress listener converts mixed MIs [here]().
   - The MetricResultsProtos conversion code-path [uses 
them](https://github.com/apache/beam/pull/7934/files#diff-e722f484e12b515353e20532d3550465R178)
 
([`keyFromMonitoringInfo`](https://github.com/apache/beam/pull/7934/files#diff-f0ebadd9b3dbb03171ac530fab654d5dR107)
 calls [`MIMN.create` 
below](https://github.com/apache/beam/pull/7934/files#diff-ba1b936a7d4c8d43789e81a816b9bb90R115),
 which calls this); this is how [JobServicePipelineResult to convert 
MetricResults proto to an SDK 
MetricResults](https://github.com/apache/beam/pull/7934/files#diff-284acf2526fcf07c05ee44aefbd9d0c3R134).
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: 204988)
    Time Spent: 26h  (was: 25h 50m)

> 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: 26h
>  Remaining Estimate: 0h
>
> Design doc: [https://s.apache.org/get-metrics-api].
> h1. Relevant PRs in flight:
> h2. Approved / Ready to merge:
>  * [#7938|https://github.com/apache/beam/pull/7938]: move MonitoringInfo 
> protos to model/pipeline module
>  * [#7867|https://github.com/apache/beam/pull/7867]: key MetricResult by a 
> MetricKey
> h2. Ready for Review:
>  * [#7934|https://github.com/apache/beam/pull/7934]: add GetJobMetrics RPC, 
> Java+Python SDK support for it
>  * 
>  ** will need to be rebased on top of 
> [#7938|https://github.com/apache/beam/pull/7938]
>  * #[7915|https://github.com/apache/beam/pull/7915]: use MonitoringInfo data 
> model in Java SDK metrics
>  ** Depends on [#7867|https://github.com/apache/beam/pull/7867]
>  ** will be need to be rebased on top of 
> [#7938|https://github.com/apache/beam/pull/7938]
>  ** Both of these require adding a {{sdks/java/core}} dependency on the 
> {{model/fn-execution}} protos module.
>  *** I want to discuss whether that's ok.
>  *** It may not be totally necessary; see discussion on 
> #[7915|https://github.com/apache/beam/pull/7915].
> h2. Iterating / Discussing:
>  * [#7868|https://github.com/apache/beam/pull/7868]: MonitoringInfo URN tweaks
> h2. Merged
>  * [#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