Documentation ¶
Index ¶
- Constants
- Variables
- func AddContainerFilters(newFilters ...APITopologyOption)
- func NewVersion(version, downloadURL string)
- func RegisterControlRoutes(router *mux.Router, cr ControlRouter)
- func RegisterPipeRoutes(router *mux.Router, pr PipeRouter)
- func RegisterReportPostHandler(a Adder, router *mux.Router)
- func RegisterTopologyRoutes(router *mux.Router, r Reporter)
- func URLMatcher(pattern string) mux.MatcherFunc
- type APINode
- type APITopology
- type APITopologyDesc
- type APITopologyOption
- type APITopologyOptionGroup
- type Adder
- type Collector
- type ControlRouter
- type CtxHandlerFunc
- type DockerClient
- type End
- type Interface
- type InterfaceFunc
- type Merger
- type PipeRouter
- type Registry
- type Reporter
- type StaticCollector
- type WeaveClient
- type WeavePublisher
Constants ¶
const ( UIEnd = iota ProbeEnd )
Valid values of type End
const ( DefaultHostname = "scope.weave.local." DefaultWeaveURL = "http://127.0.0.1:6784" DefaultContainerName = "weavescope" DefaultDockerEndpoint = "unix:///var/run/docker.sock" )
Default values for weave app integration
const RequestCtxKey contextKey = contextKey("request")
RequestCtxKey is key used for request entry in context
Variables ¶
var ( // Version - set at buildtime. Version = "dev" // UniqueID - set at runtime. UniqueID = "0" )
Functions ¶
func AddContainerFilters ¶ added in v1.1.0
func AddContainerFilters(newFilters ...APITopologyOption)
AddContainerFilters adds to the default Registry (topologyRegistry)'s containerFilters
func NewVersion ¶ added in v0.15.0
func NewVersion(version, downloadURL string)
NewVersion is called to expose new version information to /api
func RegisterControlRoutes ¶
func RegisterControlRoutes(router *mux.Router, cr ControlRouter)
RegisterControlRoutes registers the various control routes with a http mux.
func RegisterPipeRoutes ¶
func RegisterPipeRoutes(router *mux.Router, pr PipeRouter)
RegisterPipeRoutes registers the pipe routes
func RegisterReportPostHandler ¶
RegisterReportPostHandler registers the handler for report submission
func RegisterTopologyRoutes ¶
RegisterTopologyRoutes registers the various topology routes with a http mux.
func URLMatcher ¶
func URLMatcher(pattern string) mux.MatcherFunc
URLMatcher uses request.RequestURI (the raw, unparsed request) to attempt to match pattern. It does this as go's URL.Parse method is broken, and mistakenly unescapes the Path before parsing it. This breaks %2F (encoded forward slashes) in the paths.
Types ¶
type APITopology ¶
type APITopology struct {
Nodes detailed.NodeSummaries `json:"nodes"`
}
APITopology is returned by the /api/topology/{name} handler.
type APITopologyDesc ¶
type APITopologyDesc struct { Name string `json:"name"` Rank int `json:"rank"` HideIfEmpty bool `json:"hide_if_empty"` Options []APITopologyOptionGroup `json:"options"` URL string `json:"url"` SubTopologies []APITopologyDesc `json:"sub_topologies,omitempty"` Stats topologyStats `json:"stats,omitempty"` // contains filtered or unexported fields }
APITopologyDesc is returned in a list by the /api/topology handler.
type APITopologyOption ¶
type APITopologyOption struct { Value string `json:"value"` Label string `json:"label"` // contains filtered or unexported fields }
APITopologyOption describes a ¶m=value to a given topology.
func MakeAPITopologyOption ¶ added in v1.1.0
func MakeAPITopologyOption(value string, label string, filterFunc render.FilterFunc, pseudo bool) APITopologyOption
MakeAPITopologyOption provides an external interface to the package for creating an APITopologyOption.
type APITopologyOptionGroup ¶ added in v0.14.0
type APITopologyOptionGroup struct { ID string `json:"id"` Default string `json:"defaultValue,omitempty"` Options []APITopologyOption `json:"options,omitempty"` }
APITopologyOptionGroup describes a group of APITopologyOptions
type Adder ¶
Adder is something that can accept reports. It's a convenient interface for parts of the app, and several experimental components. It takes the following arguments: - context.Context: the request context - report.Report: the deserialised report - []byte: the serialised report (as gzip'd msgpack)
type Collector ¶
A Collector is a Reporter and an Adder
func NewCollector ¶
NewCollector returns a collector ready for use.
func NewFileCollector ¶ added in v0.16.1
NewFileCollector reads and parses the given path, returning a collector which always returns that report.
type ControlRouter ¶ added in v0.13.0
type ControlRouter interface { Handle(ctx context.Context, probeID string, req xfer.Request) (xfer.Response, error) Register(ctx context.Context, probeID string, handler xfer.ControlHandlerFunc) (int64, error) Deregister(ctx context.Context, probeID string, id int64) error }
ControlRouter is a thing that can route control requests and responses between the UI and a probe.
func NewLocalControlRouter ¶ added in v0.13.0
func NewLocalControlRouter() ControlRouter
NewLocalControlRouter creates a new ControlRouter that does everything locally, in memory.
type CtxHandlerFunc ¶ added in v0.13.0
CtxHandlerFunc is a http.HandlerFunc, with added contexts
type DockerClient ¶ added in v0.13.0
type DockerClient interface {
ListContainers(fsouza.ListContainersOptions) ([]fsouza.APIContainers, error)
}
DockerClient is the little bit of the docker client we need.
type Interface ¶ added in v0.13.0
Interface is because net.Interface isn't mockable.
func Interfaces ¶ added in v0.13.0
Interfaces returns the list of Interfaces on the machine.
type InterfaceFunc ¶ added in v0.13.0
InterfaceFunc is the type of Interfaces()
type Merger ¶ added in v0.15.0
Merger is the type for a thing that can merge reports.
func MakeDumbMerger ¶ added in v0.15.0
func MakeDumbMerger() Merger
MakeDumbMerger makes a Merger which merges together reports in the simplest possible way.
func NewSmartMerger ¶ added in v0.15.0
func NewSmartMerger() Merger
NewSmartMerger makes a Merger which merges reports in parallel. Speed up comes from the fact that a) most merges are between small reports, and b) we take advantage of available cores.
type PipeRouter ¶
type PipeRouter interface { Exists(context.Context, string) (bool, error) Get(context.Context, string, End) (xfer.Pipe, io.ReadWriter, error) Release(context.Context, string, End) error Delete(context.Context, string) error Stop() }
PipeRouter stores pipes and allows you to connect to either end of them.
func NewLocalPipeRouter ¶ added in v0.13.0
func NewLocalPipeRouter() PipeRouter
NewLocalPipeRouter returns a new local (in-memory) pipe router.
type Registry ¶ added in v1.1.0
Registry is a threadsafe store of the available topologies
func MakeRegistry ¶ added in v1.1.0
func MakeRegistry() *Registry
MakeRegistry returns a new Registry
func (*Registry) Add ¶ added in v1.1.0
func (r *Registry) Add(ts ...APITopologyDesc)
Add inserts a topologyDesc to the Registry's items map
func (*Registry) AddContainerFilters ¶ added in v1.1.0
func (r *Registry) AddContainerFilters(newFilters ...APITopologyOption)
AddContainerFilters adds container filters to this Registry
type Reporter ¶
type Reporter interface { Report(context.Context) (report.Report, error) WaitOn(context.Context, chan struct{}) UnWait(context.Context, chan struct{}) }
Reporter is something that can produce reports on demand. It's a convenient interface for parts of the app, and several experimental components.
type StaticCollector ¶ added in v0.16.1
StaticCollector always returns the given report.
func (StaticCollector) Add ¶ added in v0.16.1
Add adds a report to the collector's internal state. It implements Adder.
func (StaticCollector) Report ¶ added in v0.16.1
Report returns a merged report over all added reports. It implements Reporter.
func (StaticCollector) UnWait ¶ added in v0.16.1
func (c StaticCollector) UnWait(context.Context, chan struct{})
UnWait lets other components stop waiting on a new report being received. It implements Reporter.
func (StaticCollector) WaitOn ¶ added in v0.16.1
func (c StaticCollector) WaitOn(context.Context, chan struct{})
WaitOn lets other components wait on a new report being received. It implements Reporter.
type WeaveClient ¶ added in v0.13.0
type WeaveClient interface { AddDNSEntry(hostname, containerid string, ip net.IP) error Expose() error }
WeaveClient is the little bit of the weave clent we need.
type WeavePublisher ¶ added in v0.13.0
type WeavePublisher struct {
// contains filtered or unexported fields
}
WeavePublisher is a thing which periodically registers this app with WeaveDNS.
func NewWeavePublisher ¶ added in v0.13.0
func NewWeavePublisher(weaveClient WeaveClient, dockerClient DockerClient, interfaces InterfaceFunc, hostname, containerName string) *WeavePublisher
NewWeavePublisher makes a new Weave.