Skip to content

Collect SnippetsFilter information #2677

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

Merged
merged 11 commits into from
Oct 16, 2024
Prev Previous commit
Next Next commit
Refactor map range cluases
  • Loading branch information
bjee19 committed Oct 16, 2024
commit 84fa60dc3838a5a1d51eb09089be79e82ce1fcda
10 changes: 3 additions & 7 deletions internal/mode/static/telemetry/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,16 +416,14 @@ func collectSnippetsFilterSnippetsInfo(graphGetter GraphGetter) ([]string, []int

contextDirectiveMap := make(map[sfContextDirective]int)

for name := range g.SnippetsFilters {
sf := g.SnippetsFilters[name]
for _, sf := range g.SnippetsFilters {
if sf == nil {
continue
}

for nginxContext := range sf.Snippets {
snippetValue := sf.Snippets[nginxContext]

for nginxContext, snippetValue := range sf.Snippets {
var parsedContext string

switch nginxContext {
case ngfAPI.NginxContextMain:
parsedContext = "main"
Expand All @@ -440,13 +438,11 @@ func collectSnippetsFilterSnippetsInfo(graphGetter GraphGetter) ([]string, []int
}

directives := parseSnippetValueIntoDirectives(snippetValue)

for _, directive := range directives {
contextDirective := sfContextDirective{
context: parsedContext,
directive: directive,
}

contextDirectiveMap[contextDirective]++
}
}
Expand Down