Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/278546
Change subject: Segment Navigation Timing data by continent ...................................................................... Segment Navigation Timing data by continent To project the impact of rolling out cache PoPs in more places around the world, we need to have continuously-updating performance metrics segmented by geographic region. So add another Navigation Timing metric hierarchy based on the continent, which we derive from the GeoIP country code. Bug: T128709 Change-Id: If12b79622645e1d09ceeb492a683b33eef4420c0 --- M modules/webperf/files/navtiming.py 1 file changed, 40 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/46/278546/1 diff --git a/modules/webperf/files/navtiming.py b/modules/webperf/files/navtiming.py index ce5798c..14378d3 100755 --- a/modules/webperf/files/navtiming.py +++ b/modules/webperf/files/navtiming.py @@ -17,6 +17,41 @@ handlers = {} +# Map of continent code => ISO 3166 country codes +# https://dev.maxmind.com/geoip/legacy/codes/country_continent/ +iso_3166_continent = { + 'AF': ['AO', 'BF', 'BI', 'BJ', 'BW', 'CD', 'CF', 'CG', 'CI', 'CM', 'CV', + 'DJ', 'DZ', 'EG', 'EH', 'ER', 'ET', 'GA', 'GH', 'GM', 'GN', 'GQ', + 'GW', 'KE', 'KM', 'LR', 'LS', 'LY', 'MA', 'MG', 'ML', 'MR', 'MU', + 'MW', 'MZ', 'NA', 'NE', 'NG', 'RE', 'RW', 'SC', 'SD', 'SH', 'SL', + 'SN', 'SO', 'ST', 'SZ', 'TD', 'TG', 'TN', 'TZ', 'UG', 'YT', 'ZA', + 'ZM', 'ZW'], + 'AS': ['AE', 'AF', 'AM', 'AP', 'AZ', 'BD', 'BH', 'BN', 'BT', 'CC', 'CN', + 'CX', 'CY', 'GE', 'HK', 'ID', 'IL', 'IN', 'IO', 'IQ', 'IR', 'JO', + 'JP', 'KG', 'KH', 'KP', 'KR', 'KW', 'KZ', 'LA', 'LB', 'LK', 'MM', + 'MN', 'MO', 'MV', 'MY', 'NP', 'OM', 'PH', 'PK', 'PS', 'QA', 'SA', + 'SG', 'SY', 'TH', 'TJ', 'TL', 'TM', 'TW', 'UZ', 'VN', 'YE'], + 'EU': ['AD', 'AL', 'AT', 'AX', 'BA', 'BE', 'BG', 'BY', 'CH', 'CZ', 'DE', + 'DK', 'EE', 'ES', 'EU', 'FI', 'FO', 'FR', 'FX', 'GB', 'GG', 'GI', + 'GR', 'HR', 'HU', 'IE', 'IM', 'IS', 'IT', 'JE', 'LI', 'LT', 'LU', + 'LV', 'MC', 'MD', 'ME', 'MK', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', + 'RS', 'RU', 'SE', 'SI', 'SJ', 'SK', 'SM', 'TR', 'UA', 'VA'], + 'NA': ['AG', 'AI', 'AN', 'AW', 'BB', 'BL', 'BM', 'BS', 'BZ', 'CA', 'CR', + 'CU', 'DM', 'DO', 'GD', 'GL', 'GP', 'GT', 'HN', 'HT', 'JM', 'KN', + 'KY', 'LC', 'MF', 'MQ', 'MS', 'MX', 'NI', 'PA', 'PM', 'PR', 'SV', + 'TC', 'TT', 'US', 'VC', 'VG', 'VI'], + 'OC': ['AS', 'AU', 'CK', 'FJ', 'FM', 'GU', 'KI', 'MH', 'MP', 'NC', 'NF', + 'NR', 'NU', 'NZ', 'PF', 'PG', 'PN', 'PW', 'SB', 'TK', 'TO', 'TV', + 'UM', 'VU', 'WF', 'WS'], + 'SA': ['AR', 'BO', 'BR', 'CL', 'CO', 'EC', 'FK', 'GF', 'GY', 'PE', 'PY', + 'SR', 'UY', 'VE'] +} + +iso_3166_countries = {} +for continent, countries in iso_3166_continent.items(): + for country in countries: + iso_3166_countries[country] = continent + def parse_ua(ua): """Return a tuple of browser_family and browser_major, or None. @@ -192,9 +227,7 @@ site = 'desktop' auth = 'anonymous' if event.get('isAnon') else 'authenticated' - # Currently unused: - # bits_cache = meta.get('recvFrom', '').split('.')[0] - # wiki = meta.get('wiki', '') + continent = iso_3166_countries.get(event.get('originCountry')) if 'sslNegotiation' in metrics: metrics = {'sslNegotiation': metrics['sslNegotiation']} @@ -215,6 +248,10 @@ if is_sane_experimental(value): dispatch_stat(prefix_experimental, metric, 'overall', value) + if continent is not None: + dispatch_stat(prefix, metric, value) + + if __name__ == '__main__': ap = argparse.ArgumentParser(description='NavigationTiming subscriber') ap.add_argument('endpoint', help='URI of EventLogging endpoint') -- To view, visit https://gerrit.wikimedia.org/r/278546 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If12b79622645e1d09ceeb492a683b33eef4420c0 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Ori.livneh <o...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits