| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
In MediaWiki/Exception, to follow PSR-4 per plural vs. singular (this can be
changed later if people really care). Also, move the couple of exceptions in
here that were already namespaced in the MW-top-level into the new space.
Bug: T353458
Change-Id: I12ed850ae99effb699a6d7ada173f54e72f0570e
|
|
|
|
|
| |
Bug: T353458
Change-Id: I95690a312e356c45dbeed607d32fb0e4626690cf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Same as Ia294bf4 did for 1-line comments. This patch removes slightly
more complex 2-line PHPDoc comments that don't add any new information
to the code, but literally repeat what the code already says.
They say "don't document the code, code the documentation", and we
are doing this more and more. We just tend to forget to remove the
obsolete comments.
Note I'm also removing a line of text in a few cases when it's very
short and literally says the same as the method name. Again, such
comments add zero new information.
Change-Id: I01535404bab458c6c47e48e5456403b7a64198ed
|
|
|
|
|
| |
Bug: T340552
Change-Id: I18ffd0e36efbabe82313de685ca8c6c99341c6f3
|
|
|
|
|
|
|
|
|
|
|
|
| |
This centralizes the action of emitting stats to a single
static function to be used by web and maintenance jobs alike.
* Rename emitBufferedStatsdData to emitBufferedStats
* Move StatsFactory->flush() call into emitBufferedStats
* Update call signature where used
Bug: T380609
Change-Id: I63e8832a170bfaa0e14e977f0852c4ef49f232bb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Why:
- Now that we have a basic OpenTelemetry library available in MediaWiki,
we would like to start instrumenting code and propagating the trace
context.
What:
- Start a root span in early setup code once the service container is
available, so that subsequent setup logic (e.g. session
initialization) can already be instrumented.
- End the root span in restInPeace() after the main transaction round
ended, so that the normal LBFactory shutdown process can be instrumented.
- Have TracerSharedState hold the root span throughout.
Bug: T340552
Change-Id: I0785204a6989787a492a08b78c40c6df91106f23
|
|
|
|
|
| |
Bug: T353458
Change-Id: If0137003ab625017d322d57870448a02569668c3
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Do not try to add any extra headers in
MediaWikiEntryPoint::outputResponsePayload() when headers have
already been sent, it would just result in outputting a warning
and messing up the response body.
This can happen when output is managed manually
(OutputPage::disable() has been called), for example in the
CentralAuth extension SpecialCentralAutoLogin::doFinalOutput()
would otherwise break because it will output JS without any output
buffering, and then outputResponsePayload() would try to send a
header.
Bug: T364116
Change-Id: Id55b76274393dec21ab1d26aff0c1e8a63c5b28d
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
== Motivation ==
* Reduce amount of configuration switches relating to MW Stats component,
to reduce noise for MW sysadmins and devs.
* Reduce amount of code in the legacy Statsd implementation.
== Background ==
* commit e56f7b6c63 (2015, MW 1.26): Add statsd sampling.
Refers to T106457 under T106450 ("hook usage counts"), which used it
in https://gerrit.wikimedia.org/r/226640 which was reverted shortly
after in https://gerrit.wikimedia.org/r/233045 due to too high
overhead of stats code for something as hot as hooks, regardless
of actual sampling/stats sending.
* commit b203ec5fcd (2016, MW 1.29): Make statsd sampling configurable.
Use case unknown, but it is not used today in wmf-config, and
appears to have never been set in the past either:
```
operations-mediawiki-config (master)
$ git log -p wmf-config/ | grep wgStatsdSamplingRates
24s ec=1$
```
Looking for unmerged patches, I do find an abandoned patch for
the Wikibase extension that attempted to use to instrument database
load in 2020. It was abandoned in favour of dedicated DB tooling
to inspect database queries, which offer more detail as well.
https://gerrit.wikimedia.org/r/q/message:wgStatsdSamplingRates
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/593335
== Future ==
In 10 years, we've not needed sampling anywhere even at our scale.
StatsD absorbs high traffic very well, with controlled flushing to
Graphite as backend. Prometheus exporters are similarly buffered
close to the producer with controlled scraping intervals. This
should make sampling unlikely to be needed.
We did have one experiment where sampling was attempted, which led
to the developments this commit removes. That instrumentation was
removed because the code was far too frequently called and hot that
it posed a latency problem, even before we factor in whether it
sends the metric. The overhead of the stats code itself added too
much overhead to Hook::run / HookContainer.
The new StatsFactory service class does feature per-metric sampling,
although this is similarly without use case at the moment:
https://codesearch.wmcloud.org/search/?q=%3EsetSampleRate&excludeFiles=test
New instrumentations should use StatsFactory, and if sampling were
needed in the future, it could be experimented by calling setSampleRate
on Metric objects (as part of the instrumentation, rather than in
site config, unless the feature in question makes it configurable).
That seems enough upfront investment for a theoretical future need.
Change-Id: I5f68e48d6d2c880a43f83915234d3c9f32a2d1ef
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a template is created, and then used on a page, and then the template
is updated, all within an hour, then the page_touched of the page is
never updated and the user will always see the old template contents.
This is because htmlCacheUpdate jobs are fully suppressed for one hour
following template creation, due to the WAN backlink partition cache.
So:
* Revert 4f3efbf4065a9, so that htmlCacheUpdate jobs always do
something regardless of the state of the partition cache.
* Factor out the job queueing parts of WikiPage::onArticleCreate,
::onArticleDelete and ::onArticleEdit. Instead of queueing a job
unconditionally, check for the existence of backlinks in a post-send
deferred update. If there are none, don't queue the job.
* It's convenient to use BacklinkCache::hasLinks(), however, it suffered
from the same stale cache problem as BacklinkCache::partition(). It's
a short and fast query, and code review shows that none of the callers
are particularly performance sensitive. So, do not use the WAN cache
in BacklinkCache::hasLinks().
* Since hasLinks() and getNumLinks() no longer share a significant
amount of code, separate them. Remove the $max parameter from
getNumLinks(), which only existed to support hasLinks() and has no
other usages in codesearch.
* Log a debug message when entering the post-send request stage, so that
it's easier to confirm that no additional pre-send queries are done.
* Add a regression test, confirmed to previously fail.
Bug: T368006
Change-Id: Id5c7af6d4fcdbeb6724a9036133742c5f76624df
|
|
|
|
|
|
|
|
|
| |
The idea is that all entry points should share the code in the
MediaWikiEntryPoint base class. This change just moves code from
the file scope into a class, without any structural changes.
Bug: T354216
Change-Id: Ie2e827d30a070bcc63bdce56891c3aa0a4dacddd
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This moves a code out of file scope into classes to make it
testable. The code is left in the same structure as it was before,
global functions have been converted into methods on the new
ThumbnailEntryPoint and Thumbnail404EntryPoint classes.
This test introduces comprehensive phpunit tests covering all functional
code paths in ThumbnailEntryPoint. This is intended to support
refactoring of this code.
Change-Id: I459abc7b11d0ab4ee682a863c9525a945048296f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follows-up Iadea44b7867f48a2be6ccbf00c0e56911a5af74e.
ResourceLoaderEntryPoint:
* Rename from Resource to ResourceLoader, as it is the entry point
for ResourceLoader.
* Fix accidental use of ingroup on the file docblock
instead of the class.
https://phabricator.wikimedia.org/F42046908
* Fix broken "see" reference to "/load.php" on the ResourceEntryPoint
class on doc.wikimedia.org. Files are indexed in Doxygen by full
name without leading slash.
* Remove load.php from docgroup, akin to index.php.
tests:
* Remove unrelated Rest namespace from test suite.
* Remove redundant default values in newResourceLoader(),
especially null values were confusing by showing an
apparent intent to set a value without actually
isplacing the default, given that isset/?? treat
set null as not set.
* Simplify test by using the built-in startup module instead.
EntryPoint:
* Remove comment in test about doPostOutputShutdown.
It sounded like it was explaining that we use getCapturedOutput()
instead of run() because the latter calls doPostOutputShutdown
which we want to avoid. Except, we don't avoid it,
since run() is called and does call doPostOutputShutdown.
Unclear what it was explaining.
* Improve docs around getCapturedOutput() in the base class,
and make explicit that this seemingly unused complexity
exists for the purpose of testing.
Bug: T354216
Change-Id: I5139fda90a3d5ac7ea1ed917c8045d1a09961d78
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This improves handling of edge cases around flushing buffers:
- Distingush clearly between "headers sent" and "all output sent"
states.
- Warn when trying to flush output after output was already sent to the
client.
- Avoid looping indefinitely when failing to delete a buffer, to work
around a quirk of PHP's zlib.compression buffer.
Follow-up: I4ea116d60030da92be14f0283ce4dc4877c4ca13
Bug: T356578
Change-Id: Iaf34a48b89e969b8e26328f0d2512ad22ef48212
|
|/
|
|
|
| |
Bug: T353458
Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
|
|
|
|
|
|
|
|
|
|
| |
This is not the method that actually flushes the output buffer
under normal circumstances (that's done in execute(), within
e.g. MediaWikiEntryPoint::outputResponsePayload() or
ResourceLoader::respond()). Also fix a misleading phpdoc.
Bug: T356578
Change-Id: I4ea116d60030da92be14f0283ce4dc4877c4ca13
|
|
|
|
|
|
|
|
| |
The idea is that all entry points should share the code in the
MediaWikiEntryPoint base class. This change by itself doesn't achieve much, it should be followed up by a change moving request handling logic from ResourceLoader into ResourceEntryPoint.
Bug: T354216
Change-Id: Iadea44b7867f48a2be6ccbf00c0e56911a5af74e
|
|
|
|
|
|
|
|
|
|
|
|
| |
1) Introduce EntryPointEnvironment which wraps functions that interact
with the PHP runtime, so they can be mocked for testing.
2) Allow server info fields to be overwritten in FauxRequest.
3) Make MediaWikiEntryPoint use WebResponse to set headers
Bug: T354216
Change-Id: Ic21950c956de5d2b5a7dd66a1e2de58f807cfd9f
|
|
|
|
|
|
|
|
|
|
|
| |
In order for sub-classes to benefit from this abstract class,
inject the services container to lazily get all service dependencies
needed within calling code.
Define protected getters that can be overriden or called directly
to get the service needed.
Change-Id: I23a60907805dfb8fb7ce8160df63ababefcd62c3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Records the number of samples of all metrics in the buffered statslib
cache. Necessitates adding getSampleCount() to BaseMetric and wiring
access through each metric type.
Moved StatsFactory->flush() to execute before
emitBufferedStatsdData(). This is so the metric generated by
copyToStatsdAt() is sent with the rest of the statsd metrics.
Updated tests.
This metric will be used to track the migration progress towards
statslib.
Bug: T350638
Change-Id: I070f3e30a9b8cd0b0ab44f345207e6f25e602fbb
|
|
|
|
|
|
|
|
|
|
| |
Sends the number of samples in the buffered statsd data to graphite.
This metric will be used to track the migration progress towards
statslib.
Bug: T350638
Change-Id: I12c42c51bd0488777474057c6c485743aa916ca8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follows-up Ib70e4e67e4cb1.
* This removed index.php from the "entrypoint"
group, but did not add MediaWikiEntryPoint in its stead.
* Fix broken `@see` reference, leading slash is not part of the
identifier for the `@file` block index.php, only works without it.
* Move the defgroup to a more natural place in the parent class' file.
Bug: T354216
Change-Id: I1281e0934368884f4d1ffbbd3f5588b9a211356f
|
|
This extracts the MediaWikiEntryPoint base class and ActionEntryPoint
class from the MediaWiki class. MediaWiki itself be deprecated.
The intent is to create other subclasses of MediaWikiEntryPoint for the
use by other entry points such as thumb.php or api.php. This will allow
us to share code between entry points, and make these entry points
testable by moving their implementation into a class.
Bug: T354216
Change-Id: Ib70e4e67e4cb1b65ac218c095864fb6eb43d0929
|