Skip to content

Conversation

@JiriCtvrtka
Copy link
Contributor

@JiriCtvrtka JiriCtvrtka commented Nov 14, 2025

@JiriCtvrtka JiriCtvrtka force-pushed the PMM-14431-mongo-count-mismatch branch from d56ff3c to c9afe29 Compare November 18, 2025 09:57
@percona percona deleted a comment from github-actions bot Nov 18, 2025
return res
}

func handleMetricSwitch(reservedNames []string, prefix, nextPrefix, k string, val interface{}, l map[string]string, compatibleMode bool) []prometheus.Metric {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci-lint] reported by reviewdog 🐶
calculated cyclomatic complexity for function handleMetricSwitch is 12, max is 10 (cyclop)

@JiriCtvrtka JiriCtvrtka changed the title PMM-14431 More complex check if it is real count or not. PMM-14431 More complex check if it is real count type or not. Nov 18, 2025
@JiriCtvrtka JiriCtvrtka marked this pull request as ready for review November 18, 2025 17:52
@JiriCtvrtka JiriCtvrtka requested a review from a team as a code owner November 18, 2025 17:52
@JiriCtvrtka JiriCtvrtka requested review from BupycHuk, ademidoff and idoqo and removed request for a team November 18, 2025 17:52
Copy link
Member

@ademidoff ademidoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing GetAllIndexesForCollections being called in multiple collectors. This call is rather expensive. Would it be beneficial to cache it for a short period of time?

if err != nil {
continue // skip collections where indexes cannot be listed (e.g., views, system collections)
}
defer cursor.Close(ctx) //nolint:errcheck
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this would be the best to run defer in a loop within this context. Can we declare the cursor variable outside of the loop and defer once?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Moved to the end since there are multiple cursors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants