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

Initial implementation of the libp2p introspection server #1

Merged

Conversation

aarshkshah1992
Copy link
Contributor

@aarshkshah1992 aarshkshah1992 commented Jan 23, 2020

For libp2p/go-libp2p#775

This is the first draft of the introspection server.

@aarshkshah1992
Copy link
Contributor Author

aarshkshah1992 commented Jan 23, 2020

TODO

  • Release go-libp2p-core & configure the version here
  • Unit test the DefaultIntrospector
  • CircleCI config & makefile
  • CLI for easy testing of the server

@aarshkshah1992 aarshkshah1992 changed the title [WIP] libp2p Introspection module Libp2p Introspection server Jan 23, 2020
@aarshkshah1992 aarshkshah1992 changed the base branch from master to feat/introspection January 23, 2020 12:03
Copy link
Member

@raulk raulk left a comment

Choose a reason for hiding this comment

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

Would like to see what the fetch logic ends up looking like after integrating my review comments from libp2p/go-libp2p-core#107. Besides that, nothing controversial here so far.

@aarshkshah1992
Copy link
Contributor Author

@raulk The new fetch logic is up.

@aarshkshah1992
Copy link
Contributor Author

@raulk Please can you explain how to determine State.StartTs & State.SnapshotDurationMs

sids = append(sids, introspect.StreamID(s))
}

sl, err := d.tree.Stream(introspect.StreamQueryParams{introspect.QueryOutputFull, sids})
Copy link
Member

Choose a reason for hiding this comment

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

This is fine for now, but we could further optimise this by collecting all stream IDs from all connections, and fetching them all at once, then merging them into the appropriate connections. Could you file an issue to optimise this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in #5


// start server
serverInstance := http.Server{
// TODO Need a better strategy to select an address
Copy link
Member

Choose a reason for hiding this comment

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

Let's make sure this doesn't fall off the radar by opening an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in #6

type DefaultIntrospector struct {
treeMu sync.RWMutex
tree *introspect.DataProviders
listenAddr []string
Copy link
Member

Choose a reason for hiding this comment

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

Modified this variable name.

}
}

func wsUpgrader(introspector introspect.Introspector) http.HandlerFunc {
Copy link
Member

Choose a reason for hiding this comment

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

Renamed this method.

}

// send the response
wsConn.SetWriteDeadline(time.Now().Add(10 * time.Second))
Copy link
Member

Choose a reason for hiding this comment

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

Increased the timeout here.

github.com/gorilla/websocket v1.4.1
github.com/imdario/mergo v0.3.8
github.com/ipfs/go-log v1.0.1
github.com/libp2p/go-libp2p-core v0.3.1-0.20200206170018-fbc69c15df4c
Copy link
Member

Choose a reason for hiding this comment

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

This import was missing. It's locked to a commit, but it's fine for now.

@raulk raulk changed the title Libp2p Introspection server Initial implementation of the libp2p introspection server Feb 6, 2020
@raulk raulk merged commit addc1fa into libp2p:feat/introspection Feb 6, 2020
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.

2 participants