Skip to content

patch: runtime: add metrics for timers #141

Description

@bradfitz

We're adding metrics to our Go fork temporarily to let us have visibility into pending timers.

per https://groups.google.com/g/golang-dev/c/pN-OyRKLx1c/m/drmJY3gGAAAJ

// TailscaleNumTimers returns the number of timers that are currently
// pending in the runtime across all Ps, as well as the number of "zombie"
// timers.
func TailscaleNumTimers() (total, zombies int) {
	var sum uint32
	var nzombies int32

	// Prevent allp slice changes. This is like retake.
	lock(&allpLock)
	for _, pp := range allp {
		if pp == nil {
			continue
		}
		sum += pp.timers.len.Load()
		nzombies += pp.timers.zombies.Load()
	}
	unlock(&allpLock)

	return int(sum), int(nzombies)
}

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions