Skip to content

Commit

Permalink
Remove EmitMetric option from the CLI #2380 (#3029)
Browse files Browse the repository at this point in the history
* Remove EmitMetric option from the CLI

* Mark properties related to EmitMetric to be deprecated.

* Remove usage of unused variables and set default value of EmitMetric to be true.

* Change the default value of emitmetric flag in the unit tests to be true.

* Change the default value of emitmetric flag in the unit test to be true.

* Remove the option from test of UpdateDomain

* Remove extra argument in the test.

* Pull changes from master and merge.

* Missing file commit
  • Loading branch information
luowenking1 authored Feb 14, 2020
1 parent d613cde commit cb5da71
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 40 deletions.
26 changes: 17 additions & 9 deletions .gen/go/shared/shared.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion common/domain/handler_GlobalDomainDisabled_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (s *domainHandlerGlobalDomainDisabledSuite) TestRegisterGetDomain_AllDefaul
}, resp.DomainInfo)
s.Equal(&shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention),
EmitMetric: common.BoolPtr(false),
EmitMetric: common.BoolPtr(true),
HistoryArchivalStatus: shared.ArchivalStatusDisabled.Ptr(),
HistoryArchivalURI: common.StringPtr(""),
VisibilityArchivalStatus: shared.ArchivalStatusDisabled.Ptr(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (s *domainHandlerGlobalDomainEnabledMasterClusterSuite) TestRegisterGetDoma
}, resp.DomainInfo)
s.Equal(&shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention),
EmitMetric: common.BoolPtr(false),
EmitMetric: common.BoolPtr(true),
HistoryArchivalStatus: shared.ArchivalStatusDisabled.Ptr(),
HistoryArchivalURI: common.StringPtr(""),
VisibilityArchivalStatus: shared.ArchivalStatusDisabled.Ptr(),
Expand Down Expand Up @@ -473,7 +473,7 @@ func (s *domainHandlerGlobalDomainEnabledMasterClusterSuite) TestRegisterGetDoma
}, resp.DomainInfo)
s.Equal(&shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention),
EmitMetric: common.BoolPtr(false),
EmitMetric: common.BoolPtr(true),
HistoryArchivalStatus: shared.ArchivalStatusDisabled.Ptr(),
HistoryArchivalURI: common.StringPtr(""),
VisibilityArchivalStatus: shared.ArchivalStatusDisabled.Ptr(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (s *domainHandlerGlobalDomainEnabledNotMasterClusterSuite) TestRegisterGetD
}, resp.DomainInfo)
s.Equal(&shared.DomainConfiguration{
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention),
EmitMetric: common.BoolPtr(false),
EmitMetric: common.BoolPtr(true),
HistoryArchivalStatus: shared.ArchivalStatusDisabled.Ptr(),
HistoryArchivalURI: common.StringPtr(""),
VisibilityArchivalStatus: shared.ArchivalStatusDisabled.Ptr(),
Expand Down
2 changes: 1 addition & 1 deletion common/persistence/persistenceInterface.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ type (
InternalDomainConfig struct {
// NOTE: this retention is in days, not in seconds
Retention int32
EmitMetric bool
EmitMetric bool // deprecated
ArchivalBucket string // deprecated
ArchivalStatus workflow.ArchivalStatus // deprecated
HistoryArchivalStatus workflow.ArchivalStatus
Expand Down
2 changes: 1 addition & 1 deletion idls
Submodule idls updated 1 files
+1 −1 thrift/shared.thrift
2 changes: 1 addition & 1 deletion tools/cli/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (s *cliAppSuite) TestDomainUpdate() {
s.serverFrontendClient.EXPECT().UpdateDomain(gomock.Any(), gomock.Any()).Return(nil, nil).Times(2)
err := s.app.Run([]string{"", "--do", domainName, "domain", "update"})
s.Nil(err)
err = s.app.Run([]string{"", "--do", domainName, "domain", "update", "--desc", "another desc", "--oe", "another@uber.com", "--rd", "1", "--em", "f"})
err = s.app.Run([]string{"", "--do", domainName, "domain", "update", "--desc", "another desc", "--oe", "another@uber.com", "--rd", "1"})
s.Nil(err)
}

Expand Down
15 changes: 1 addition & 14 deletions tools/cli/domainCommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,8 @@ func (d *domainCLIImpl) RegisterDomain(c *cli.Context) {
retentionDays = c.Int(FlagRetentionDays)
}
securityToken := c.String(FlagSecurityToken)
emitMetric := false
var err error
if c.IsSet(FlagEmitMetric) {
emitMetric, err = strconv.ParseBool(c.String(FlagEmitMetric))
if err != nil {
ErrorAndExit(fmt.Sprintf("Option %s format is invalid.", FlagEmitMetric), err)
}
}

var isGlobalDomainPtr *bool
if c.IsSet(FlagIsGlobalDomain) {
isGlobalDomain, err := strconv.ParseBool(c.String(FlagIsGlobalDomain))
Expand Down Expand Up @@ -135,7 +129,6 @@ func (d *domainCLIImpl) RegisterDomain(c *cli.Context) {
OwnerEmail: common.StringPtr(ownerEmail),
Data: domainData,
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(int32(retentionDays)),
EmitMetric: common.BoolPtr(emitMetric),
Clusters: clusters,
ActiveClusterName: activeClusterName,
SecurityToken: common.StringPtr(securityToken),
Expand Down Expand Up @@ -214,12 +207,6 @@ func (d *domainCLIImpl) UpdateDomain(c *cli.Context) {
if c.IsSet(FlagRetentionDays) {
retentionDays = int32(c.Int(FlagRetentionDays))
}
if c.IsSet(FlagEmitMetric) {
emitMetric, err = strconv.ParseBool(c.String(FlagEmitMetric))
if err != nil {
ErrorAndExit(fmt.Sprintf("Option %s format is invalid.", FlagEmitMetric), err)
}
}
if c.IsSet(FlagClusters) {
clusterStr := c.String(FlagClusters)
clusters = append(clusters, &shared.ClusterReplicationConfiguration{
Expand Down
8 changes: 0 additions & 8 deletions tools/cli/domainUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ var (
Name: FlagRetentionDaysWithAlias,
Usage: "Workflow execution retention in days",
},
cli.StringFlag{
Name: FlagEmitMetricWithAlias,
Usage: "Flag to emit metric",
},
cli.StringFlag{
Name: FlagActiveClusterNameWithAlias,
Usage: "Active cluster name",
Expand Down Expand Up @@ -119,10 +115,6 @@ var (
Name: FlagRetentionDaysWithAlias,
Usage: "Workflow execution retention in days",
},
cli.StringFlag{
Name: FlagEmitMetricWithAlias,
Usage: "Flag to emit metric",
},
cli.StringFlag{
Name: FlagActiveClusterNameWithAlias,
Usage: "Active cluster name",
Expand Down
2 changes: 0 additions & 2 deletions tools/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ const (
FlagOwnerEmailWithAlias = FlagOwnerEmail + ", oe"
FlagRetentionDays = "retention"
FlagRetentionDaysWithAlias = FlagRetentionDays + ", rd"
FlagEmitMetric = "emit_metric"
FlagEmitMetricWithAlias = FlagEmitMetric + ", em"
FlagHistoryArchivalStatus = "history_archival_status"
FlagHistoryArchivalStatusWithAlias = FlagHistoryArchivalStatus + ", has"
FlagHistoryArchivalURI = "history_uri"
Expand Down

0 comments on commit cb5da71

Please sign in to comment.