Skip to content

Commit a6221c6

Browse files
author
Tim Middleton
authored
Add -q option to get cache-storage to show full query (#294)
1 parent 858fb9a commit a6221c6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pkg/cmd/cache.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ var (
3434
cannotFindCache = "no cache named %s exists for service %s"
3535
cannotFindViewCache = "no view cache named %s exists for service %s"
3636
cacheSummary bool
37+
showQueryParam bool
3738
)
3839

3940
const (
@@ -1186,6 +1187,7 @@ func init() {
11861187
getCacheStoresCmd.Flags().StringVarP(&serviceName, serviceNameOption, serviceNameOptionShort, "", serviceNameDescription)
11871188
getCacheAccessCmd.Flags().StringVarP(&serviceName, serviceNameOption, serviceNameOptionShort, "", serviceNameDescription)
11881189
getCacheStorageCmd.Flags().StringVarP(&serviceName, serviceNameOption, serviceNameOptionShort, "", serviceNameDescription)
1190+
getCacheStorageCmd.Flags().BoolVarP(&showQueryParam, "query", "q", false, "show query details in full")
11891191
getCacheIndexesCmd.Flags().StringVarP(&serviceName, serviceNameOption, serviceNameOptionShort, "", serviceNameDescription)
11901192
getCachePartitionsCmd.Flags().StringVarP(&serviceName, serviceNameOption, serviceNameOptionShort, "", serviceNameDescription)
11911193
getCachePartitionsCmd.Flags().BoolVarP(&cacheSummary, "summary", "S", false, "show a cache summary")

pkg/cmd/formatting.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,13 +1007,18 @@ func FormatCacheDetailsStorage(cacheDetails []config.CacheDetail) string {
10071007
var (
10081008
detailsCount = len(cacheDetails)
10091009
formattingFunction = getFormattingFunction()
1010+
maxLength = 40
10101011
)
10111012
if detailsCount == 0 {
10121013
return ""
10131014
}
10141015

1016+
if showQueryParam {
1017+
maxLength = 250
1018+
}
1019+
10151020
table := newFormattedTable().WithHeader(NodeIDColumn, "TIER", "LOCKS GRANTED", "LOCKS PENDING", "KEY LISTENERS",
1016-
"FILTER LISTENERS", "MAX QUERY MS", "MAX QUERY DESC").MaxLength(40).WithSortingColumn(NodeIDColumn)
1021+
"FILTER LISTENERS", "MAX QUERY MS", "MAX QUERY DESC").MaxLength(maxLength).WithSortingColumn(NodeIDColumn)
10171022

10181023
if OutputFormat == constants.WIDE {
10191024
table.AddHeaderColumns("NO OPT AVG", "OPT AVG", "INDEX SIZE", "INDEXING MILLIS")

0 commit comments

Comments
 (0)