Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions model/job-management/src/main/proto/beam_job_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ option java_outer_classname = "JobApi";
import "beam_runner_api.proto";
import "endpoints.proto";
import "google/protobuf/struct.proto";
import "metrics.proto";

// Job Service for running RunnerAPI pipelines
service JobService {
Expand All @@ -54,6 +55,9 @@ service JobService {
// Subscribe to a stream of state changes and messages from the job
rpc GetMessageStream (JobMessagesRequest) returns (stream JobMessagesResponse);

// Fetch metrics for a given job
rpc GetJobMetrics (GetJobMetricsRequest) returns (GetJobMetricsResponse);

// Get the supported pipeline options of the runner
rpc DescribePipelineOptions (DescribePipelineOptionsRequest) returns (DescribePipelineOptionsResponse);
}
Expand Down Expand Up @@ -179,6 +183,21 @@ message JobState {
}


message GetJobMetricsRequest {
string job_id = 1; // (required)
}

message GetJobMetricsResponse {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started with this, per https://s.apache.org/get-metrics-api.

Converting between this proto and the SDK reprs (Java, Python) made it clear that we were actually introducing a proto representation of SDKs' MetricResults.

For example, MetricResultsProtos.java was originally GetJobMetricsResponseUtils.java:

public class GetJobMetricsResponseUtils {
  public static GetJobMetricsResponse   toProto(        MetricResults metricResults) { … }
  public static         MetricResults fromProto(GetJobMetricsResponse          resp) { … }
}

The signatures (and implementations) implied a broader purpose in ongoing discussions around metrics structures in the protos and SDKs.

Framing it as just part of this RPC obfuscated that role, to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, re-introduced the proto.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Should it live in metrics.proto though?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is really specific to a particular job, but I don't feel that strongly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good

MetricsResults metrics = 1;
}

// All metrics for a given job. Runners may support one or the other or both.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today, runners either populate ["attempted" only] or both; dunno if worth clarifying here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's acceptable to populate committed only as well.

message MetricsResults {
org.apache.beam.model.pipeline.v1.MonitoringInfo attempted = 1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh, these were supposed to be repeated, I think

org.apache.beam.model.pipeline.v1.MonitoringInfo committed = 2;
}


// DescribePipelineOptions provides metadata about the options supported by a runner.
// It will be used by the SDK client to validate the options specified by or
// list available options to the user.
Expand Down