This repository was archived by the owner on Aug 23, 2023. It is now read-only.
File tree 1 file changed +25
-23
lines changed
1 file changed +25
-23
lines changed Original file line number Diff line number Diff line change @@ -170,31 +170,33 @@ func main() {
170
170
shown := 0
171
171
172
172
for _ , d := range defs {
173
- if prefix == "" || strings .HasPrefix (d .Metric , prefix ) {
174
- if substr == "" || strings .Contains (d .Metric , substr ) {
175
- if tags != "" {
176
- if tags == "none" && len (d .Tags ) != 0 {
177
- continue
178
- }
179
- if tags == "some" && len (d .Tags ) == 0 {
180
- continue
181
- }
182
- if tags == "valid" || tags == "invalid" {
183
- valid := schema .ValidateTags (d .Tags )
184
-
185
- // skip the metric if the validation result is not what we want
186
- if valid != (tags == "valid" ) {
187
- continue
188
- }
189
- }
190
- }
191
- show (d )
192
- shown += 1
193
- if shown == limit {
194
- break
195
- }
173
+ // note that prefix and substr can be "", meaning filter disabled.
174
+ // the conditions handle this fine as well.
175
+ if ! strings .HasPrefix (d .Metric , prefix ) {
176
+ continue
177
+ }
178
+ if ! strings .Contains (d .Metric , substr ) {
179
+ continue
180
+ }
181
+ if tags == "none" && len (d .Tags ) != 0 {
182
+ continue
183
+ }
184
+ if tags == "some" && len (d .Tags ) == 0 {
185
+ continue
186
+ }
187
+ if tags == "valid" || tags == "invalid" {
188
+ valid := schema .ValidateTags (d .Tags )
189
+
190
+ // skip the metric if the validation result is not what we want
191
+ if valid != (tags == "valid" ) {
192
+ continue
196
193
}
197
194
}
195
+ show (d )
196
+ shown += 1
197
+ if shown == limit {
198
+ break
199
+ }
198
200
}
199
201
200
202
if verbose {
You can’t perform that action at this time.
0 commit comments