-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Provide more information about cause of deprecation log messages #26836
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
Comments
Currently the logging for deprecation happens "down low" in the call stack and is missing some of the context that would be required for this more detailed logging. As well as allowing admins to know which clients are using deprecated features that might break in the next software upgrade, it would be useful if admins could mark certain fields as deprecated in the mapping in order to understand which clients were making use of fields the administrator would be keen to remove in the next revision of an index. This is perhaps for another issue but would leverage the same "up high" logging of query/client context and their use of deprecated features. |
We should be careful about logging the request body here, for large requests (such as bulk) it could be very slow. |
Will add also here what I said in Elastic support case: |
we added
then the deprecation.json log would contain
WDYT? |
@pgomulka Wouldn't xopaqueid cause each deprecation log to be unique, negating the optimization we have to emit deprecations once for a given call site? This is particularly important in tight loop calls to deprecations, eg internally within scripting. Perhaps #46106 would better satisfy this problem as we could then store every unique deprecation, but have identifiers for each unique call site so the categories of deprecations can be found from the index. |
@rjernst yes - a key for deprecation logging caching is But I also agree that more information is needed in deprecation logs. Most notably query context or where the deprecation comes from in code (stacktrace?) In regards to identifiers per call site, this is something that would be useful in other areas in logging too. I spoke with @cachedout and it would help to for instance group logging when snapshotting so that it could help to measure how long this took. Markers would be handy for this, and for JSON logs they could be extracted to a separate field (they are part of the message now). |
If a method is called within a script that operates per document (eg script_score query), and that method is deprecated, we emit a deprecation warning. Currently that warning will be emited once, rather than per document/per request. With x-opaque-id, it turns it into a unique deprecation key per request, so the deprecation log can quickly be filled. The general idea of keeping track of the last N deprecations was to avoid a gigantic deprecation log. However, I think #46106 I mentioned before will generally solve this issue, although we still need to be careful in that case about only making one deprecation log entry for the request, rather than per document. |
@cbuescher do you think this is still an issue given we have x-opaque-id in deprecation logs? |
Shouldn't the But I think it would be beneficial to see these deprecation per request - helps identifying which app needs to be upgraded. |
You are right. I'm not sure exactly what I was thinking from my previous comment, but it must have been thinking the x-opaque-id would be different per document.
The key is what determines whether this happens. The deprecation logger keeps track of the key for the last N deprecations. So if we had a unique key per document, we would thrash that tracking, and emit every document. It shouldn't be happening here, though, as you pointed out. |
In that case I think we can safely close the issue. |
Currently, the deprecation log can be quite useful to spot features and queries that are deprecated and will be removed in a future major version, but especially with deprecated query syntax it can be hard to figure out the query what caused the warning to be triggered.
We also already add warning headers to the request, so clients will also be informed about the deprecation, but may choose to ignore this. For cluster administrators it can be hard to figure out where those queries come from.
For example, when you only see
in the log, this neither tells you about the query type that has changed (this is from 5.x where the
match
querytype
parameter has been deprecated in favour of thematch_phrase
andmatch_phrase_prefix
query. Here, improving the message would already help, but this still leaves the origin of the query unknown.This relates to #21772, but its not only important to add replacement information but also potential cues for the origin of the offending query or request.
The text was updated successfully, but these errors were encountered: