Skip to content

[CLI/API] Return more information for describeCluster API/command #6694

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions common/types/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ type DescribeClusterResponse struct {
SupportedClientVersions *SupportedClientVersions `json:"supportedClientVersions,omitempty"`
MembershipInfo *MembershipInfo `json:"membershipInfo,omitempty"`
PersistenceInfo map[string]*PersistenceInfo `json:"persistenceInfo,omitempty"`
SchemaVersion string `json:"schemaVersion,omitempty"`
StaticConfig Any `json:"staticConfig,omitempty"` // Dont know what type to return here , should I make a new type for this?
}

// AdminDescribeWorkflowExecutionRequest is an internal type (TBD...)
Expand Down
29 changes: 29 additions & 0 deletions service/frontend/admin/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/uber/cadence/common/client"
"github.com/uber/cadence/common/clock"
"github.com/uber/cadence/common/codec"
"github.com/uber/cadence/common/config"
"github.com/uber/cadence/common/definition"
"github.com/uber/cadence/common/domain"
dc "github.com/uber/cadence/common/dynamicconfig"
Expand Down Expand Up @@ -899,6 +900,24 @@ func (adh *adminHandlerImpl) DescribeCluster(
membershipInfo.Rings = rings
}

__ := &config.Persistence{
DefaultStore: "nosql",
DataStores: map[string]config.DataStore{
"nosql": {
NoSQL: &config.NoSQL{},
},
},
// All configs
}

/* db = db.connection and read schema version from there
db, err := sql.NewSQLAdminDB(cfg)
if err != nil {
return nil, err
}
*/


return &types.DescribeClusterResponse{
SupportedClientVersions: &types.SupportedClientVersions{
GoSdk: client.SupportedGoSDKVersion,
Expand All @@ -909,6 +928,8 @@ func (adh *adminHandlerImpl) DescribeCluster(
"visibilityStore": &visibilityStoreInfo,
"historyStore": &historyStoreInfo,
},
SchemaVersion: "1",
StaticConfig: types.Any{},
}, nil
}

Expand Down Expand Up @@ -1844,3 +1865,11 @@ func convertFilterListToMap(filters []*types.DynamicConfigFilter) (map[dc.Filter
}
return newFilters, nil
}

func (adh *adminHandlerImpl) getPersistenceInfo() *PersistenceInfo {
// Fetch schema version from the persistence layer
schemaVer, _ := adh.persistenceManager.GetSchemaVersion()
return &PersistenceInfo{
Version: schemaVer,
}
}