(s blockSummary, settings heuristicSettings, numRowGroups int)
| 991 | } |
| 992 | |
| 993 | func printCliArgs(s blockSummary, settings heuristicSettings, numRowGroups int) { |
| 994 | fmt.Println("") |
| 995 | fmt.Printf("quoted/spaced cli list:") |
| 996 | |
| 997 | escapeString := func(s string) string { |
| 998 | return strings.ReplaceAll(s, "\"", "\\\"") |
| 999 | } |
| 1000 | |
| 1001 | doStringSummary := func(summary attributeSummary, scope traceql.AttributeScope) { |
| 1002 | for _, a := range topN(settings.NumStringAttr, summary.attributes) { |
| 1003 | if float64(a.cardinality.totalOccurrences())/float64(summary.rowCount) < settings.StrThresholdPercent { |
| 1004 | // Did not meet threshold |
| 1005 | continue |
| 1006 | } |
| 1007 | attrStr := traceql.NewScopedAttribute(scope, false, a.name).String() |
| 1008 | if settings.BlobThresholdBytes > 0 && a.cardinality.avgSizePerRowGroup(numRowGroups) > settings.BlobThresholdBytes { |
| 1009 | attrStr = "blob/" + attrStr |
| 1010 | } |
| 1011 | fmt.Printf("\"%s\" ", escapeString(attrStr)) |
| 1012 | } |
| 1013 | } |
| 1014 | |
| 1015 | doIntSummary := func(summary attributeSummary, scope traceql.AttributeScope) { |
| 1016 | for _, a := range topNInt(settings.NumIntAttr, summary.integerAttributes) { |
| 1017 | if float64(a.count)/float64(summary.rowCount) < settings.IntThresholdPercent { |
| 1018 | continue |
| 1019 | } |
| 1020 | attrStr := traceql.NewScopedAttribute(scope, false, a.name).String() |
| 1021 | fmt.Printf("\"%s\" ", escapeString(attrStr)) |
| 1022 | } |
| 1023 | } |
| 1024 | |
| 1025 | doStringSummary(s.spanSummary, traceql.AttributeScopeSpan) |
| 1026 | doStringSummary(s.resourceSummary, traceql.AttributeScopeResource) |
| 1027 | doStringSummary(s.eventSummary, traceql.AttributeScopeEvent) |
| 1028 | |
| 1029 | doIntSummary(s.spanSummary, traceql.AttributeScopeSpan) |
| 1030 | doIntSummary(s.resourceSummary, traceql.AttributeScopeResource) |
| 1031 | doIntSummary(s.eventSummary, traceql.AttributeScopeEvent) |
| 1032 | } |
| 1033 | |
| 1034 | func topN(n int, attrs map[string]*stringAttributeSummary) []*stringAttributeSummary { |
| 1035 | top := make([]*stringAttributeSummary, 0, len(attrs)) |
no test coverage detected