Skip to content
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

Updates gazette_shard_read_head tracking #309

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

michaelschiff
Copy link
Collaborator

@michaelschiff michaelschiff commented Oct 29, 2021

Moves into client/resolver so that we can manage the life-cycle of the gauge with the shard it is measuring


This change is Reviewable

…king of this gauge value in consumer/transaction.go - Instead, exporting this metric via the Collector implemented in consumer/resolver.go means that this stats life-cycle on the process matches that of the shard.
Copy link
Contributor

@jgraettinger jgraettinger left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 3 files at r1, all commit messages.
Reviewable status: 2 of 3 files reviewed, 3 unresolved discussions (waiting on @jgraettinger and @michaelschiff)


consumer/interfaces.go, line 304 at r1 (raw file):

		[]string{"shard", "status"}, nil)

	shardReadHeadDesc = prometheus.NewDesc(

nit: go fmt? different spacing here.


consumer/resolver.go, line 394 at r1 (raw file):

// Collect implements prometheus.Collector
func (r *Resolver) Collect(ch chan<- prometheus.Metric) {
	r.state.KS.Mu.RLock()

I'm a little concerned about the scope of this lock. Particularly if the reader of this channel is popping off metrics and streaming them into an http response (which is probably how I would do it). In that case, a slow or broken metrics client peer could cause the lock to be held indefinitely.

I'm thinking this should allocate into an intermediate state it intends to send, and then actually send that state to |ch| without holding any locks.


consumer/resolver.go, line 405 at r1 (raw file):

			status.Code.String())

		for j,o := range shard.progress.readThrough {

You'll need guard against a concurrent update from the completion of a consumer transaction. Call shard.Progress() to get an owned copy?

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.

None yet

2 participants