-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: metrics client is initialized 2 times per shard #484
Conversation
Where is the 2 times initialization in old implementation? |
@vancexu cassandraPersistenceClientFactory.go and shardContext.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you verify your fix would solve #477?
It seems we could simply tag the reporter in newShardController() and remove the other 2 places without these refactoring change?
BTW, why do we need the tag? How is that used?
@yiminc A2 & A3: since the tagged metrics client is per shard (from the original code), i assume that we need to continue to do that. |
@@ -94,7 +94,7 @@ func (s *shardControllerSuite) TestAcquireShardSuccess() { | |||
if hostID == 0 { | |||
myShards = append(myShards, shardID) | |||
mockExecutionMgr := &mmocks.ExecutionManager{} | |||
s.mockExecutionMgrFactory.On("CreateExecutionManager", mock.Anything).Return(mockExecutionMgr, nil).Once() | |||
s.mockExecutionMgrFactory.On("CreateExecutionManager", mock.Anything, mock.Anything).Return(mockExecutionMgr, nil).Once() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you still need this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch
logger bark.Logger | ||
metricsClient metrics.Client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need this field, so the factory can use the metrics client if provided
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -214,7 +214,8 @@ func (s *Service) Start() { | |||
p.CassandraConfig.Keyspace, | |||
s.config.ExecutionMgrNumConns, | |||
p.Logger, | |||
base.GetMetricsClient()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this method do? Should it be removed if no longer used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@madhuravi
this is actually referenced at line 138:
https://github.com/uber/cadence/pull/484/files/b41eff2eeeca590eba88c5cb7ef67de7977ac034#diff-48531afaf74492193b35d730980b6ecdR138
@@ -107,7 +107,7 @@ func newShardController(host *membership.HostInfo, resolver membership.ServiceRe | |||
|
|||
func newHistoryShardsItem(shardID int, shardMgr persistence.ShardManager, historyMgr persistence.HistoryManager, | |||
metadataMgr persistence.MetadataManager, executionMgrFactory persistence.ExecutionManagerFactory, factory EngineFactory, | |||
host *membership.HostInfo, config *Config, logger bark.Logger, reporter metrics.Client) (*historyShardsItem, error) { | |||
host *membership.HostInfo, config *Config, logger bark.Logger, metricsClient metrics.Client) (*historyShardsItem, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: revert this as well.
@@ -37,7 +37,7 @@ type ( | |||
|
|||
// NewCassandraPersistenceClientFactory is used to create an instance of ExecutionManagerFactory implementation | |||
func NewCassandraPersistenceClientFactory(hosts string, port int, user, password, dc string, keyspace string, | |||
numConns int, logger bark.Logger, mClient metrics.Client) (ExecutionManagerFactory, error) { | |||
numConns int, logger bark.Logger, metricsClient metrics.Client) (ExecutionManagerFactory, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: revert this
solves #477