Skip to content

Commit

Permalink
Merge branch 'master' into metric
Browse files Browse the repository at this point in the history
  • Loading branch information
vancexu authored Jan 2, 2018
2 parents 37ed07c + 8a89e91 commit beba8a5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
6 changes: 4 additions & 2 deletions common/mocks/ExecutionManagerFactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@

package mocks

import "github.com/uber/cadence/common/persistence"
import "github.com/stretchr/testify/mock"
import (
"github.com/stretchr/testify/mock"
"github.com/uber/cadence/common/persistence"
)

// ExecutionManagerFactory is an autogenerated mock type for the ExecutionManagerFactory type
type ExecutionManagerFactory struct {
Expand Down
10 changes: 3 additions & 7 deletions common/persistence/cassandraPersistenceClientFactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
cluster := common.NewCassandraCluster(hosts, port, user, password, dc)
cluster.Keyspace = keyspace
cluster.ProtoVersion = cassandraProtoVersion
Expand All @@ -51,7 +51,7 @@ func NewCassandraPersistenceClientFactory(hosts string, port int, user, password
return nil, err
}

return &cassandraPersistenceClientFactory{session: session, metricsClient: mClient, logger: logger}, nil
return &cassandraPersistenceClientFactory{session: session, logger: logger, metricsClient: metricsClient}, nil
}

// CreateExecutionManager implements ExecutionManagerFactory interface
Expand All @@ -66,11 +66,7 @@ func (f *cassandraPersistenceClientFactory) CreateExecutionManager(shardID int)
return mgr, nil
}

tags := map[string]string{
metrics.ShardTagName: metrics.AllShardsTagValue,
}
return NewWorkflowExecutionPersistenceClient(
mgr, f.metricsClient.Tagged(tags)), nil
return NewWorkflowExecutionPersistenceClient(mgr, f.metricsClient), nil
}

// Close releases the underlying resources held by this object
Expand Down
1 change: 0 additions & 1 deletion service/history/historyEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ type (
historyEventNotifier historyEventNotifier
tokenSerializer common.TaskTokenSerializer
hSerializerFactory persistence.HistorySerializerFactory
metricsReporter metrics.Client
historyCache *historyCache
domainCache cache.DomainCache
metricsClient metrics.Client
Expand Down
3 changes: 2 additions & 1 deletion service/history/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ func (s *Service) Start() {
p.CassandraConfig.Keyspace,
s.config.ExecutionMgrNumConns,
p.Logger,
base.GetMetricsClient())
s.metricsClient,
)
if err != nil {
log.Fatalf("Creating Cassandra execution manager persistence factory failed: %v", err)
}
Expand Down
6 changes: 2 additions & 4 deletions service/history/shardContext.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,7 @@ func acquireShard(shardID int, shardManager persistence.ShardManager, historyMgr
shardInfo := response.ShardInfo
updatedShardInfo := copyShardInfo(shardInfo)
updatedShardInfo.Owner = owner
tags := map[string]string{
metrics.ShardTagName: metrics.AllShardsTagValue,
}

context := &shardContextImpl{
shardID: shardID,
shardManager: shardManager,
Expand All @@ -474,7 +472,7 @@ func acquireShard(shardID int, shardManager persistence.ShardManager, historyMgr
domainCache: domainCache,
shardInfo: updatedShardInfo,
closeCh: closeCh,
metricsClient: metricsClient.Tagged(tags),
metricsClient: metricsClient,
config: config,
}
context.logger = logger.WithFields(bark.Fields{
Expand Down
4 changes: 2 additions & 2 deletions service/history/shardController.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

executionMgr, err := executionMgrFactory.CreateExecutionManager(shardID)
if err != nil {
Expand All @@ -128,7 +128,7 @@ func newHistoryShardsItem(shardID int, shardMgr persistence.ShardManager, histor
logger: logger.WithFields(bark.Fields{
logging.TagHistoryShardID: shardID,
}),
metricsClient: reporter,
metricsClient: metricsClient,
}, nil
}

Expand Down

0 comments on commit beba8a5

Please sign in to comment.