-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
feat: deprecations metric #13735
feat: deprecations metric #13735
Conversation
ba4f1a1
to
b0af5bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment, will leave up to you to decide.
func ObjectName(ctx context.Context) string { | ||
if n, ok := ctx.Value(name).(string); ok { | ||
return n | ||
} | ||
return "" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd personally prefer returning a boolean as well.
Exactly like how maps work.
I know this is guaranteed to have this key though.
But we do check the ok in the cast, continuing on with this lack of assuming things, we should also return an ok
bool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When someone needs it we can add that, right now it wouldn't be used, so not adding in this commit.
func ObjectNamespace(ctx context.Context) string { | ||
if n, ok := ctx.Value(namespace).(string); ok { | ||
return n | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
c13c231
to
25718e9
Compare
A metric to measure the use of deprecated features in the code base Signed-off-by: Alan Clucas <[email protected]>
25718e9
to
37a371a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had some WIP comments here too
@@ -248,6 +248,7 @@ nav: | |||
- offloading-large-workflows.md | |||
- workflow-archive.md | |||
- metrics.md | |||
- deprecations.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put this next to upgrading.md
and link to it from there too.
Same as the "New features" page we discussed in the Contributor Meeting, having it per version and matching up with the upgrading guide will make it easier to follow. EDIT: See also #13739 (comment)
Although arguably deprecations should be part of the upgrading guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although arguably deprecations should be part of the upgrading guide.
I see this has been done in #13757 now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly to above, I would put all the H2 headings here a under a 3.6 version heading so that the upgrading guide could reference it per version. With no versions on this page, it's hard to understand when something was deprecated, and some of these also reference features that are only available in newer versions
As we have already had users attempt to use 3.5 and 3.6 features in older versions when there were no version annotations (#13645 as one example), I could definitely see users reading this, seeing the deprecation, trying the new syntax, and then getting a syntax error and raising an issue.
Sometimes a feature of Argo Workflows is deprecated. | ||
You should stop using a deprecated feature as it may be removed in a future minor or major release of Argo Workflows. | ||
|
||
To determine if you are using a deprecated feature the [`deprecated_feature`](metrics.md#deprecated_feature) metric can help. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would definitely be good to have a version annotation for this metric too, as people will see this page, try to use it, and not realize that it's not available in older versions, and perhaps even think they're in the clear because of that.
If the number is going up the feature is still in use by your system. | ||
If the metric is not present or no longer increasing are no longer using the monitored deprecated features. | ||
|
||
## `cronworkflow schedule` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would name these for their respective features so that they are easily correlated, and then perhaps have a "> cronworkflow schedule
attribute" to indicate that this is what the metric displays. I think it's difficult to tell that this is referring to those specific names unless you have specifically came from the metric's page and read it in detail.
This page isn't specific to the metric though, it's just named "Deprecations" in general as well, so it can reference it but should be its own independent page as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would also be good to link to the feature page for each of these which will have more details and examples
schedule: "30 1 * * *" | ||
``` | ||
is replaced with | ||
```yaml | ||
spec: | ||
schedules: | ||
- "30 1 * * *" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These examples would likely be easier to understand quickly with a ```diff, i.e.:
- schedule: "30 1 * * *"
+ schedules:
+ - "30 1 * * *"
## `cronworkflow schedule` | ||
|
||
The spec field `schedule` which takes a single value is replaced by `schedules` which takes a list. | ||
To update this replace the `schedule` with `schedules` as in the following example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To update this replace the `schedule` with `schedules` as in the following example | |
To update this replace the `schedule` with `schedules` as in the following example: |
Colons are also missing in prior to all the examples, which are conventionally (and gramatically) used when describing an example in the docs
A metric to measure the use of deprecated features in the code base
Motivation
We have a number of deprecated features.
As a user it will be hard to know if it is safe to upgrade beyond the point when the deprecated feature becomes removed.
In preparation for removing the features this metric can be monitored to ensure you're good to upgrade.
Modifications
There is a deliberate design decision to ensure the counting was simple. It would be worse for us to have a bug in the counting code which meant we didn't flag up a use when there was one. So each deprecated field is flagged at point of use by the code base.
This has problems:
There are two new modules:
context
This is a general purpose module for reading and writing object metadata into context which is the canonical way of passing data around. This avoids us having to expose too much information in the wrong places.
deprecation
This is a separate module with no imports except
context
above which can be called from anywhere without anything other than a context. The context does not need to contain the desired information.It holds an evil global variable specifying what to do when a deprecation is flagged. When this has been initialised by the controller to point to the metrics function which records deprecations we get the metric number going up. Otherwise it's silent.
If the namespace is available in
context
we report it. This will be the namespace of the running workflow or cronworkflow.Overall
This means this modifies a lot of code paths to pass context, but I consider this a reasonable thing that we should want in general anyway.
NOT Implemented here
The validator does not flag up deprecated features. It should so I've raised #13736
We could log these too, including
name
which might help in hunting down stragglers. (Some of these come from WorkflowTemplates, so it's not immediately going to point the finger).Verification
Unit tests have been added. e2e test for each deprecation added.