MCPcopy Create free account
hub / github.com/prometheus/common / nonZeroCount

Function nonZeroCount

config/http_config.go:377–386  ·  view source on GitHub ↗

nonZeroCount returns the amount of values that are non-zero.

(values ...T)

Source from the content-addressed store, hash-verified

375
376// nonZeroCount returns the amount of values that are non-zero.
377func nonZeroCount[T comparable](values ...T) int {
378 count := 0
379 var zero T
380 for _, value := range values {
381 if value != zero {
382 count++
383 }
384 }
385 return count
386}
387
388// Validate validates the HTTPClientConfig to check only one of BearerToken,
389// BasicAuth and BearerTokenFile is configured. It also validates that ProxyURL

Callers 2

ValidateMethod · 0.85
ValidateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…