Merge remote-tracking branch 'origin/api-v1.8.0' into dev
This commit is contained in:
commit
fdf894f17d
10 changed files with 30 additions and 10 deletions
|
|
@ -44,5 +44,7 @@ CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS autocomplete_unique_project_id_md
|
|||
BEGIN;
|
||||
|
||||
DROP INDEX IF EXISTS autocomplete_unique;
|
||||
DROP INDEX IF EXISTS events_common.requests_response_body_nn_idx;
|
||||
DROP INDEX IF EXISTS events_common.requests_request_body_nn_idx;
|
||||
|
||||
COMMIT;
|
||||
|
|
@ -1203,9 +1203,7 @@ $$
|
|||
ELSE 0 END))
|
||||
gin_trgm_ops);
|
||||
CREATE INDEX IF NOT EXISTS requests_timestamp_session_id_failed_idx ON events_common.requests (timestamp, session_id) WHERE success = FALSE;
|
||||
CREATE INDEX IF NOT EXISTS requests_request_body_nn_idx ON events_common.requests (request_body) WHERE request_body IS NOT NULL;
|
||||
CREATE INDEX IF NOT EXISTS requests_request_body_nn_gin_idx ON events_common.requests USING GIN (request_body gin_trgm_ops) WHERE request_body IS NOT NULL;
|
||||
CREATE INDEX IF NOT EXISTS requests_response_body_nn_idx ON events_common.requests (response_body) WHERE response_body IS NOT NULL;
|
||||
CREATE INDEX IF NOT EXISTS requests_response_body_nn_gin_idx ON events_common.requests USING GIN (response_body gin_trgm_ops) WHERE response_body IS NOT NULL;
|
||||
CREATE INDEX IF NOT EXISTS requests_status_code_nn_idx ON events_common.requests (status_code) WHERE status_code IS NOT NULL;
|
||||
CREATE INDEX IF NOT EXISTS requests_host_nn_idx ON events_common.requests (host) WHERE host IS NOT NULL;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ const {
|
|||
IDENTITIES,
|
||||
EVENTS_DEFINITION,
|
||||
extractSessionInfo,
|
||||
socketConnexionTimeout
|
||||
socketConnexionTimeout,
|
||||
errorHandler
|
||||
} = require('../utils/assistHelper');
|
||||
const {
|
||||
extractProjectKeyFromRequest,
|
||||
|
|
@ -348,6 +349,9 @@ module.exports = {
|
|||
socket.to(socket.peerId).emit(EVENTS_DEFINITION.emit.UPDATE_EVENT, args[0]);
|
||||
});
|
||||
|
||||
socket.on(EVENTS_DEFINITION.listen.CONNECT_ERROR, err => errorHandler(EVENTS_DEFINITION.listen.CONNECT_ERROR, err));
|
||||
socket.on(EVENTS_DEFINITION.listen.CONNECT_FAILED, err => errorHandler(EVENTS_DEFINITION.listen.CONNECT_FAILED, err));
|
||||
|
||||
socket.onAny(async (eventName, ...args) => {
|
||||
if (Object.values(EVENTS_DEFINITION.listen).indexOf(eventName) >= 0) {
|
||||
debug && console.log(`received event:${eventName}, should be handled by another listener, stopping onAny.`);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ const {
|
|||
IDENTITIES,
|
||||
EVENTS_DEFINITION,
|
||||
extractSessionInfo,
|
||||
socketConnexionTimeout
|
||||
socketConnexionTimeout,
|
||||
errorHandler
|
||||
} = require('../utils/assistHelper');
|
||||
const {
|
||||
extractProjectKeyFromRequest,
|
||||
|
|
@ -324,6 +325,9 @@ module.exports = {
|
|||
socket.to(socket.peerId).emit(EVENTS_DEFINITION.emit.UPDATE_EVENT, args[0]);
|
||||
});
|
||||
|
||||
socket.on(EVENTS_DEFINITION.listen.CONNECT_ERROR, err => errorHandler(EVENTS_DEFINITION.listen.CONNECT_ERROR, err));
|
||||
socket.on(EVENTS_DEFINITION.listen.CONNECT_FAILED, err => errorHandler(EVENTS_DEFINITION.listen.CONNECT_FAILED, err));
|
||||
|
||||
socket.onAny(async (eventName, ...args) => {
|
||||
if (Object.values(EVENTS_DEFINITION.listen).indexOf(eventName) >= 0) {
|
||||
debug && console.log(`received event:${eventName}, should be handled by another listener, stopping onAny.`);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ env:
|
|||
pg_dbname: postgres
|
||||
pg_user: postgres
|
||||
pg_password: asayerPostgres
|
||||
ch_host: clickhouse.db.svc.cluster.local
|
||||
ch_port: 9000
|
||||
EMAIL_HOST: ''
|
||||
EMAIL_PORT: '587'
|
||||
EMAIL_USER: ''
|
||||
|
|
|
|||
|
|
@ -44,5 +44,6 @@ CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS autocomplete_unique_project_id_md
|
|||
BEGIN;
|
||||
|
||||
DROP INDEX IF EXISTS autocomplete_unique;
|
||||
|
||||
DROP INDEX IF EXISTS events_common.requests_response_body_nn_idx;
|
||||
DROP INDEX IF EXISTS events_common.requests_request_body_nn_idx;
|
||||
COMMIT;
|
||||
|
|
@ -604,9 +604,7 @@ $$
|
|||
ELSE 0 END))
|
||||
gin_trgm_ops);
|
||||
CREATE INDEX requests_timestamp_session_id_failed_idx ON events_common.requests (timestamp, session_id) WHERE success = FALSE;
|
||||
CREATE INDEX requests_request_body_nn_idx ON events_common.requests (request_body) WHERE request_body IS NOT NULL;
|
||||
CREATE INDEX requests_request_body_nn_gin_idx ON events_common.requests USING GIN (request_body gin_trgm_ops) WHERE request_body IS NOT NULL;
|
||||
CREATE INDEX requests_response_body_nn_idx ON events_common.requests (response_body) WHERE response_body IS NOT NULL;
|
||||
CREATE INDEX requests_response_body_nn_gin_idx ON events_common.requests USING GIN (response_body gin_trgm_ops) WHERE response_body IS NOT NULL;
|
||||
CREATE INDEX requests_status_code_nn_idx ON events_common.requests (status_code) WHERE status_code IS NOT NULL;
|
||||
CREATE INDEX requests_host_nn_idx ON events_common.requests (host) WHERE host IS NOT NULL;
|
||||
|
|
|
|||
|
|
@ -90,6 +90,8 @@ autoscaling:
|
|||
# targetMemoryUtilizationPercentage: 80
|
||||
|
||||
env:
|
||||
ch_host: clickhouse-openreplay-clickhouse.db.svc.cluster.local
|
||||
ch_port: 9000
|
||||
PYTHONUNBUFFERED: '0'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ const {
|
|||
IDENTITIES,
|
||||
EVENTS_DEFINITION,
|
||||
extractSessionInfo,
|
||||
socketConnexionTimeout
|
||||
socketConnexionTimeout,
|
||||
errorHandler
|
||||
} = require('../utils/assistHelper');
|
||||
const wsRouter = express.Router();
|
||||
|
||||
|
|
@ -305,6 +306,9 @@ module.exports = {
|
|||
socket.to(socket.peerId).emit(EVENTS_DEFINITION.emit.UPDATE_EVENT, args[0]);
|
||||
});
|
||||
|
||||
socket.on(EVENTS_DEFINITION.listen.CONNECT_ERROR, err => errorHandler(EVENTS_DEFINITION.listen.CONNECT_ERROR, err));
|
||||
socket.on(EVENTS_DEFINITION.listen.CONNECT_FAILED, err => errorHandler(EVENTS_DEFINITION.listen.CONNECT_FAILED, err));
|
||||
|
||||
socket.onAny(async (eventName, ...args) => {
|
||||
if (Object.values(EVENTS_DEFINITION.listen).indexOf(eventName) >= 0) {
|
||||
debug && console.log(`received event:${eventName}, should be handled by another listener, stopping onAny.`);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ const {geoip} = require('./geoIP');
|
|||
let debug = process.env.debug === "1" || false;
|
||||
const IDENTITIES = {agent: 'agent', session: 'session'};
|
||||
const EVENTS_DEFINITION = {
|
||||
listen: {UPDATE_EVENT: "UPDATE_SESSION"}
|
||||
listen: {UPDATE_EVENT: "UPDATE_SESSION", CONNECT_ERROR: "connect_error", CONNECT_FAILED: "connect_failed"}
|
||||
};
|
||||
EVENTS_DEFINITION.emit = {
|
||||
NEW_AGENT: "NEW_AGENT",
|
||||
|
|
@ -93,6 +93,11 @@ function socketConnexionTimeout(io) {
|
|||
}
|
||||
}
|
||||
|
||||
function errorHandler(listenerName, error) {
|
||||
console.error(`Error detected from ${listenerName}`);
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
extractSessionInfo, EVENTS_DEFINITION, IDENTITIES, socketConnexionTimeout
|
||||
extractSessionInfo, EVENTS_DEFINITION, IDENTITIES, socketConnexionTimeout, errorHandler
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue