id int64 0 1.29M | original_id stringlengths 32 32 | swhid stringlengths 100 170 | sha1 stringlengths 40 40 | repo_name stringlengths 2 45 | repo_group stringclasses 12
values | filepath stringlengths 5 153 | name stringlengths 1 14.9k | type stringclasses 3
values | code stringlengths 7 2.12M |
|---|---|---|---|---|---|---|---|---|---|
1,700 | 9d67aa8c76d7b127b6aa4a17ce07cec9 | swh:1:cnt:94bc46b19279456c4e3b6bf238a9a60a3ff3083f;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=16-33/ | 2ff6841045d0227ebfa9e3d2171570d2bf050e3e | eventgate | analytics | routes/events.js | requireRelative | function | /**
* Given module path m, this will attempt to require it
* with the extra paths at the end of module.paths.
* module.paths will be unmodified when this function returns.
*
* @param {string} m
* @param {Array<string>} paths list of extra paths to search for module.
* @return {any}
*/
function requireRelative(m... |
1,701 | 74e9f5338cd4b010f57f10441011cf24 | swh:1:cnt:94bc46b19279456c4e3b6bf238a9a60a3ff3083f;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=35-145/ | 2ff6841045d0227ebfa9e3d2171570d2bf050e3e | eventgate | analytics | routes/events.js | handleEvents | function | /**
* Handles incoming JSON events in req.body with the EventGate instance.
*
* @param {EventGate} eventGate
* @param {Object} conf config object to provide in eventGate.process context.
* @param {http.ClientRequest} req
* @param {http.ServerResponse} res
*/
async function handleEvents(eventGate, conf, req, res)... |
1,702 | d081dcb6833677acf0b0b28fe7ec3e17 | swh:1:cnt:345f410b15820ca1d52945bcfaa401e245e941a4;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=14-47/ | 64e2fbcfcacea1670108189655728bd650a04d75 | eventgate | analytics | test/features/app/spec.js | validateExamples | function | function validateExamples(pathStr, defParams, mSpec) {
const uri = new URI(pathStr, {}, true);
if (!mSpec) {
try {
uri.expand(defParams);
return true;
} catch (e) {
throw new Error(`Missing parameter for route ${pathStr} : ${e.message}`);
}
}
if (!Array.isArray(mSpec)) {
throw new Error(`Route $... |
1,703 | 389354c26b00eade0a0d2aad22e7f722 | swh:1:cnt:345f410b15820ca1d52945bcfaa401e245e941a4;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=111-165/ | 64e2fbcfcacea1670108189655728bd650a04d75 | eventgate | analytics | test/features/app/spec.js | cmp | function | function cmp(result, expected, errMsg) {
if (expected === null || expected === undefined) {
// nothing to expect, so we can return
return true;
}
if (result === null || result === undefined) {
result = '';
}
if (expected.constructor === Object) {
Object.keys(expected).forEach((key) => {
const val = ex... |
1,704 | 99c03ced44187ce27d707a918f9283da | swh:1:cnt:345f410b15820ca1d52945bcfaa401e245e941a4;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=69-109/ | 64e2fbcfcacea1670108189655728bd650a04d75 | eventgate | analytics | test/features/app/spec.js | constructTests | function | function constructTests(spec) {
const ret = [];
const paths = spec.paths;
const defParams = spec['x-default-params'] || {};
Object.keys(paths).forEach((pathStr) => {
Object.keys(paths[pathStr]).forEach((method) => {
const p = paths[pathStr][method];
if ({}.hasOwnProperty.call(p, 'x-monitor') && !p['x-monit... |
1,705 | cd1fba72417a43ed878e673026d45e1d | swh:1:cnt:345f410b15820ca1d52945bcfaa401e245e941a4;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=167-192/ | 64e2fbcfcacea1670108189655728bd650a04d75 | eventgate | analytics | test/features/app/spec.js | validateArray | function | function validateArray(val, resVal, key) {
assert.deepEqual(Array.isArray(resVal), true, `Body field ${key} is not an array!`);
let arrVal;
if (val.length === 1) {
// special case: we have specified only one item in the expected body,
// but what we really want is to check all of the returned items so
// fill ... |
1,706 | c239619be73fddcd8a8713ab480a2cb6 | swh:1:cnt:345f410b15820ca1d52945bcfaa401e245e941a4;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=49-67/ | 64e2fbcfcacea1670108189655728bd650a04d75 | eventgate | analytics | test/features/app/spec.js | constructTestCase | function | function constructTestCase(title, path, method, request, response) {
return {
title,
request: {
uri: (baseUrl || server.config.uri) + (path[0] === '/' ? path.slice(1) : path),
method,
headers: request.headers || {},
query: request.query,
body: request.body,
followRedirect: false
},
response: ... |
1,707 | acd32f336044066a0a8ae8baa1efbc18 | swh:1:cnt:345f410b15820ca1d52945bcfaa401e245e941a4;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=194-227/ | 64e2fbcfcacea1670108189655728bd650a04d75 | eventgate | analytics | test/features/app/spec.js | validateBody | function | function validateBody(resBody, expBody) {
if (!expBody) { return true; } // eslint-disable-line
if (!resBody) { return false; } // eslint-disable-line
if (Buffer.isBuffer(resBody)) {
resBody = resBody.toString();
}
if (expBody.constructor !== resBody.constructor) {
if (expBody.constructor === String) {
... |
1,708 | 5ecde22e05cccea3ba674ca77a79dd4f | swh:1:cnt:345f410b15820ca1d52945bcfaa401e245e941a4;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=229-249/ | 64e2fbcfcacea1670108189655728bd650a04d75 | eventgate | analytics | test/features/app/spec.js | validateTestResponse | function | /**
*
* @param {Object} testCase
* @param {Response} res
* @return {Promise<void>}
*/
async function validateTestResponse(testCase, res) {
const expRes = testCase.response;
assert.deepEqual(res.status, expRes.status);
if (expRes.headers && !res.headers) {return false; } // eslint-disable-line
Ob... |
1,709 | 10870bfe9b1541592b6681ba698f9b31 | swh:1:cnt:834220c16fa34da5af29729d6ab798195e8c24f8;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=21-33/ | cf518bbd2ab01632180998c4c2951a9af7d2b86f | eventgate | analytics | test/features/info/info.js | checkRet | function | // common function used for generating requests
// and checking their return values
async function checkRet(fieldName) {
const res = await fetch(infoUri + fieldName);
// check the returned Content-Type header
assert.contentType(res, 'application/json');
const body = await res.jso... |
1,710 | 284e7d423b316bbc00197b86188ee188 | swh:1:cnt:0f7d1c9e799c563febea3d4bc4eadd33102eb80d;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=138-154/ | 5e81628d2adf7ff98bd00fc7ea5e433f4fb2feaf | eventgate | analytics | test/features/lib/eventgate.js | assertErrorEventsProduced | function | /**
* Asserts that count events have been pushed into producedErrorEvents within
* timeout milliseconds.
* @param {integer} count
* @param {integer} timeout
*/
function assertErrorEventsProduced(count, timeout = 100) {
// Wait a bit and assert that error events were produced.
... |
1,711 | 4df2757fe06f162ca78177987078b7f2 | swh:1:cnt:3171db3a01d1e4f3cb52569927d3ed0532e1fe21;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=99-101/ | 9ee0a5d8680c2f3c7be6d43f9beddf2c7ada2e8f | eventgate | analytics | test/features/lib/EventValidator.js | extractSchemaUri | function | function extractSchemaUri(event) {
return event.$schema;
} |
1,712 | 623a671de49ade696db1e0e6742d67bb | swh:1:cnt:3171db3a01d1e4f3cb52569927d3ed0532e1fe21;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=108-113/ | 9ee0a5d8680c2f3c7be6d43f9beddf2c7ada2e8f | eventgate | analytics | test/features/lib/EventValidator.js | loadTestSchema | function | /**
* Returns a Promise of the loaded test schema. Used in tests.
*/
function loadTestSchema() {
return urlGetObject(resolveUri(schemaUri, baseSchemaUri));
} |
1,713 | 3564afd632098e80b70c6c36614127b0 | swh:1:cnt:3171db3a01d1e4f3cb52569927d3ed0532e1fe21;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=103-106/ | 9ee0a5d8680c2f3c7be6d43f9beddf2c7ada2e8f | eventgate | analytics | test/features/lib/EventValidator.js | getSchema | function | function getSchema(uri) {
const url = resolveUri(uri, baseSchemaUri);
return urlGetObject(url);
} |
1,714 | 72fda531752d35466eeab19b53b38baa | swh:1:cnt:06e98789002e1009b882244dbfb152c11915e8e3;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=7-17/ | 02b8788c793204e22917f89fb1abde90303736e9 | eventgate | analytics | test/utils/assert.js | deepEqual | function | function deepEqual(result, expected, message) {
try {
assert.deepEqual(result, expected, message);
} catch (e) {
console.log(`Expected:\n${JSON.stringify(expected, null, 2)}`);
console.log(`Result:\n${JSON.stringify(result, null, 2)}`);
throw e;
}
} |
1,715 | e44bb3ed0fa8f2dfe3db67705916caed | swh:1:cnt:06e98789002e1009b882244dbfb152c11915e8e3;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=19-29/ | 02b8788c793204e22917f89fb1abde90303736e9 | eventgate | analytics | test/utils/assert.js | status | function | /**
* Asserts whether the return status was as expected
* @param {Object} res
* @param {integer} expected
*/
function status(res, expected) {
deepEqual(res.status, expected,
`Expected status to be ${expected}, but was ${res.status}`);
} |
1,716 | f9e875a69bf604668d82f97b6775b33e | swh:1:cnt:06e98789002e1009b882244dbfb152c11915e8e3;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=31-43/ | 02b8788c793204e22917f89fb1abde90303736e9 | eventgate | analytics | test/utils/assert.js | contentType | function | /**
* Asserts whether content type was as expected
* @param {Object} res
* @param {string} expectedRegexString
*/
function contentType(res, expectedRegexString) {
// preq and fetch compatible
const actual = res.headers['content-type'] ?? res.headers.get('content-type');
assert.ok(RegExp(expectedRegexSt... |
1,717 | b2d654682be8044a7d0d426b262cc996 | swh:1:cnt:06e98789002e1009b882244dbfb152c11915e8e3;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=56-66/ | 02b8788c793204e22917f89fb1abde90303736e9 | eventgate | analytics | test/utils/assert.js | notDeepEqual | function | function notDeepEqual(result, expected, message) {
try {
assert.notDeepEqual(result, expected, message);
} catch (e) {
console.log(`Not expected:\n${JSON.stringify(expected, null, 2)}`);
console.log(`Result:\n${JSON.stringify(result, null, 2)}`);
throw e;
}
} |
1,718 | fc8e269872bfe3c2e1d0c318067b2c3f | swh:1:cnt:06e98789002e1009b882244dbfb152c11915e8e3;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=45-54/ | 02b8788c793204e22917f89fb1abde90303736e9 | eventgate | analytics | test/utils/assert.js | isDeepEqual | function | function isDeepEqual(result, expected, message) {
try {
assert.deepEqual(result, expected, message);
return true;
} catch (e) {
return false;
}
} |
1,719 | 58764b3b5aec14d949ab374b400e5355 | swh:1:cnt:06e98789002e1009b882244dbfb152c11915e8e3;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=68-85/ | 02b8788c793204e22917f89fb1abde90303736e9 | eventgate | analytics | test/utils/assert.js | fails | function | function fails(promise, onRejected) {
let failed = false;
function trackFailure(e) {
failed = true;
return onRejected(e);
}
function check() {
if (!failed) {
throw new Error('expected error was not thrown');
}
}
return promise.catch(trackFailure).t... |
1,720 | a98eab98144941477f1ed20d61ff248a | swh:1:cnt:06e98789002e1009b882244dbfb152c11915e8e3;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=72-75/ | 02b8788c793204e22917f89fb1abde90303736e9 | eventgate | analytics | test/utils/assert.js | fails::trackFailure | function | function trackFailure(e) {
failed = true;
return onRejected(e);
} |
1,721 | 4db3aba94341c55d7ffd005617269ebb | swh:1:cnt:06e98789002e1009b882244dbfb152c11915e8e3;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=77-81/ | 02b8788c793204e22917f89fb1abde90303736e9 | eventgate | analytics | test/utils/assert.js | fails::check | function | function check() {
if (!failed) {
throw new Error('expected error was not thrown');
}
} |
1,722 | 338f3d2d634290577ec7d8b70fb4dd3f | swh:1:cnt:b08f606f373487decb166c86b8bac6c7d5275d92;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=13-14/ | 2fbc0bf25bd6c47be3e57163382168a07f145b41 | eventgate | analytics | test/utils/eventgate_test_factory.js | MockErrorEventProducableError | type | // Errors of this type should be produced as error events.
class MockErrorEventProducableError extends Error {} |
1,723 | 75f630c140f2498041885d29d7291a20 | swh:1:cnt:b08f606f373487decb166c86b8bac6c7d5275d92;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=16-17/ | 2fbc0bf25bd6c47be3e57163382168a07f145b41 | eventgate | analytics | test/utils/eventgate_test_factory.js | MockErrorEventUnproducableError | type | // Errors of this type should NOT be produced as error events.
class MockErrorEventUnproducableError extends Error {} |
1,724 | 7b547c3a004688836eb261e10b72d80f | swh:1:cnt:b08f606f373487decb166c86b8bac6c7d5275d92;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=19-68/ | 2fbc0bf25bd6c47be3e57163382168a07f145b41 | eventgate | analytics | test/utils/eventgate_test_factory.js | makeMockProduce | function | /**
* Returns a mock produce function that returns a result
* similar to what node-rdkafka's KafkaProducer produce returns
* in a delivery callback. Used for testing only!
*
* This function uses options to extract details from an incoming event.
*
* @param {Object} options
* @return {function(*=): *}
*/
funct... |
1,725 | d71c4957fae5e630b20e171049e4459a | swh:1:cnt:b08f606f373487decb166c86b8bac6c7d5275d92;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=70-98/ | 2fbc0bf25bd6c47be3e57163382168a07f145b41 | eventgate | analytics | test/utils/eventgate_test_factory.js | makeMapToErrorEvent | function | function makeMapToErrorEvent(options) {
return (error, event, context = {}) => {
const eventError = {
'$schema': options.error_schema_uri,
meta: {
stream_name: options.error_stream,
id: 'ea262403-f707-11e8-a892-c2baac54c6bc',
dt... |
1,726 | 83243f985696316a5e65365b219c4f7e | swh:1:cnt:b08f606f373487decb166c86b8bac6c7d5275d92;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=101-109/ | 2fbc0bf25bd6c47be3e57163382168a07f145b41 | eventgate | analytics | test/utils/eventgate_test_factory.js | mockEventGateFactory | function | async function mockEventGateFactory(options, logger) {
return new EventGate({
validate: makeValidate(options, logger),
produce: makeMockProduce(options),
eventRepr: (event) => 'TEST EVENT',
log: logger,
mapToEventError: makeMapToErrorEvent(options)
});
} |
1,727 | d6f884273ae900cf576509e1ca398521 | swh:1:cnt:ad86d4213ae2f468c8e616d46bb4f07893b98a18;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=6-66/ | 9743453b73f33718e0a187ae6e9a611a5c7e705c | eventgate | analytics | test/utils/server.js | TestExpressServer | type | class TestExpressServer {
configDirectory;
running = false;
conf;
app;
spec;
uri;
constructor(configDirectory = `${__dirname}/../`) {
this.configDirectory = configDirectory;
}
async start() {
if (this.running) {
return;
}
this.app = await... |
1,728 | a1339e11f6e28e3988eb211cd2988ad8 | swh:1:cnt:ad86d4213ae2f468c8e616d46bb4f07893b98a18;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=14-16/ | 9743453b73f33718e0a187ae6e9a611a5c7e705c | eventgate | analytics | test/utils/server.js | TestExpressServer::constructor | function | constructor(configDirectory = `${__dirname}/../`) {
this.configDirectory = configDirectory;
} |
1,729 | 31cd5b9a0674b4045f1159bc051147ce | swh:1:cnt:ad86d4213ae2f468c8e616d46bb4f07893b98a18;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=48-57/ | 9743453b73f33718e0a187ae6e9a611a5c7e705c | eventgate | analytics | test/utils/server.js | TestExpressServer::config | function | get config() {
if (!this.running) {
throw new Error('Accessing test service config before starting the service');
}
return {
uri: this.uri,
conf: this.conf,
spec: this.spec,
};
} |
1,730 | ce6d71c2d6149c66187772a63c11b8ae | swh:1:cnt:ad86d4213ae2f468c8e616d46bb4f07893b98a18;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=18-46/ | 9743453b73f33718e0a187ae6e9a611a5c7e705c | eventgate | analytics | test/utils/server.js | TestExpressServer::start | function | async start() {
if (this.running) {
return;
}
this.app = await startApp({
configDirectory: this.configDirectory,
configFile: 'config.test',
envName: 'test',
overrides: { logging: { level: 'debug', format: 'simple' } },
// Don't start metrics ... |
1,731 | 4f77d1ab6475d41c2dbdd5149c2412bf | swh:1:cnt:ad86d4213ae2f468c8e616d46bb4f07893b98a18;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate.git;lines=59-65/ | 9743453b73f33718e0a187ae6e9a611a5c7e705c | eventgate | analytics | test/utils/server.js | TestExpressServer::stop | function | async stop() {
if (!this.running) {
return;
}
await this.app.close();
this.running = false;
} |
1,732 | 51e96e8cdd3412b7493c72839b8fe0ea | swh:1:cnt:a117fed061cbaabbdecd378e45a3727f82b6b521;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=43-57/ | 57d2ede3e949c7d9fd77bdb05a89dd6ae82d7e62 | aqs | analytics | lib/aqsUtil.js | throwIfNeeded | function | /**
* Parameter validators
* Only needed internally, not exposed
*/
function throwIfNeeded(errors) {
if (errors && errors.length) {
throw new HTTPError({
status: 400,
body: {
type: 'invalid_request',
detail: errors,
}
});
}
} |
1,733 | 7955d810909d136b026e28f9581a869b | swh:1:cnt:f5184326f27f93f8b04b664606fd2f5d1bfcad1a;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=38-40/ | 4de2dbeb083c394e28b746f08de0a432073d82e8 | aqs | analytics | lib/druidUtil.js | makeSimpleTypeAggregation | function | function makeSimpleTypeAggregation(type, name, fieldName) {
return { type, name, fieldName };
} |
1,734 | e483002c8ecbccf9c4addfd7761b890f | swh:1:cnt:f5184326f27f93f8b04b664606fd2f5d1bfcad1a;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=114-126/ | 4de2dbeb083c394e28b746f08de0a432073d82e8 | aqs | analytics | lib/druidUtil.js | makeQuery | function | // Kill the request after 10 seconds
// const MAX_RETRIES = 3; // Try the request again a maximum of 3 times
function makeQuery(uri, body) {
return {
uri,
headers: JSON_HEADER,
body,
agentOptions: AGENT_OPTIONS,
timeout: TIMEOUT,
// retries: MAX_RETRIES, // not enabl... |
1,735 | 1b021f4b76f1dbace17897108769e630 | swh:1:cnt:f5184326f27f93f8b04b664606fd2f5d1bfcad1a;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=88-90/ | 4de2dbeb083c394e28b746f08de0a432073d82e8 | aqs | analytics | lib/druidUtil.js | makeArithmeticPostAggregation | function | function makeArithmeticPostAggregation(fn, name, fields) {
return { type: 'arithmetic', name, fn, fields };
} |
1,736 | 2e2f2d79217c1e59fd22ca23dda32ef9 | swh:1:cnt:c1a4f5435bb76a4cad453a0202200afe0fbbb815;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=18-21/ | 0499a7a5ad832dd9d6cbd4b2c41fafcce00840dc | aqs | analytics | sys/knowledge-gap.js | KGS | function | // Knowledge Gap Services
function KGS(options) {
this.options = options;
} |
1,737 | 9f1820c466bab8b0fcb7afd25b23a3fe | swh:1:cnt:c1a4f5435bb76a4cad453a0202200afe0fbbb815;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=23-25/ | 0499a7a5ad832dd9d6cbd4b2c41fafcce00840dc | aqs | analytics | sys/knowledge-gap.js | tableURI | function | function tableURI(domain, tableName) {
return new URI([domain, 'sys', 'table', tableName, '']);
} |
1,738 | b092734553f34db1ea58e632c38ab615 | swh:1:cnt:444cf1a2440e6b3efd555a098816cf89bdb517d4;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=22-24/ | 4c6eb6670a1c3cf3912c85b4aabbf4639aa58df5 | aqs | analytics | sys/mediarequests.js | MediaRequestsService | function | function MediaRequestsService(options) {
this.options = options;
} |
1,739 | 9f1820c466bab8b0fcb7afd25b23a3fe | swh:1:cnt:444cf1a2440e6b3efd555a098816cf89bdb517d4;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=26-28/ | 4c6eb6670a1c3cf3912c85b4aabbf4639aa58df5 | aqs | analytics | sys/mediarequests.js | tableURI | function | function tableURI(domain, tableName) {
return new URI([domain, 'sys', 'table', tableName, '']);
} |
1,740 | f36ccbce76563c0202526776553597b0 | swh:1:cnt:88bba0e503d461bf953f67092984871d1552a553;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=43-47/ | bdbfa6d5e1b054e8520210b82f54b409965701dc | aqs | analytics | sys/mediawiki-history-metrics.js | MHMDS | function | // mediawiki_history_metrics Druid Service
function MHMDS(options) {
this.options = options;
this.druid = options.druid;
} |
1,741 | 066c88c58003c5d1047bc8b7403d6de2 | swh:1:cnt:88bba0e503d461bf953f67092984871d1552a553;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=49-66/ | bdbfa6d5e1b054e8520210b82f54b409965701dc | aqs | analytics | sys/mediawiki-history-metrics.js | requestURI | function | function requestURI(druid) {
if (druid) {
const scheme = (druid.scheme) ? `${druid.scheme}://` : '';
const host = druid.host || '';
const port = (druid.port) ? `:${druid.port}` : '';
const path = druid.query_path || '';
return `${scheme}${host}${port}${path}`;
} else { /... |
1,742 | 79f90c9b6efdf8b7e5a12f5da61cdd0e | swh:1:cnt:88bba0e503d461bf953f67092984871d1552a553;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=105-143/ | bdbfa6d5e1b054e8520210b82f54b409965701dc | aqs | analytics | sys/mediawiki-history-metrics.js | validateRequestParams | function | function validateRequestParams(requestParams, opts) {
opts = opts || {};
requestParams.project = aqsUtil.normalizeProject(requestParams.project, opts.noAllProjects);
if (requestParams['page-title']) {
requestParams['page-title'] = aqsUtil.normalizePageTitle(requestParams['page-title']);
}
i... |
1,743 | 68d986cb3798c3f6490091bf5bc5ca9a | swh:1:cnt:88bba0e503d461bf953f67092984871d1552a553;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=68-80/ | bdbfa6d5e1b054e8520210b82f54b409965701dc | aqs | analytics | sys/mediawiki-history-metrics.js | requestDatasource | function | function requestDatasource(druid) {
if (druid && druid.datasources && druid.datasources.mediawiki_history) {
return druid.datasources.mediawiki_history;
} else { // Fail with 500 if druid conf is not set
throw new HTTPError({
status: 500,
body: {
type: 'in... |
1,744 | 43e85f212b15cbfc8c4b944bc9656b2e | swh:1:cnt:88bba0e503d461bf953f67092984871d1552a553;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=146-175/ | bdbfa6d5e1b054e8520210b82f54b409965701dc | aqs | analytics | sys/mediawiki-history-metrics.js | eventsFiltersFromRequestParams | function | /*
* Function generating filters for non-denormalized event entities
* (page, user, revision)
* With those events, metrics are additive and therefore 'all'
* parameter values always mean 'no filtering'
*/
function eventsFiltersFromRequestParams(requestParams) {
return AQS_PARAMS.filter((paramName) => {
... |
1,745 | 7ff4da3c9f18b95aa306c76e1dd705f4 | swh:1:cnt:88bba0e503d461bf953f67092984871d1552a553;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=178-214/ | bdbfa6d5e1b054e8520210b82f54b409965701dc | aqs | analytics | sys/mediawiki-history-metrics.js | digestsFiltersFromRequestParams | function | /*
* Function generating filters for denormalized event entities
* (digests)
* With those events, metrics are non-additive over dimensions
* and therefore 'all' parameter means explicit filtering for a
* 'all' value.
* Since the digests are currently not fully optimized, some special
* cases also apply (see belo... |
1,746 | e958c83b5192e04b236f720758deaa1f | swh:1:cnt:88bba0e503d461bf953f67092984871d1552a553;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=216-221/ | bdbfa6d5e1b054e8520210b82f54b409965701dc | aqs | analytics | sys/mediawiki-history-metrics.js | digestGranularityFilter | function | function digestGranularityFilter(granularity) {
return druidUtil.makeSelectorFilter(
D.dimension.eventType,
A2D['granularity-digest'][granularity]
);
} |
1,747 | 65195ef3ed88e8a2bcd9e8645173d5a5 | swh:1:cnt:88bba0e503d461bf953f67092984871d1552a553;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=223-225/ | bdbfa6d5e1b054e8520210b82f54b409965701dc | aqs | analytics | sys/mediawiki-history-metrics.js | eventsCountingAggregation | function | function eventsCountingAggregation(outputMetricName) {
return druidUtil.makeLongSum(outputMetricName, D.metric.events);
} |
1,748 | 700ea00dde38e6befa44ae016ad78470 | swh:1:cnt:88bba0e503d461bf953f67092984871d1552a553;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=227-275/ | bdbfa6d5e1b054e8520210b82f54b409965701dc | aqs | analytics | sys/mediawiki-history-metrics.js | convertDruidResultToAqsResult | function | function convertDruidResultToAqsResult(druidResult, requestParams, keyFilters, isTop) {
if (druidResult.status === 200) {
// Overwrite body: Druid result is an array of results,
// we send a single item with an array of results
const coreItem = {};
AQS_PARAMS.forEach((paramName) => ... |
1,749 | ae9765a42ce13c9290c1e6a8c745a7e7 | swh:1:cnt:88bba0e503d461bf953f67092984871d1552a553;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=517-522/ | bdbfa6d5e1b054e8520210b82f54b409965701dc | aqs | analytics | sys/mediawiki-history-metrics.js | MHMCS | function | // Cassandra metrics
// mediawiki_history_metrics Cassandra Service
function MHMCS(options) {
this.options = options;
} |
1,750 | 9f1820c466bab8b0fcb7afd25b23a3fe | swh:1:cnt:88bba0e503d461bf953f67092984871d1552a553;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=524-526/ | bdbfa6d5e1b054e8520210b82f54b409965701dc | aqs | analytics | sys/mediawiki-history-metrics.js | tableURI | function | function tableURI(domain, tableName) {
return new URI([domain, 'sys', 'table', tableName, '']);
} |
1,751 | b097b6e13c6f809103dc6c6000f8db13 | swh:1:cnt:8005b3b1cb87195f93401d9f440ff187690a206c;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=21-24/ | bc5031116829bdd2034eddc3326c5eeb71a711f8 | aqs | analytics | sys/pageviews.js | PJVS | function | // Pageviews Service
function PJVS(options) {
this.options = options;
} |
1,752 | 65d96637fa07d609760fea43b15cae28 | swh:1:cnt:8005b3b1cb87195f93401d9f440ff187690a206c;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=171-174/ | bc5031116829bdd2034eddc3326c5eeb71a711f8 | aqs | analytics | sys/pageviews.js | viewKeyForArticleFlat | function | function viewKeyForArticleFlat(access, agent) {
const ret = ['views', access, agent].join('_');
return viewCountColumnsForArticleFlat[ret.replace(/-/g, '_')];
} |
1,753 | 0bdad687b502517cd9d7c9844147a3d4 | swh:1:cnt:8005b3b1cb87195f93401d9f440ff187690a206c;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=176-180/ | bc5031116829bdd2034eddc3326c5eeb71a711f8 | aqs | analytics | sys/pageviews.js | removeDenormalizedColumnsForArticleFlat | function | function removeDenormalizedColumnsForArticleFlat(item) {
Object.values(viewCountColumnsForArticleFlat).forEach((v) => {
delete item[v];
});
} |
1,754 | 9f1820c466bab8b0fcb7afd25b23a3fe | swh:1:cnt:8005b3b1cb87195f93401d9f440ff187690a206c;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=26-28/ | bc5031116829bdd2034eddc3326c5eeb71a711f8 | aqs | analytics | sys/pageviews.js | tableURI | function | function tableURI(domain, tableName) {
return new URI([domain, 'sys', 'table', tableName, '']);
} |
1,755 | 475f58819eba9ba495323abc56216f0c | swh:1:cnt:32c26a76d41579f2b67df1a5154ab37b8ce3268e;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=17-20/ | 0e5bcc03e2b84ede61523a1376f6a1800f3c076b | aqs | analytics | sys/unique-devices.js | UDVS | function | // Unique devices Service
function UDVS(options) {
this.options = options;
} |
1,756 | 9f1820c466bab8b0fcb7afd25b23a3fe | swh:1:cnt:32c26a76d41579f2b67df1a5154ab37b8ce3268e;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=22-24/ | 0e5bcc03e2b84ede61523a1376f6a1800f3c076b | aqs | analytics | sys/unique-devices.js | tableURI | function | function tableURI(domain, tableName) {
return new URI([domain, 'sys', 'table', tableName, '']);
} |
1,757 | d9e259fba4cf6c5a2bf37065b8525e7d | swh:1:cnt:261ab7c6d092c0898520d4c9c093a28af2532622;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=19-22/ | e29d4c562ede6dcd4017302f3a9792d8e6136181 | aqs | analytics | sys/legacy/pagecounts.js | LPCS | function | // Pagecounts service
function LPCS(options) {
this.options = options;
} |
1,758 | 9f1820c466bab8b0fcb7afd25b23a3fe | swh:1:cnt:261ab7c6d092c0898520d4c9c093a28af2532622;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=24-26/ | e29d4c562ede6dcd4017302f3a9792d8e6136181 | aqs | analytics | sys/legacy/pagecounts.js | tableURI | function | function tableURI(domain, tableName) {
return new URI([domain, 'sys', 'table', tableName, '']);
} |
1,759 | 2698df8bf56fa65e681252ff32e62117 | swh:1:cnt:95ecc991b848ed8caef43b3ebe30dca09b7a12f6;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=27-27/ | 6f414f374d804dfd1221894d84eb3a3aea6fe1eb | aqs | analytics | test/features/knowledge-gap/knowledge-gap.js | fix | function | function fix(b, s, u) { return b.replace(s, s + u); } |
1,760 | 4dd93596113249ca84a860108a38dd1c | swh:1:cnt:8d859942a5663a90ce638ca9ff8aa541daec0f99;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=14-17/ | d1189713365d476cab4061b50cded864b2bf703a | aqs | analytics | test/features/legacy/pagecounts/pagecounts.js | URL | function | function URL (project, accessSite, granularity, start, end) {
return (baseURL + '/legacy/pagecounts/aggregate/' + project + '/' +
accessSite + '/' + granularity + '/' + start + '/' + end);
} |
1,761 | c5243377b0b5dfc7051b4ff40397c1a8 | swh:1:cnt:8d859942a5663a90ce638ca9ff8aa541daec0f99;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=24-31/ | d1189713365d476cab4061b50cded864b2bf703a | aqs | analytics | test/features/legacy/pagecounts/pagecounts.js | insert | function | function insert (project, accessSite, granularity, data) {
var promises = data.map(function (elem) {
return preq.post({
uri: insertURL(project, accessSite, granularity, elem[0], elem[1])
});
});
return Promise.all(promises);
} |
1,762 | 03ea6338ab11b28885f6a1767174c589 | swh:1:cnt:8d859942a5663a90ce638ca9ff8aa541daec0f99;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=19-22/ | d1189713365d476cab4061b50cded864b2bf703a | aqs | analytics | test/features/legacy/pagecounts/pagecounts.js | insertURL | function | function insertURL (project, accessSite, granularity, timestamp, count) {
return (baseURL + '/legacy/pagecounts/insert-aggregate/' + project + '/' +
accessSite + '/' + granularity + '/' + timestamp + '/' + count);
} |
1,763 | e3c802a739e823750e10d56675c0ddba | swh:1:cnt:1e5c9d3181b1a12cb15e556812d038180c5a861f;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=106-112/ | ebb0bf1ae3cfb5041c9c1abce61efaebd386867b | aqs | analytics | test/features/mediarequests/mediarequests.js | r | function | function r(s, replaceSpaces) {
var weirdArticleTitle = 'dash - space : colon % percent';
weirdArticleTitle = weirdArticleTitle.replace(/ /g, '_');
return s.replace(
'/%2Fwiktionary%2Fte%2F4%2F40%2Fpeacocks.JPG/', '/' + encodeURIcomponent(weirdArticleTitle) + '/'
... |
1,764 | d8e78889c1fc2d7c3cf350ca01362245 | swh:1:cnt:2e4d4dc0a0909712ed5eb308d3c676f11496c119;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=17-20/ | c476d9e6ddcefb48bfd32c984a9a81ad31e999f0 | aqs | analytics | test/features/mediawiki-history-metrics/fake-druid.js | FDS | function | // FakeDruid service
function FDS(options) {
this.options = options;
} |
1,765 | 6019cf93db423b2b2003c146f5b99199 | swh:1:cnt:f237a8946c7ca75f3f11ca8a12a237ddc01728cd;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=222-225/ | bd9c2c1ed8bfc532aa24a24f456f9e9c68bef9c2 | aqs | analytics | test/features/mediawiki-history-metrics/mediawiki-history-metrics.js | post | function | post (req) {
assert.deepEqual(req.timeout, 10000);
done();
} |
1,766 | 2698df8bf56fa65e681252ff32e62117 | swh:1:cnt:55d3ea0c7f2cbfceb05fc60c95eff2971095b547;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=51-51/ | 00bc08f71ebf4611198f5ece745167205f2bcbc1 | aqs | analytics | test/features/pageviews/pageviews.js | fix | function | function fix(b, s, u) { return b.replace(s, s + u); } |
1,767 | 2030b79459311bb1fdf061dc1e697fd0 | swh:1:cnt:55d3ea0c7f2cbfceb05fc60c95eff2971095b547;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=132-140/ | 00bc08f71ebf4611198f5ece745167205f2bcbc1 | aqs | analytics | test/features/pageviews/pageviews.js | r | function | function r(s, replaceSpaces) {
var weirdArticleTitle = 'dash - space : colon % percent / slash';
if (replaceSpaces) {
weirdArticleTitle = weirdArticleTitle.replace(/ /g, '_');
}
return s.replace(
'/one/', '/' + encodeURIComponent(weirdArticleTitle) + '/'
)... |
1,768 | 2698df8bf56fa65e681252ff32e62117 | swh:1:cnt:b46ce81d4e0af2f7b563257712d8c99a724cd358;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=24-24/ | 6e98d616dbaa91824aef9df7624b3b307cb20062 | aqs | analytics | test/features/unique-devices/unique-devices.js | fix | function | function fix(b, s, u) { return b.replace(s, s + u); } |
1,769 | 42d08d7bbb3eb069388540cf765f9fe7 | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=6-13/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | contentType | function | /**
* Asserts whether content type was as expected
*/
function contentType(res, expected) {
var actual = res.headers['content-type'];
deepEqual(actual, expected,
'Expected content-type to be ' + expected + ', but was ' + actual);
} |
1,770 | 75c3f6c079c6af6d310a0bdd31fe5e19 | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=34-49/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | remoteRequests | function | /**
* Asserts whether some requests in the given
* slice were made to remote entities
*/
function remoteRequests(slice, expected) {
deepEqual(
slice.get().some(function(line) {
var entry = JSON.parse(line);
return entry.req && /^http/.test(entry.req.uri);
}),
expec... |
1,771 | 9e526f707255892cc8362c2cca6622f3 | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=62-73/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | isDeepEqual | function | function isDeepEqual(result, expected, message) {
try {
if (typeof expected === 'string') {
assert.ok(result === expected || (new RegExp('^' + expected + '$').test(result)), message);
} else {
assert.deepEqual(result, expected, message);
}
return true;
} c... |
1,772 | 93d512ddcfc568703336addc841f0d45 | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=51-60/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | findParsoidRequest | function | /**
* Finds the first request to parsoid
*/
function findParsoidRequest(slice) {
var logEntry = slice.get().find(function(line) {
var entry = JSON.parse(line);
return entry.req && /^http:\/\/parsoid/.test(entry.req.uri);
});
return JSON.parse(logEntry).req;
} |
1,773 | 21479a998368e2a4457b191e075d6e67 | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=15-32/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | localRequests | function | /**
* Asserts whether all requests in the given
* slice were routed to local recipients
*/
function localRequests(slice, expected) {
deepEqual(
!slice.get().some(function(line) {
var entry = JSON.parse(line);
// if the URI starts with a slash,
// it's a local request
... |
1,774 | 5e512e057bc453e7d2e4792671fd09c4 | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=75-87/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | deepEqual | function | function deepEqual(result, expected, message) {
try {
if (typeof expected === 'string') {
assert.ok(result === expected || (new RegExp('^' + expected + '$').test(result)));
} else {
assert.deepEqual(result, expected, message);
}
} catch (e) {
console.log('... |
1,775 | 2686ed5119176f8492183a5e21e0e29a | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=89-96/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | isDeepStrictEqual | function | function isDeepStrictEqual(result, expected, message) {
try {
assert.deepStrictEqual(result, expected, message);
return true;
} catch (e) {
return false;
}
} |
1,776 | c5598b73c7c698d3eff65939327edb42 | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=98-106/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | deepStrictEqual | function | function deepStrictEqual(result, expected, message) {
try {
assert.deepStrictEqual(result, expected, message);
} catch (e) {
console.log('Expected:\n' + JSON.stringify(expected,null,2));
console.log('Result:\n' + JSON.stringify(result,null,2));
throw e;
}
} |
1,777 | 7866f53ff7ad4eec4b472aee1c82cbae | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=108-121/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | isSuperset | function | function isSuperset(parent, child) {
var result = true;
if (child instanceof Object) {
for (var k in child) {
isSuperset(parent[k], child[k]);
}
} else if (child instanceof Array) {
for (var i = 0; i < child.length; i++) {
isSuperset(parent[i], child[i]);
... |
1,778 | aa6f8af61db6da35db9eadec008b9368 | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=123-131/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | notDeepEqual | function | function notDeepEqual(result, expected, message) {
try {
assert.notDeepEqual(result, expected, message);
} catch (e) {
console.log('Not expected:\n' + JSON.stringify(expected,null,2));
console.log('Result:\n' + JSON.stringify(result,null,2));
throw e;
}
} |
1,779 | 4db3aba94341c55d7ffd005617269ebb | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=149-153/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | fails::check | function | function check() {
if (!failed) {
throw new Error('expected error was not thrown');
}
} |
1,780 | a98eab98144941477f1ed20d61ff248a | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=145-148/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | fails::trackFailure | function | function trackFailure(e) {
failed = true;
return onRejected(e);
} |
1,781 | afe9ad3c1bca1572846aee2a26d0595a | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=133-141/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | notDeepStrictEqual | function | function notDeepStrictEqual(result, expected, message) {
try {
assert.notDeepStrictEqual(result, expected, message);
} catch (e) {
console.log('Not expected:\n' + JSON.stringify(expected,null,2));
console.log('Result:\n' + JSON.stringify(result,null,2));
throw e;
}
} |
1,782 | 8481ac115d3d1be598ec1fea4ff5a6a0 | swh:1:cnt:db74ade4e80ac90e14ec67602487e625acd5a006;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=143-155/ | 0aa938cc7dc34f2301597b2319cf940e8cc134ea | aqs | analytics | test/utils/assert.js | fails | function | function fails(promise, onRejected) {
var failed = false;
function trackFailure(e) {
failed = true;
return onRejected(e);
}
function check() {
if (!failed) {
throw new Error('expected error was not thrown');
}
}
return promise.catch(trackFailure).then(... |
1,783 | e0dfb6263378eb3d35b36c6481a5c816 | swh:1:cnt:bafe95c602e4eb8b2dce41a17d11a2849b199118;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=5-66/ | 7e9492cd84489ba8683373a6850f7aeaa391db5a | aqs | analytics | test/utils/logStream.js | logStream | function | function logStream() {
var log = [];
var parrot = bunyan.createLogger({
name: 'test-logger',
level: 'warn'
});
function write(chunk, encoding, callback) {
try {
var entry = JSON.parse(chunk);
var levelMatch = /^(\w+)/.exec(entry.levelPath);
if (levelMatch) {
var... |
1,784 | 965b226247ad73b7910bf607f7f9d154 | swh:1:cnt:bafe95c602e4eb8b2dce41a17d11a2849b199118;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=34-36/ | 7e9492cd84489ba8683373a6850f7aeaa391db5a | aqs | analytics | test/utils/logStream.js | logStream::get | function | function get() {
return log;
} |
1,785 | 30f8e6f2c4854f169983ba733dcaaf3a | swh:1:cnt:bafe95c602e4eb8b2dce41a17d11a2849b199118;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=30-32/ | 7e9492cd84489ba8683373a6850f7aeaa391db5a | aqs | analytics | test/utils/logStream.js | logStream::end | function | // to implement the stream writer interface
function end(chunk, encoding, callback) {
} |
1,786 | 05e444969c00be7883ec91d87a1a79ae | swh:1:cnt:bafe95c602e4eb8b2dce41a17d11a2849b199118;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=13-28/ | 7e9492cd84489ba8683373a6850f7aeaa391db5a | aqs | analytics | test/utils/logStream.js | logStream::write | function | function write(chunk, encoding, callback) {
try {
var entry = JSON.parse(chunk);
var levelMatch = /^(\w+)/.exec(entry.levelPath);
if (levelMatch) {
var level = levelMatch[1];
if (parrot[level]) {
parrot[level](entry);
}
}
} catc... |
1,787 | ca1138fae48d1aa8a5b960c9782b43ea | swh:1:cnt:bafe95c602e4eb8b2dce41a17d11a2849b199118;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=38-58/ | 7e9492cd84489ba8683373a6850f7aeaa391db5a | aqs | analytics | test/utils/logStream.js | logStream::slice | function | function slice() {
var begin = log.length;
var end = null;
function halt() {
if (end === null) {
end = log.length;
}
}
function get() {
return log.slice(begin, end);
}
return {
halt: halt,
get: get
};
} |
1,788 | a6615deaa6305322a89d3d2f0d3b8533 | swh:1:cnt:bafe95c602e4eb8b2dce41a17d11a2849b199118;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=43-47/ | 7e9492cd84489ba8683373a6850f7aeaa391db5a | aqs | analytics | test/utils/logStream.js | logStream::slice::halt | function | function halt() {
if (end === null) {
end = log.length;
}
} |
1,789 | a2e5aaca4bc96d67f32fd3ec17afef39 | swh:1:cnt:bafe95c602e4eb8b2dce41a17d11a2849b199118;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=49-51/ | 7e9492cd84489ba8683373a6850f7aeaa391db5a | aqs | analytics | test/utils/logStream.js | logStream::slice::get | function | function get() {
return log.slice(begin, end);
} |
1,790 | d002490177385c3a72a502eda161c9b0 | swh:1:cnt:6706fd1e5933b4ef52dca9d13451ccc492a045c8;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=12-56/ | 51608423da0ab0069acbe10747a834e7b9849e43 | aqs | analytics | test/utils/server.js | TestRunner | type | class TestRunner {
constructor () {
this.config = {
aqsURL: TestRunner.AQS_URL,
logStream: logStream(),
runnerConfig: this.loadConfig(__dirname + '/../../config.test.yaml')
};
this.config.runnerConfig.num_workers = 0;
this.config.runnerConfig.loggi... |
1,791 | c6f70118c339d13d635b8b6f9ce10420 | swh:1:cnt:6706fd1e5933b4ef52dca9d13451ccc492a045c8;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=13-26/ | 51608423da0ab0069acbe10747a834e7b9849e43 | aqs | analytics | test/utils/server.js | TestRunner::constructor | function | constructor () {
this.config = {
aqsURL: TestRunner.AQS_URL,
logStream: logStream(),
runnerConfig: this.loadConfig(__dirname + '/../../config.test.yaml')
};
this.config.runnerConfig.num_workers = 0;
this.config.runnerConfig.logging = {
name... |
1,792 | b022a8ad094d4cc9bcb234e2836bb8b1 | swh:1:cnt:6706fd1e5933b4ef52dca9d13451ccc492a045c8;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=43-55/ | 51608423da0ab0069acbe10747a834e7b9849e43 | aqs | analytics | test/utils/server.js | TestRunner::loadConfig | function | loadConfig (path) {
let confString = fs.readFileSync(path).toString();
const backendImpl = process.env.RB_TEST_BACKEND;
if (backendImpl) {
if (backendImpl !== 'cassandra' && backendImpl !== 'sqlite') {
throw new Error('Invalid RB_TEST_BACKEND env variable value. Allow... |
1,793 | a3a365038655ea12d92cd5f8958f11f6 | swh:1:cnt:6706fd1e5933b4ef52dca9d13451ccc492a045c8;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=39-41/ | 51608423da0ab0069acbe10747a834e7b9849e43 | aqs | analytics | test/utils/server.js | TestRunner::stop | function | stop () {
this.runner.stop();
} |
1,794 | 89ce2f679ff6de2eed9fe501bb96f8ea | swh:1:cnt:6706fd1e5933b4ef52dca9d13451ccc492a045c8;origin=https://gerrit.wikimedia.org/r/analytics/aqs.git;lines=28-37/ | 51608423da0ab0069acbe10747a834e7b9849e43 | aqs | analytics | test/utils/server.js | TestRunner::start | function | start () {
console.log('Starting AQS in '
+ (this.config.runnerConfig.offline ? 'OFFLINE' : 'ONLINE') + ' mode');
return this.runner.start(this.config.runnerConfig)
.then((servers) => {
const server = servers[0][0];
this.runner.server = server;... |
1,795 | 90dcf987e4b23f77ed7101f779db12ad | swh:1:cnt:c2fdaf91a5458a1132c92710f5ef4643c9345011;origin=https://gitlab.wikimedia.org/repos/data-engineering/refinery.git;lines=28-46/ | 221299ea44e93b1a5f9761515ae36a636ef81c1f | refinery | analytics | jobs/python/kafka_to_iceberg/active_reader_baseline/kafka_to_iceberg_active_reader_baseline/process_active_reader_baseline.py | parse_args(args) | function | def parse_args(args) -> argparse.Namespace:
parser = argparse.ArgumentParser(
description='consume product_metrics.web_base.active_reader_baseline from Kafka, transform, then write to Iceberg'
)
parser.add_argument('--kafka_bootstrap', help='Kafka broker (like kafka-jumbo1010.eqiad.wmnet:9092)')
... |
1,796 | 1c8795ccc5c89575a6f9cfa309c00961 | swh:1:cnt:c2fdaf91a5458a1132c92710f5ef4643c9345011;origin=https://gitlab.wikimedia.org/repos/data-engineering/refinery.git;lines=106-125/ | 221299ea44e93b1a5f9761515ae36a636ef81c1f | refinery | analytics | jobs/python/kafka_to_iceberg/active_reader_baseline/kafka_to_iceberg_active_reader_baseline/process_active_reader_baseline.py | get_stream(spark, kafka_bootstrap, kafka_topic, max_offsets_per_trigger) | function | def get_stream(spark, kafka_bootstrap, kafka_topic, max_offsets_per_trigger):
return (
spark.readStream
.format('kafka')
.option('kafka.bootstrap.servers', kafka_bootstrap)
.option('subscribe', f'eqiad.{kafka_topic},codfw.{kafka_topic}')
.option('startingOffse... |
1,797 | 9da783e717198917efb6bf1f8bf90e3a | swh:1:cnt:c2fdaf91a5458a1132c92710f5ef4643c9345011;origin=https://gitlab.wikimedia.org/repos/data-engineering/refinery.git;lines=76-77/ | 221299ea44e93b1a5f9761515ae36a636ef81c1f | refinery | analytics | jobs/python/kafka_to_iceberg/active_reader_baseline/kafka_to_iceberg_active_reader_baseline/process_active_reader_baseline.py | main() | function | def main() -> None:
run(parse_args(sys.argv[1:])) |
1,798 | cfb112ba27a39c00bc51ed0d844a5642 | swh:1:cnt:c2fdaf91a5458a1132c92710f5ef4643c9345011;origin=https://gitlab.wikimedia.org/repos/data-engineering/refinery.git;lines=137-154/ | 221299ea44e93b1a5f9761515ae36a636ef81c1f | refinery | analytics | jobs/python/kafka_to_iceberg/active_reader_baseline/kafka_to_iceberg_active_reader_baseline/process_active_reader_baseline.py | create_output_table(destination_table) | function | def create_output_table(destination_table):
spark.sql("""
CREATE TABLE IF NOT EXISTS {destination_table} (
event_date DATE,
hashed_user_id STRING,
domain STRING COMMENT 'meta.domain; e.g. en.wikipedia.org',
event_id STRING COMMENT 'meta.id; merge key for idempotent writes',
... |
1,799 | e6679e85742b0041ae0a405a3f4c6c34 | swh:1:cnt:c2fdaf91a5458a1132c92710f5ef4643c9345011;origin=https://gitlab.wikimedia.org/repos/data-engineering/refinery.git;lines=48-74/ | 221299ea44e93b1a5f9761515ae36a636ef81c1f | refinery | analytics | jobs/python/kafka_to_iceberg/active_reader_baseline/kafka_to_iceberg_active_reader_baseline/process_active_reader_baseline.py | run(args: argparse.Namespace) | function | def run(args: argparse.Namespace) -> None:
# needed in foreachBatch callback, no easy way to pass
global destination_table
spark = SparkSession.builder.getOrCreate()
spark.sparkContext.setLogLevel("WARN")
destination_table = args.destination_table
typed_stream = get_stream(
spark,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.