Documentation
¶
Overview ¶
Package segmentobs observes the resolvers of the dynamic segments for Prometheus.
The default series carry the connection (a name of the bootstrap file, a handful) and bounded enums (result, reason), never a flag set, a segment, a member or a key. The series per segment name are opt-in and capped: the names beyond the cap share the series of one bucket, OtherSegment.
The observer of a connection counts with atomics only: no lock and no allocation on the evaluation path. The per-segment series take a read lock once for each segment of a call, and only when they are enabled.
Index ¶
Constants ¶
const ( MetricLookups = "semaphore_segment_lookups_total" MetricDuration = "semaphore_segment_lookup_duration_seconds" MetricUnknown = "semaphore_segment_unknown_total" MetricNamed = "semaphore_segment_named_lookups_total" MetricNamedUnk = "semaphore_segment_named_unknown_total" MetricOverflow = "semaphore_segment_named_overflow_total" )
The series of the observers.
const ( // DefaultMaxSegments is the cap of distinct segment names of the per-segment series. DefaultMaxSegments = 100 // OtherSegment is the value of the segment label for the names beyond the cap. OtherSegment = "other" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnObserver ¶
ConnObserver counts the calls of the resolvers of one connection. The embedded counters count with atomics only, so a call takes no lock and allocates nothing; the segments are added to the per-segment series when they are on.
func (*ConnObserver) ObserveSegment ¶
func (c *ConnObserver) ObserveSegment(obs resolver.SegmentObservation)
ObserveSegment implements resolver.Observer.
type Observers ¶
type Observers struct {
// contains filtered or unexported fields
}
Observers is the source of the observers of the resolvers: one for each connection. It is also the Prometheus collector of what they count.
func (*Observers) Collect ¶
Collect implements prom.Collector.
func (*Observers) Describe ¶
Describe implements prom.Collector.
func (*Observers) For ¶
func (o *Observers) For(connection string) *ConnObserver
For returns the observer of the resolvers of a connection. The same connection gets the same observer. It is meant for the build of a binding, never for the evaluation path.
func (*Observers) SetLive ¶
SetLive tells which segment names are live (defined by the segments objects that are served): only these, up to the cap and in sorted order, have a series by segment name; a name that is gone loses its series. It is called when a generation is applied. It does nothing when the per-segment series are off.