Skip to content

Commit

Permalink
Rename metric to avoid unnecessary name
Browse files Browse the repository at this point in the history
- also fix a comment

Issue: BB-601
  • Loading branch information
williamlardier committed Sep 19, 2024
1 parent ccd7d42 commit 7396ddc
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion extensions/oplogPopulator/OplogPopulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class OplogPopulator {
this._allocationStrategy.onConnectorUpdatedOrDestroyed(connector));
this._allocator.on(constants.bucketRemovedFromConnectorEvent, (bucket, connector) =>
this._allocationStrategy.onBucketRemoved(bucket, connector));
this._connectorsManager.on('connectors-reconciled', bucketsExceedingLimit => {
this._connectorsManager.on(constants.connectorsReconciledEvent, bucketsExceedingLimit => {
this._metricsHandler.onConnectorsReconciled(
bucketsExceedingLimit,
this._allocationStrategy.retainedBucketsCount,
Expand Down
4 changes: 2 additions & 2 deletions extensions/oplogPopulator/OplogPopulatorMetrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ class OplogPopulatorMetrics {
labelNames: ['connector'],
});
this.bucketsExceedingLimit = ZenkoMetrics.createGauge({

Check warning on line 36 in extensions/oplogPopulator/OplogPopulatorMetrics.js

View check run for this annotation

Codecov / codecov/patch/Backbeat

extensions/oplogPopulator/OplogPopulatorMetrics.js#L36

Added line #L36 was not covered by tests
name: 's3_oplog_populator_connector_buckets_exceeding_limit',
name: 's3_oplog_populator_buckets_exceeding_limit',
help: 'Total number of buckets exceeding the limit for all connectors',
});
this.retainedBuckets = ZenkoMetrics.createGauge({

Check warning on line 40 in extensions/oplogPopulator/OplogPopulatorMetrics.js

View check run for this annotation

Codecov / codecov/patch/Backbeat

extensions/oplogPopulator/OplogPopulatorMetrics.js#L40

Added line #L40 was not covered by tests
name: 's3_oplog_populator_connector_retained_buckets',
name: 's3_oplog_populator_retained_buckets',
help: 'Current number of buckets still listened to by immutable connectors despite intended removal',
});
this.requestSize = ZenkoMetrics.createCounter({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class RetainBucketsDecorator extends AllocationStrategy {
super(params);
this._strategy = strategy;

// Stores buckets that should are removed from the connector
// Stores buckets that should be removed from the connector
// but still in use
this._retainedBuckets = new Map();
}
Expand Down
1 change: 1 addition & 0 deletions extensions/oplogPopulator/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const constants = {
mongodbVersionWithImmutablePipelines: '6.0.0',
connectorUpdatedEvent: 'connector-updated',
bucketRemovedFromConnectorEvent: 'bucket-removed',
connectorsReconciledEvent: 'connectors-reconciled',
defaultConnectorConfig: {
'connector.class': 'com.mongodb.kafka.connect.MongoSourceConnector',
'pipeline': '[]',
Expand Down
2 changes: 1 addition & 1 deletion extensions/oplogPopulator/modules/ConnectorsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class ConnectorsManager extends EventEmitter {
});
}
});
this.emit('connectors-reconciled', bucketsExceedingLimit);
this.emit(constants.connectorsReconciledEvent, bucketsExceedingLimit);
if (Object.keys(connectorsStatus).length > 0) {
this._logger.info('Successfully updated connectors', {
method: 'ConnectorsManager._updateConnectors',
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/oplogPopulator/oplogPopulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ describe('OplogPopulator', () => {
assert(setMetastoreChangeStreamStub.calledOnce);
assert(initializeConnectorsManagerStub.calledOnce);
const onConnectorsReconciledStub = sinon.stub(oplogPopulator._metricsHandler, 'onConnectorsReconciled');
oplogPopulator._connectorsManager.emit('connectors-reconciled');
oplogPopulator._connectorsManager.emit(constants.connectorsReconciledEvent);
assert(onConnectorsReconciledStub.calledOnce);
});
});
Expand Down

0 comments on commit 7396ddc

Please sign in to comment.