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

[HTTP] Log deprecated API usages #199616

Closed
jloleysens opened this issue Nov 11, 2024 · 1 comment · Fixed by #207904
Closed

[HTTP] Log deprecated API usages #199616

jloleysens opened this issue Nov 11, 2024 · 1 comment · Fixed by #207904
Assignees
Labels
Feature:http Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v9.0.0

Comments

@jloleysens
Copy link
Contributor

jloleysens commented Nov 11, 2024

Since we now track deprecated Kibana API usage (#196081) we should also create a (debug) log to help track down origins of requests.

We should have Kibana configuration for turning on this logging in a way that does not flood log output with all HTTP req/res traffic and instead only surfaces deprecations - similar to what we do when detecting deprecated ES API requests from Kibana (code).

We should be able to use existing debug logging logic for these new debug logs.

Additionally, API integrations should be able to send a user-provided value that we can surface when this logging is activated to provide the best experience for tracking down origins of deprecated usage.

Part of implementation: we should also surface this in public docs.

Open questions:

  • Do we want to ask users to send a x-opaque-id (similar to ES) to provide the "user input" for the log?

Potential place to add the logger:

void client.incrementDeprecatedApi(counterName, { resolved: false });

We also want to keep the logger disabled until a specific setting is enabled (http.log_deprecations: true).

@jloleysens jloleysens added Feature:http Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc labels Nov 11, 2024
@elasticmachine
Copy link
Contributor

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

@jesuswr jesuswr self-assigned this Jan 15, 2025
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Jan 28, 2025
## Summary

Resolves elastic#199616

Added a debug logger when calling deprecated APIs. This logger is
disabled by default, to enable it you have to set
`deprecation.enable_http_debug_logs: true`.

To test this you can play with the config value and do a request like
this to a deprecated endpoint:

```shell
#!/bin/bash
API_KEY=""
curl -X GET "http://localhost:5601/api/cases/status" -i \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey $API_KEY"
```

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [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
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: florent-leborgne <florent.leborgne@elastic.co>
Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com>
(cherry picked from commit 23b7f0f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:http Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v9.0.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants