BryanDavis has uploaded a new change for review.
https://gerrit.wikimedia.org/r/181349
Change subject: beta: honor log sampling for logstash
......................................................................
beta: honor log sampling for logstash
Use a MWLoggerMonologSamplingHandler to wrap the shared logstash handler
when the $wgDebugLogGroups for a given group specifies a sample factor.
Depends-On: Icd14fc8c44ca9eef0f3f5cc4f1d1d8b68d517f07
Bug: T85067
Change-Id: I05ab2c1c65c06ae5a22f1a60e364d0f3f3af41d3
---
M wmf-config/logging-labs.php
1 file changed, 20 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config
refs/changes/49/181349/1
diff --git a/wmf-config/logging-labs.php b/wmf-config/logging-labs.php
index 2667a1f..aeeda51 100644
--- a/wmf-config/logging-labs.php
+++ b/wmf-config/logging-labs.php
@@ -108,11 +108,30 @@
// Add logging channels defined in $wgDebugLogGroups
foreach ( $wgDebugLogGroups as $group => $dest ) {
+ $sample = false;
if ( is_array( $dest ) ) {
+ // NOTE: sampled logs are not guaranteed to store the same
events in
+ // logstash and via udp2log since the two event handlers
independently
+ // check the probability of emitting.
+ $sample = isset( $dest['sample'] ) ? $dest['sample'] : false;
$dest = $dest['destination'];
}
+ if ( $sample === false ) {
+ $handlers = array( $group, 'logstash' );
+ } else {
+ $wmgMonologConfig['handlers']["sampled-{$group}"] = array(
+ 'class' => 'MWLoggerMonologSamplingHandler',
+ 'args' => array(
+ function() {
+ return
MWLogger::getProvider()->getHandler( 'logstash' );
+ },
+ $sample,
+ ),
+ );
+ $handlers = array( $group, "sampled-{$group}" );
+ }
$wmgMonologConfig['loggers'][$group] = array(
- 'handlers' => array( $group, 'logstash' ),
+ 'handlers' => $handlers,
'processors' => array( 'wiki', 'psr', 'pid', 'uid', 'web' ),
);
$wmgMonologConfig['handlers'][$group] = array(
--
To view, visit https://gerrit.wikimedia.org/r/181349
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I05ab2c1c65c06ae5a22f1a60e364d0f3f3af41d3
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits