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

On demand peer based metrics #296

Closed
hannahhoward opened this issue Dec 3, 2021 · 0 comments · Fixed by #298
Closed

On demand peer based metrics #296

hannahhoward opened this issue Dec 3, 2021 · 0 comments · Fixed by #298
Assignees
Labels
need/triage Needs initial labeling and prioritization

Comments

@hannahhoward
Copy link
Collaborator

What

We want to get an on-demand close look into what is going on for a given graphsync peer. We'll probably use this initially to build an admin endpoint in Estuary to see what we can learn about a given peer.

Sample API (feel free to modify though this should be a good shape to start from):

in root graphsync.go

type RequestState uint64

const (
	Queued RequestState = iota
	Running
	Paused
)

type PeerRequest interface {
	RequestData
	State() RequestState
}

// PeerStats describes the state of graphsync for a given
type PeerStats struct {
	// OutgoingRequests
	OutgoingRequests []PeerRequest
	// IncomingRequests
	IncomingRequests []PeerRequest
}

// GraphExchange is a protocol that can exchange IPLD graphs based on a selector
type GraphExchange interface {
        // ...
        // existing methods
        // ...
        
	// PeerStats produces insight on the current state of a given peer
	PeerStats(p peer.ID) PeerStats
}

Implementation

What we probably want is a new method on RequestManager and ResponseManager, which will need a new message into the system, that will result in a new server method on each that assembles the data from the inProgressStatus map. Unfortunately, this map is not sorted by peer id for the moment so we'll probably need to loop through the whole thing (sad face). We won't be calling this very much though so I'm not so worried.

For discussion

I am getting anxious about the amount of methods on the "GraphsyncExchange" interface. I am thinking we may want to start exposing some of these only on the impl/Graphsync struct, which is public, but folks will have to feature detect for that. I'm particularly concerned about methods like these, that we may or may not want to live by forever. I don't want to keep publishing them in places that indicate they should be used a lot. It seems like only putting them on impl/Graphsync and then having priviliged consumers (i.e. Estuary) to the check might make sense for now.

@hannahhoward hannahhoward added the need/triage Needs initial labeling and prioritization label Dec 3, 2021
@hannahhoward hannahhoward self-assigned this Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant