Page MenuHomePhabricator

Enhance deprecated logging to be context aware
Closed, DeclinedPublic

Description

MediaWiki deprecation logs are a raw strings which make them hard to process. We could end them using the monolog context that would ease de-duplication and finding the worst offenders.

Summary of the current code

includes/debug/MWDebug.php 
    public static function deprecated( $function, $version = false,
        $component = false, $callerOffset = 2
    ) {

        if ( $version ) {
            $msg = "Use of $function was deprecated in $component $version.";
        } else {
            $msg = "Use of $function is deprecated.";
        }
        self::sendMessage(
            $msg,
            $callerDescription,
            'deprecated',
            $wgDevelopmentWarnings ? E_USER_DEPRECATED : false
        );
}

Ie all the useful context is (function name, component, version) is lost due to concatenation in a single string.

For the context, deprecation logging has been enabled on Wikimedia end of January via https://gerrit.wikimedia.org/r/334206 after we had FlaggedRevs explode (T156310) when a deprecated function got removed.

Event Timeline

hashar lowered the priority of this task from High to Medium.Mar 23 2017, 9:51 AM
hashar created this task.
Schnark removed a subscriber: Schnark.Mar 23 2017, 10:59 AM

Seems like a good use for logstash. Why aren't we using structured logging here already?

Krinkle added a subscriber: Krinkle.

Hm.. I'm not sure I understand the issue.

The messages do not contain insignificant variables like timestamp, or file path, or request information.

The messages are already grouped as much as they can be to be useful, e.g. All warnings for "Foo::bar is deprecated" are grouped together because they have the same exact message. The component/version portions do not vary, they are always the same for a given method, and do not cause fragmentation.

The only part we could normalize further is the method name itself, at which point all deprecation messages would have the same message and grouped together, which... is as useful as "there are issues somewhere with something" – I don' think that is what we want?

If we want to easily count how many deprecation warnings there are (for any class/extension, all total), we can already do that with the deprecated channel, because that channel only contains this message, nothing else.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:10 PM
Krinkle closed this task as Declined.Tue, Mar 24, 9:18 PM
Krinkle updated the task description. (Show Details)