Skip to content
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

[FLINK-7718] [flip6] Add JobVertexMetricsHandler to DispatcherRestEndpoint #5055

Closed
wants to merge 13 commits into from

Conversation

GJL
Copy link
Member

@GJL GJL commented Nov 22, 2017

Brief change log

  • Migrate logic in org.apache.flink.runtime.rest.handler.legacy.metrics.JobVertexMetricsHandler to new handler and add new handler to DispatcherRestEndpoint.
  • Add common classes for remaining implementations of
    org.apache.flink.runtime.rest.handler.legacy.metrics.AbstractMetricsHandler,
    which require migration as well

Verifying this change

This change added tests and can be verified as follows:

  • Added tests for all new classes and old classes except for DispatcherRestEndpoint
  • Manually deployed a job locally and verified with curl that JobVertexMetrics can be queried in FLIP-6.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

CC: @tillrohrmann

…point

Migrate logic in
org.apache.flink.runtime.rest.handler.legacy.metrics.JobVertexMetricsHandler to
new handler and add new handler to DispatcherRestEndpoint. Add common classes
for remaining implementations of
org.apache.flink.runtime.rest.handler.legacy.metrics.AbstractMetricsHandler,
which require migration as well.

final List<Metric> metrics = new ArrayList<>(requestedMetrics.size());
for (final String requestedMetric : requestedMetrics) {
final String value = componentMetricStore.getMetric(requestedMetric, null);
Copy link
Member Author

@GJL GJL Nov 23, 2017

Choose a reason for hiding this comment

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

If requestedMetric is an empty string, we will return HTTP code 404. This is different compared to the legacy handler. If this is a problem, I can change it to the old behavior (return empty string with HTTP 200).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we actually have a slightly inconsistent behaviour here. In case that componentMetricStore or componentMetricStore.metrics is null we return an empty metrics object. But in case that a requested metric is not there (might not be registered or transferred yet) we fail with a 404. With the current way we handle a non-existent metric store, it would be more consistent to simply not report metrics which are not there.

Furthermore, it could also be the case that only a subset of the requested metrics is not yet registered.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed the behavior:

  • Unknown metrics are not included.
  • If all metrics are unknown, an empty list is returned.

/**
* Tests for {@link MetricsFilterParameter}.
*/
public class MetricsFilterParameterTest {
Copy link
Member Author

@GJL GJL Nov 23, 2017

Choose a reason for hiding this comment

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

Should inherit from TestLogger.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @GJL. Changes look good. I only had a single comment concerning how we handle non existent metrics and non existent component metric store. Once this is resolved, we can merge the PR.


final List<Metric> metrics = new ArrayList<>(requestedMetrics.size());
for (final String requestedMetric : requestedMetrics) {
final String value = componentMetricStore.getMetric(requestedMetric, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we actually have a slightly inconsistent behaviour here. In case that componentMetricStore or componentMetricStore.metrics is null we return an empty metrics object. But in case that a requested metric is not there (might not be registered or transferred yet) we fail with a 404. With the current way we handle a non-existent metric store, it would be more consistent to simply not report metrics which are not there.

Furthermore, it could also be the case that only a subset of the requested metrics is not yet registered.

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

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

Changes look good to me. Will rebase and once Travis gives green light merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants