Repository navigation
[BEAM-4775] MonitoringInfo URN tweaks - #7868
ryan-williams wants to merge 7 commits into
Conversation
|
Run Java PreCommit |
| // TODO(ajamato): Add the PTRANSFORM name as a required label after | ||
| // upgrading the python SDK. | ||
| USER_COUNTER = 0 [(monitoring_info_spec) = { | ||
| USER_METRIC = 0 [(monitoring_info_spec) = { |
There was a problem hiding this comment.
beam:metric:user: is a prefix, not a full URN, and probably shouldn't be in this table.
There was a problem hiding this comment.
Currently, metrics are either of "user" type (defined by {ptransform, namespace, name}), or they're one of the 5 "system"-metric types below.
It's true that the "user" category is not a "specific URN", so there is tension with e.g. this docstring above.
I think of this table as enumerating the possible metrics-URN categories (indeed, that's what it does, and what our design calls for, as opposed to e.g. enumerating all allowed "user"-metric URNs here). The 5 "system" categories are each inhabited by exactly one URN, so they are particularly easy to deal with in SDKs, while the user-metric category requires special treatment (which, conveniently, the SDKs already implement).
In this PR, I am laying some groundwork toward supporting more "types" of metrics (both "user" and "system"). "User" metrics should be able to take on the three types listed here (counter, distribution, gauge).
With that context, there's a few directions I can see taking your comment:
- split the "user" category into 3 type-specific user-categories
- leave as-is, but make the docs more clear about the special status of
USER_METRIC's "spec" - some larger overhaul involving removing user metrics from this table.
Let me know what you think!
There was a problem hiding this comment.
The "user metric" prefix should not be in this table. (We also shouldn't be restricting user metrics here, any valid metric type is a valid user metric type.)
There was a problem hiding this comment.
OK. Should USER_METRIC_URN_PREFIX (aka USER_COUNTER_URN_PREFIX) also not be in MonitoringInfoUrns.Enum, or is the issue just with this MonitoringInfoSpecs table?
There was a problem hiding this comment.
Just an issue with the table, which should be listing specific metrics.
There was a problem hiding this comment.
OK, so:
- I'll remove this "plural
type_urn" change - I'll also remove this
USER_METRIC(akaUSER_COUNTER) entry fromMonitoringInfoSpecs.Enum - user metrics will trivially pass validation as they'll have a
null"spec"
sgty?
There was a problem hiding this comment.
@Ardagan and I have discussed that its not really the best idea to make the URN a prefix for the user metric. As this has led to writing a lot of code to parse the URN to obtain those fields out. And being this weird exception makes all the code have to special case it.
It would be better to package the namespace and name as a label on the MonitoringInfo.
Then we could use the same URN everywhere, no parsing, no special casing.
Given this, then there are two choices i.e.
(1) Use a different URN for user gauge, counter and distribution
- "beam:metric:user:counter:v1"
- "beam:metric:user:gauge:v1"
- "beam:metric:user:distribution:v1"
Then change the MonitoringInfoSpec:
required_labels: [ "PTRANSFORM", "NAMESPACE", "NAME" ],
and each will have a separate type_urn in their spec.
type_urn:
(2) Use a single URN "beam:metric:user:v1" for user gauge, counter, distribution
Then change the MonitoringInfoSpec as well:
required_labels: [ "PTRANSFORM", "NAMESPACE", "NAME" ],
and we will NOT enforce the type_urn in the spec.
I prefer #1, as this will better describe each one, and if we add new user metric styles we can add a spec for them
81f77f9 to
53c54f0
Compare
|
Run Java PreCommit |
ajamato
left a comment
There was a problem hiding this comment.
Just curious, what were you hoping to get out of this change in particular? This is largely a bunch of renamings, was it too confusing before?
| ELEMENT_COUNT = 0 [(monitoring_info_spec) = { | ||
| urn: "beam:metric:element_count:v1", | ||
| type_urn: "beam:metrics:sum_int_64", | ||
| // TODO(ryan): we currently also generate this metric with ["PTRANSFORM"] labels, but it fails validation in |
There was a problem hiding this comment.
That's in python @Ardagan is fixing that implementation to emit the PCollection name. This is the one spec runners should support.
There was a problem hiding this comment.
OK. I'll leave this for now, perhaps I can remove it before this gets merged, if @Ardagan fixes it first, or lmk what you suggest!
| // MonitoringInfo protos. | ||
| message MonitoringInfoSpecs { | ||
| enum Enum { | ||
| // TODO(ajamato): Add the PTRANSFORM name as a required label after |
There was a problem hiding this comment.
Let's keep this one in please. @Ardagan's validation is going to pull in these strings soon. We are hoping to remove the MonitoringInfoUrns section and just have MonitoringInfoSpecs
There was a problem hiding this comment.
The problem is that "beam:metric:user:" isn't actually a counter, nor does it have a specific type, so putting it in this list seems wrong. It's just a prefix that we assert will not be used for any runner-generated counters.
[If we do remove it, no need to renumber everything else.]
There was a problem hiding this comment.
[If we do remove it, no need to renumber everything else.]
generateProto fails without the renumbering:
Execution failed for task ':beam-model-fn-execution:generateProto'.
> protoc: stdout: . stderr: beam_fn_api.proto: The first enum value must be zero in proto3.
There was a problem hiding this comment.
(update: it seems if I only renumber the first entry to 0, I can skip 1 and leave the others untouched. Given that these aren't really used yet, it feels cleaner to just renumber them all now)
There was a problem hiding this comment.
My take on this:
- It is better ot keep this spec present. It defines what fields user counter needs.
- We can rename this element to something like USER_COUNTER_PREFIX for clarity.
- It is ok to move it away from this list, but we should still keep it somewhere for generic validation and specification. However in this case we might want to move it away from MonitoringInfoUrns as well.
- Currently, we have urns defined in this list and in MonitoringInfoUrns. I was thinking of removing MonitoringInfoUrns completely and keep only MonitoringInfoSpecs as explicit source of truth.
| if (urn.startsWith(USER_METRIC_URN_PREFIX)) { | ||
| urn = urn.substring(USER_METRIC_URN_PREFIX.length()); | ||
| } else { | ||
| return null; |
There was a problem hiding this comment.
Did you encounter this somewhere? Hopefully this isn't called if the metric isn't actually starting with USER_METRIC_URN_PREFIX
There was a problem hiding this comment.
As of this PR, this helper is called in two places:
MonitoringInfoMetricName.parseUrn:- use the parsed user-
MetricName, if possible throwif it's not a user-metric (signaled bynullreturn here)
- use the parsed user-
FlinkMetricContainer.updateMetrics:- use the parsed user-
MetricName, if possible - skip the metric if it's not a user-metric (again, signaled by
nullreturn)- in later PRs I make Flink support system-metrics as well.
- use the parsed user-
This was the most direct way to support those uses. The Flink metrics do actually see system metrics, and should gracefully skip them instead of throwing (for now).
There are 2 renamings:
There are also 6 other commits here that each constitute minor forward progress, I think:
Sorry if it just feels like dust. I thought these were all thematically similar and a reasonable chunk to pull out of #7823 and reckon with independently. |
dac2905 to
0715c19
Compare
|
Run Java PreCommit |
|
|
Run Java PreCommit |
…nfoToCounterUpdateTransformer
|
This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions. |
|
This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
|
This pull request is no longer marked as stale. |
|
This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions. |
|
This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
rename a couple of proto URNs and specs, and perform a few other improvements to the Java SDK's handling of MonitoringInfos
R: @robertwb, @ajamato
Post-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.