Source:
private void start() throws Exception { MaxwellMetrics.setup(config.metricsReportingType, config.metricsReportingInterval); try ( Connection connection = this.context.getReplicationConnection(); Connection rawConnection = this.context.getRawMaxwellConnection() ) { MaxwellMysqlStatus.ensureReplicationMysqlState(connection); MaxwellMysqlStatus.ensureMaxwellMysqlState(rawConnection); if (config.gtidMode) { MaxwellMysqlStatus.ensureGtidMysqlState(connection); } SchemaStoreSchema.ensureMaxwellSchema(rawConnection, this.config.databaseName); try ( Connection schemaConnection = this.context.getMaxwellConnection() ) { SchemaStoreSchema.upgradeSchemaStoreSchema(schemaConnection); } } catch ( SQLException e ) { LOGGER.error("SQLException: " + e.getLocalizedMessage()); LOGGER.error(e.getLocalizedMessage()); return; } AbstractProducer producer = this.context.getProducer(); AbstractBootstrapper bootstrapper = this.context.getBootstrapper(); BinlogPosition initPosition = getInitialPosition(); logBanner(producer, initPosition); this.context.setPosition(initPosition); MysqlSchemaStore mysqlSchemaStore = new MysqlSchemaStore(this.context, initPosition); mysqlSchemaStore.getSchema(); if ( this.config.shykoMode ) this.replicator = new BinlogConnectorReplicator(mysqlSchemaStore, producer, bootstrapper, this.context, initPosition); else this.replicator = new MaxwellReplicator(mysqlSchemaStore, producer, bootstrapper, this.context, initPosition); bootstrapper.resume(producer, replicator); replicator.setFilter(context.getFilter()); this.context.start(); this.onReplicatorStart(); replicator.runLoop(); MaxwellMetrics.registry.register( MetricRegistry.name(Maxwell.class, "replication", "lag"), replicator.getLagGauge() ); }

Target:
private void start() throws Exception { MaxwellMetrics.setup(config); try ( Connection connection = this.context.getReplicationConnection(); Connection rawConnection = this.context.getRawMaxwellConnection() ) { MaxwellMysqlStatus.ensureReplicationMysqlState(connection); MaxwellMysqlStatus.ensureMaxwellMysqlState(rawConnection); if (config.gtidMode) { MaxwellMysqlStatus.ensureGtidMysqlState(connection); } SchemaStoreSchema.ensureMaxwellSchema(rawConnection, this.config.databaseName); try ( Connection schemaConnection = this.context.getMaxwellConnection() ) { SchemaStoreSchema.upgradeSchemaStoreSchema(schemaConnection); } } catch ( SQLException e ) { LOGGER.error("SQLException: " + e.getLocalizedMessage()); LOGGER.error(e.getLocalizedMessage()); return; } AbstractProducer producer = this.context.getProducer(); AbstractBootstrapper bootstrapper = this.context.getBootstrapper(); BinlogPosition initPosition = getInitialPosition(); logBanner(producer, initPosition); this.context.setPosition(initPosition); MysqlSchemaStore mysqlSchemaStore = new MysqlSchemaStore(this.context, initPosition); mysqlSchemaStore.getSchema(); if ( this.config.shykoMode ) this.replicator = new BinlogConnectorReplicator(mysqlSchemaStore, producer, bootstrapper, this.context, initPosition); else this.replicator = new MaxwellReplicator(mysqlSchemaStore, producer, bootstrapper, this.context, initPosition); bootstrapper.resume(producer, replicator); replicator.setFilter(context.getFilter()); this.context.start(); this.onReplicatorStart(); String lagGaugeName = MetricRegistry.name(MaxwellMetrics.getMetricsPrefix(), "replication", "lag"); if ( !(MaxwellMetrics.metricRegistry.getGauges().containsKey(lagGaugeName)) ) { MaxwellMetrics.metricRegistry.register( lagGaugeName, new Gauge<Long>() { @Override public Long getValue() { return replicator.getReplicationLag(); } } ); } replicator.runLoop(); }