From 0e3f7c44b296f98c7bf5e44008f922701a494a28 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Tue, 9 Aug 2022 17:39:53 -0400 Subject: [PATCH] inEventSample: Avoid invalid character warning from sampling code, hash into hex Bug: T314896 Change-Id: I377bbe54686fdb9d765543320aef14a99ee2cd7f --- includes/Hooks.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/Hooks.php b/includes/Hooks.php index dc30311f..09a2ac27 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -97,8 +97,12 @@ class Hooks implements // Sample 6.25% $samplingRate = $this->config->has( 'WMESchemaEditAttemptStepSamplingRate' ) ? $this->config->get( 'WMESchemaEditAttemptStepSamplingRate' ) : 0.0625; + + // (T314896) Convert whatever we've been given to a string of hex, as that's what EL needs + $hexValue = hash( 'md5', $sessionId, false ); + $inSample = EventLogging::sessionInSample( - (int)( 1 / $samplingRate ), $sessionId + (int)( 1 / $samplingRate ), $hexValue ); return $inSample; }