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

[Core] Upgrade Assistant warns the global SO HTTP APIs are deprecated #197721

Closed
TinaHeiligers opened this issue Oct 24, 2024 · 16 comments · Fixed by #197936 or #198800
Closed

[Core] Upgrade Assistant warns the global SO HTTP APIs are deprecated #197721

TinaHeiligers opened this issue Oct 24, 2024 · 16 comments · Fixed by #197936 or #198800
Assignees
Labels
Feature:Upgrade Assistant Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v9.0.0

Comments

@TinaHeiligers
Copy link
Contributor

TinaHeiligers commented Oct 24, 2024

PR #196081 adds support for surfacing deprecated APIs in the upgrade assistant.

We should surface the deprecated global saved objects HTTP APIs in Upgrade Assistant as an early warning of removal at a later stage. To show these warnings, deprecated has to change from a boolean to an object.
The warning will complement how the deprecations are logged.

We expect to update alternative APIs as they become available.

Deprecated Saved objects APIs

/api/saved_objects/{type}/{id}
/api/saved_objects/resolve/{type}/{id}
/api/saved_objects/{type}/{id?}
/api/saved_objects/{type}/{id}
/api/saved_objects/_find
/api/saved_objects/{type}/{id}
/api/saved_objects/_bulk_get
/api/saved_objects/_bulk_create
/api/saved_objects/_bulk_resolve
/api/saved_objects/_bulk_update
/api/saved_objects/_bulk_delete
@TinaHeiligers TinaHeiligers added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Oct 24, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@TinaHeiligers TinaHeiligers self-assigned this Oct 26, 2024
@TinaHeiligers
Copy link
Contributor Author

I've had to add docLinks as a dependency for route registration and add a few new docLinks.

@TinaHeiligers
Copy link
Contributor Author

TinaHeiligers commented Oct 27, 2024

@Bamieh we might need to add deprecation types for APIs that will be removed or migrated in the future. ATM, the deprecation for SO APIs renders as "route xyz is removed".

From PR #197936:

Image

The response entry is:

{
            "apiId": "unversioned|get|/api/saved_objects/{type}/{id}",
            "title": "The \"GET /api/saved_objects/{type}/{id}\" route is removed",
            "level": "warning",
            "message": [
                "The API \"GET /api/saved_objects/{type}/{id}\" has been called 3 times. The last call was on Sunday, October 27, 2024 3:05 PM -07:00."
            ],
            "documentationUrl": "https://www.elastic.co/guide/en/kibana/master/saved-objects-api.html#saved-objects-api",
            "correctiveActions": {
                "manualSteps": [
                    "Identify the origin of these API calls.",
                    "This API no longer exists and no replacement is available. Delete any requests you have that use this API.",
                    "Check that you are no longer using the old API in any requests, and mark this issue as resolved. It will no longer appear in the Upgrade Assistant unless another call using this API is detected."
                ],
                "mark_as_resolved_api": {
                    "routePath": "/api/saved_objects/{type}/{id}",
                    "routeMethod": "get",
                    "apiTotalCalls": 3,
                    "totalMarkedAsResolved": 0,
                    "timestamp": "2024-10-27T22:28:26.688Z"
                }
            },
            "deprecationType": "api",
            "domainId": "core.api_deprecations"
        }

@Bamieh
Copy link
Member

Bamieh commented Oct 28, 2024

I dont think we'd need a new type it is just the copy text that might be misleading to developers. However I think for people attempting to upgrade I do agree with @florent-leborgne that using is removed might make more sense since it is talking about a future upgrade the user is upgrading towards that the API has already been removed in.

Happy to revisit the copy to chance it back again to will be removed but i dont think a new type is needed for this. its too neunced and confusing.

Here is some parts of the discussion that bubbled to github: #196081 (comment)

@florent-leborgne please feel free to jump in :)

@florent-leborgne
Copy link
Contributor

florent-leborgne commented Oct 28, 2024

@Bamieh @TinaHeiligers From what I understood in the initial conversation, there are 4 major cases:

  • Moved: In the target version, the API has moved to another API that users must use instead.
  • Removed: In the target version, the API no longer exists and has no replacement.
  • Deprecated: In the target version, the API is deprecated. It will be removed in a future version, later. It's not removed yet in the target version, just deprecated.
  • Version bump: In the target version, the API has a newer version that users should use instead.

So I think the question is not about the tense that we use but rather about making sure that we don't mix up the removed and deprecated cases. Please correct me if I'm wrong :)

@jloleysens
Copy link
Contributor

Looking at the linked comment:

In 8.16, this API is deprecated. It will be removed in a future version.

Perhaps this does point to something we are currently lacking... The way I see it we could:

  1. Create a new deprecation type type: deprecated that can only ever be of type warning to capture "removed at some future date"
  2. Change the type: removed copy based on severity. severity can be either warning or critical. If severity is critical we assume integrations will break once upgraded if severity is warning we assume that integrations should change, but don't need to right now, can soften then copy to "will be removed"

IMO (2) seems nicer than having a new deprecation type, but also invites us to do the same thing for other types based on severity. We would possibly have (3x2=)6 new copy entries. One for each type and based on severity. We should also document that in the severity setting. My q here is: is it safe to assume that we've covered all cases correctly with this revision based on severity? Could there be a warning severity for type: removed where the copy should just be "has been removed" instead of "will be removed"?

WDYT @Bamieh @TinaHeiligers @florent-leborgne ?

@Bamieh
Copy link
Member

Bamieh commented Oct 28, 2024

The relationship is not super direct between severity and will be or has been. I do understand your point that critical severity is critical because the API has been removed while the warning indicates that it is still there. However this will require developers to have intimate knowledge with the interface to do this distinction and it'll also require constant update to the route deprecation details for different versions. I dont think we'll have this level of adoption and care from developers.

I would go with the simplest mental model which is just changing the copy:

  1. Update the tense to will be removed since the deprecation will be removed in the future weather we know when or we dont.
  2. I am debating between adding a clarification message to the users about the critical and warning but i am leaning towards keeping it vague since it'll carry different meanings for different routes what warning/critical boils down to. For example it might be critical severity because this API is part of a critical process the user needs to follow for alerts even though there is no specific removal date on the horizon.

@jloleysens
Copy link
Contributor

The relationship is not super direct between severity and will be or has been

Yeah, I agree it's a bit fuzzy to me too so ++ to keeping it simple with changing the copy and not altering the API.

@jloleysens
Copy link
Contributor

@florent-leborgne if you agree, should we go ahead and change the copy for the removal case to future tense or does this compromise consistency too much?

@florent-leborgne
Copy link
Contributor

We can but I'm not sure if this really helps the customer know what they need do now (which is different if the removal happens in the target version or later in a future version).

If you change is removed to will be removed, we should also change the 2nd step accordingly by replacing This API no longer exists and no replacement is available. with This API will be removed and won't be replaced.

@TinaHeiligers
Copy link
Contributor Author

We can but I'm not sure if this really helps the customer know what they need do now (which is different if the removal happens in the target version or later in a future version).

I've been thinking through this more and keep landing with adding at least 1 type: "deprecated", with optional text that extends the copy: "This API is deprecated. (optional-text}"

@florent-leborgne
Copy link
Contributor

That is where I landed as well, if that is do-able I'll +1 on the idea

@TinaHeiligers
Copy link
Contributor Author

That is where I landed as well, if that is do-able I'll +1 on the idea

I'll only get back to this next week. I'm on serverless onCall until then

@Bamieh
Copy link
Member

Bamieh commented Oct 30, 2024

So to summarize if we add a deprecated generic deprecation type to the APIs:

  1. the removed type will be is removed indicating that it has been removed in a future version so you need to stop usting it now and resolve the issue (probably forcing severity: critical here makes sense as well)
  2. the deprecated type will show is deprecated which indicates that the API is deprecated, it might be removed or migrated, or got a version bump in the future. for now it is a warning that this will be changed but in your next upgrade the api will still work (severity: warning in most cases)

@TinaHeiligers
Copy link
Contributor Author

the deprecated type will show is deprecated which indicates that the API is deprecated, it might be removed or migrated, or got a version bump in the future

I'm hoping to apply this in #197936

@Bamieh Bamieh closed this as completed in 665cf98 Nov 6, 2024
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Nov 6, 2024
…tic#198800)

## Summary

- [x] Add `deprecate` Type to the API Deprecations reasons.
- [x] Add a `message` optional field that is surfaced in the UA
- [x] Add IDE documentation in the autocomplete for all deprecation
fields.
- [x] Updated README and example plugin for the `deprecate` type
- [x] Update copy for `deprecate`.

Closes elastic#197721

## Testing

Run kibana locally with the test example plugin that has deprecated
routes
```
yarn start --plugin-path=examples/routing_example --plugin-path=examples/developer_examples
```

The following comprehensive deprecated routes examples are registered
inside the folder:
`examples/routing_example/server/routes/deprecated_routes`

Run them in the dev console to trigger the deprecation condition so they
show up in the UA:

```
GET kbn:/api/routing_example/d/deprecated_route
```

<img width="628" alt="image"
src="https://github.com/user-attachments/assets/3c0e1829-9a07-49bd-94a3-398514f448e2">

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: florent-leborgne <[email protected]>
(cherry picked from commit 665cf98)
@TinaHeiligers
Copy link
Contributor Author

@Bamieh This issue was closed with #198800 but the Saved Objects APIs still need their deprecated field changed, which is what I'm doing in #197936.

@TinaHeiligers TinaHeiligers reopened this Nov 6, 2024
mgadewoll pushed a commit to mgadewoll/kibana that referenced this issue Nov 7, 2024
…tic#198800)

## Summary

- [x] Add `deprecate` Type to the API Deprecations reasons.
- [x] Add a `message` optional field that is surfaced in the UA
- [x] Add IDE documentation in the autocomplete for all deprecation
fields.
- [x] Updated README and example plugin for the `deprecate` type
- [x] Update copy for `deprecate`.


Closes elastic#197721

## Testing

Run kibana locally with the test example plugin that has deprecated
routes
```
yarn start --plugin-path=examples/routing_example --plugin-path=examples/developer_examples
```

The following comprehensive deprecated routes examples are registered
inside the folder:
`examples/routing_example/server/routes/deprecated_routes`

Run them in the dev console to trigger the deprecation condition so they
show up in the UA:

```
GET kbn:/api/routing_example/d/deprecated_route
```

<img width="628" alt="image"
src="https://github.com/user-attachments/assets/3c0e1829-9a07-49bd-94a3-398514f448e2">

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: florent-leborgne <[email protected]>
mbondyra pushed a commit to mbondyra/kibana that referenced this issue Nov 8, 2024
…197936)

fix elastic#197721.

The route deprecation field changed from a boolean to an object, where
the object contains information that is used in deprecation issues that
the Upgrade Assistant shows.

This PR makes the necessary changes in the deprecated Saved Objects HTTP
APIs.

This PR also includes a release notes entry for the API deprecations
that was missing.
![Screenshot 2024-10-29 at 12 01
29](https://github.com/user-attachments/assets/5c47c697-fbae-4b2e-8c6c-cd4701a667df)

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios


### How to test this:

- Pull PR, run es against a trial license and start kibana as usual.
- Make a curl request to Kibana to get the config saved object: 

```
curl --location 'localhost:5601/abc/api/saved_objects/config/9.0.0' \
--header 'Content-Type: application/json' \
--header 'Accept-Encoding: gzip, deflate, br' \
--header 'kbn-xsrf: kibana' \
--header 'Kbn-Version: 9.0.0' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ=='
```

- Navigate to Upgrade Assistant and observe Kibana has at least 1
deprecation warning.
- View Kibana's warnings, you should see a warning entry for `The "GET
/api/saved_objects/{type}/{id}" route is deprecated`

![Screenshot 2024-11-06 at 16 26
26](https://github.com/user-attachments/assets/3b6a5644-3e5e-403e-a0f6-015686675b9f)

- click on the deprecation and you should see more detail about the
deprecated API that's been used in the flyout:

![Screenshot 2024-11-06 at 16 26
44](https://github.com/user-attachments/assets/696aaf8f-fb6b-4c61-bc3c-b3745f85059a)

- resolve the deprecation warning
- Kibana should continue to issue requests to the deprecated SO HTTP
APIs because these APIs have not been removed yet.


### Risk Matrix

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| End user concern from the deprecation warning that says the routes
have been deprecated | Low | Low | The APIs have been deprecated since
8.7 and recommends using public APIs instead. |

### For maintainers

- [x] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this issue Nov 8, 2024
…197936)

fix elastic#197721.

The route deprecation field changed from a boolean to an object, where
the object contains information that is used in deprecation issues that
the Upgrade Assistant shows.

This PR makes the necessary changes in the deprecated Saved Objects HTTP
APIs.

This PR also includes a release notes entry for the API deprecations
that was missing.
![Screenshot 2024-10-29 at 12 01
29](https://github.com/user-attachments/assets/5c47c697-fbae-4b2e-8c6c-cd4701a667df)

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios


### How to test this:

- Pull PR, run es against a trial license and start kibana as usual.
- Make a curl request to Kibana to get the config saved object: 

```
curl --location 'localhost:5601/abc/api/saved_objects/config/9.0.0' \
--header 'Content-Type: application/json' \
--header 'Accept-Encoding: gzip, deflate, br' \
--header 'kbn-xsrf: kibana' \
--header 'Kbn-Version: 9.0.0' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ=='
```

- Navigate to Upgrade Assistant and observe Kibana has at least 1
deprecation warning.
- View Kibana's warnings, you should see a warning entry for `The "GET
/api/saved_objects/{type}/{id}" route is deprecated`

![Screenshot 2024-11-06 at 16 26
26](https://github.com/user-attachments/assets/3b6a5644-3e5e-403e-a0f6-015686675b9f)

- click on the deprecation and you should see more detail about the
deprecated API that's been used in the flyout:

![Screenshot 2024-11-06 at 16 26
44](https://github.com/user-attachments/assets/696aaf8f-fb6b-4c61-bc3c-b3745f85059a)

- resolve the deprecation warning
- Kibana should continue to issue requests to the deprecated SO HTTP
APIs because these APIs have not been removed yet.


### Risk Matrix

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| End user concern from the deprecation warning that says the routes
have been deprecated | Low | Low | The APIs have been deprecated since
8.7 and recommends using public APIs instead. |

### For maintainers

- [x] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
jloleysens pushed a commit to jloleysens/kibana that referenced this issue Nov 21, 2024
…197936)

fix elastic#197721.

The route deprecation field changed from a boolean to an object, where
the object contains information that is used in deprecation issues that
the Upgrade Assistant shows.

This PR makes the necessary changes in the deprecated Saved Objects HTTP
APIs.

This PR also includes a release notes entry for the API deprecations
that was missing.
![Screenshot 2024-10-29 at 12 01
29](https://github.com/user-attachments/assets/5c47c697-fbae-4b2e-8c6c-cd4701a667df)

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### How to test this:

- Pull PR, run es against a trial license and start kibana as usual.
- Make a curl request to Kibana to get the config saved object:

```
curl --location 'localhost:5601/abc/api/saved_objects/config/9.0.0' \
--header 'Content-Type: application/json' \
--header 'Accept-Encoding: gzip, deflate, br' \
--header 'kbn-xsrf: kibana' \
--header 'Kbn-Version: 9.0.0' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ=='
```

- Navigate to Upgrade Assistant and observe Kibana has at least 1
deprecation warning.
- View Kibana's warnings, you should see a warning entry for `The "GET
/api/saved_objects/{type}/{id}" route is deprecated`

![Screenshot 2024-11-06 at 16 26
26](https://github.com/user-attachments/assets/3b6a5644-3e5e-403e-a0f6-015686675b9f)

- click on the deprecation and you should see more detail about the
deprecated API that's been used in the flyout:

![Screenshot 2024-11-06 at 16 26
44](https://github.com/user-attachments/assets/696aaf8f-fb6b-4c61-bc3c-b3745f85059a)

- resolve the deprecation warning
- Kibana should continue to issue requests to the deprecated SO HTTP
APIs because these APIs have not been removed yet.

### Risk Matrix

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| End user concern from the deprecation warning that says the routes
have been deprecated | Low | Low | The APIs have been deprecated since
8.7 and recommends using public APIs instead. |

### For maintainers

- [x] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 0df2e98)

# Conflicts:
#	oas_docs/output/kibana.serverless.yaml
#	oas_docs/output/kibana.yaml
#	packages/core/deprecations/core-deprecations-server-internal/src/routes/post_validation_handler.ts
#	packages/core/http/core-http-server/index.ts
#	packages/core/http/core-http-server/src/router/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Upgrade Assistant Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v9.0.0
Projects
None yet
6 participants