wiki.techinc.nl/includes/utils
Erik Bernhardson f66559b616 Produce monolog messages through kafka+avro
This allows a logging channel to be configured to write
directly to kafka. Logs can be serialized either to json
blobs or the more compact apache avro format.

The Kafka handler for monolog needs a list of one of more
kafka servers to query cluster metadata from. This should be
able to use any monolog formatter, although some like
JsonFormatter require you to disable formatBatch as Kafka
protocol would prefer to encode each record independently in
the protocol.  This requires the nmred/kafka-php library,
version >= 1.3.0.

Adds a new formatter which serializes to the apache avro
format. This is a compact binary format which uses pre-
defined schemas. This initial implementation is very simple
and takes the plain schemas as a constructor argument.

Adds a new option to MonologSpi to wrap handlers in a
BufferHandler. This doesn't flush until the request shuts
down and prevents any network requests in the logger from
adding latency to web requests.

Related mediawiki/vendor update: Ibfe4bd2036ae8e998e2973f07bd9a6f057691578

The necessary config is something like:

array(
    'loggers' => array(
        'CirrusSearchRequests' => array(
            'handlers' => array( 'kafka' ),
        ),
    ),
    'handlers' => array(
        'kafka' => array(
            'factory' => '\\MediaWiki\\Logger\\Monolog\\KafkaHandler::factory',
            'args' => array( 'localhost:9092' ),
            'formatter' => 'avro',
            'buffer' => true,
        ),
    ),
    'formatters' => array(
        'avro' => array(
            'class' => '\\MediaWiki\\Logger\\Monolog\\AvroFormatter',
            'args' => array(
                array(
                    'CirrusSearchRequests' => array(
                        'type' => 'record',
                        'name' => 'CirrusSearchRequests'
                        'fields' => array( ... )
                    ),
                ),
            ),
        ),
    ),
)

Bug: T106256
Change-Id: I6ee744b3e5306af0bed70811b558a543eed22840
2015-09-21 12:45:23 -07:00
..
iterators Remove return of void method results 2015-09-10 18:45:22 +00:00
AutoloadGenerator.php Also support skin.json for updating JSON AutoloadClasses 2015-06-25 01:05:16 -04:00
AvroValidator.php Produce monolog messages through kafka+avro 2015-09-21 12:45:23 -07:00
BatchRowIterator.php Import BatchRowUpdate classes from Echo 2015-08-13 21:28:13 -04:00
BatchRowUpdate.php Import BatchRowUpdate classes from Echo 2015-08-13 21:28:13 -04:00
BatchRowWriter.php Fix some space-related phpcs warnings in includes/ 2015-08-15 08:56:03 +00:00
IP.php Replace bundled IPSet library with composer dependency 2015-08-26 10:38:09 -07:00
MWCryptHKDF.php objectcache: Use newAccelerator() fallback instead of try/catch 2015-08-25 01:03:10 +02:00
MWCryptRand.php Use mediawiki/at-ease library for suppressing warnings 2015-06-11 18:49:29 +00:00
README
RowUpdateGenerator.php Import BatchRowUpdate classes from Echo 2015-08-13 21:28:13 -04:00
UIDGenerator.php objectcache: Make first parameter of newAccelerator optional 2015-08-24 23:43:19 +02:00
ZipDirectoryReader.php

The classes in this directory are general utilities for use by any part of
MediaWiki. They do not favour any particular user interface and are not
constrained to serve any particular feature. This is similar to includes/libs,
except that some dependency on the MediaWiki framework (such as the use of
MWException, Status or wfDebug()) disqualifies them from use outside of
MediaWiki without modification.

Utilities should not use global configuration variables, rather they should rely
on the caller to configure their behaviour.