Commit Graph

55 Commits

Author SHA1 Message Date
Tom Wilkie
41d48224aa Fix tests 2016-01-25 13:46:28 -08:00
Tom Wilkie
b8daa02488 Memoise & cache the result of renderers, so we don't recalculate views multiple times. 2016-01-25 13:31:10 -08:00
Tom Wilkie
6b56475766 Use ps.Map for Counters and Sets, remove Metadata in favour of Latest.
Also
- Add more complicated report.json for benchmark
- Break up report/topology.go
- Implement our own DeepEqual for ps.Map
2016-01-22 15:10:32 -08:00
Paul Bellamy
bf57aeb8d9 Rename the various metric keys so they don't accidentally overlap 2016-01-20 16:14:32 +00:00
Paul Bellamy
0190c15145 Making fixture report metrics more specific 2016-01-20 16:13:56 +00:00
Paul Bellamy
e30c9dc264 use constants for the topology names in Parents/metadata/metrics 2016-01-19 16:47:48 +01:00
Paul Bellamy
3cda328976 remove hostID from container image node ids 2016-01-19 16:47:48 +01:00
Paul Bellamy
56122dd0cc Details panel backend redesign
Megasquish:
  [app] remove unused edge endpoint
  [WIP] refactoring node details api endpoint
  [WIP] plumbing the children through the rendering process
  adding IDList.Remove and StringSet.Remove
  [WIP] working on adding parents to detailed node renderings
  WIP UI components with mock backend data for new details
  grouping children by type
  UI components for node details health and info
  metric formatters for details panel
  Column headers and links for details table
  [WIP] started on rendering node metadata and metrics in the detail view
  DetailedNode.LabelMajor -> DetailedNode.Label
  rendering decent labels for parents of detailed nodes
  render metrics onto the top-level detailed node
  removing dead code
  Links to relatives
  metrics have a Format not Unit
  Show more/less actions for tables and relatives
  adjusted metric formatter
  TopologyTagger should tag k8s topology nodes
  make renderablenode ids more consistent, e.g. container:abcd1234
  working on rendering correct summaries for each node
  adding report.Node.Rank, so that merging is independent of order
  rendering children and parents correctly
  output child renderableNode ids, so we can link to them
  add group field to metrics, so they can be grouped
  Refactored details health items to prepare for grouping
  add metrics to processNodeSummaries
  hide summary section if there is no data for it
  fixing up tests
  moving detailed node rendering into a separate package
  Node ID/Topology are fields not metadata
    - This way I think we don't have to care about Metadata being non-commutative.
    - ID and topology are still non-commutative, as I'm not sure how to sanely
  merge them, but it's possible we don't care.
  host memory usage is a filesize, not a percent
  working on fixing some tests
  adding children to hosts detail panel
    - Had to redo how parents are calculated, so that children wouldn't interfere with it
    - have to have the host at the end because it is non-commutative
  only render links for linkable children (i.e. not unconnected processes)
  resolving TODOs
  fixing up lint errors
  make nil a valid value for render.Children so tests are cleaner
  working on backend tests
  make client handle missing metrics property
  Stop rendering container image nodes with process summaries/parents
  fix parent link to container images
  Calculate parents as a set on report.Node (except k8s)
  refactoring detailed.NodeSummary stuff
  removing RenderableNode.Summary*, we already track it on report.Node
  working on tests
  add Columns field to NodeSummaryGroup
  fixing up render/topologies_test
  fix children links to container images
  get children of hosts rendering right
  working on host renderer tests
  Change container report.Node.ID to a1b2c3;<container>
  The id should be globally unique, so we don't need the host id.
    This lets the kubernetes probe return a container node with the pod id,
    which will get merged into the real containers with other reports. The
    catch is that the kubernetes api doesn't tell us which hostname the
    container is running on, so we can't populate the old-style node ids.
  change terminology of system pods and services
  Fix kubernetes services with no selector
  Fixes handling of kubernetes service, which has no pods
  fix parent links for pods/services
  refactor detailed metadata to include sets and latest data
  fixing up host rendering tests
  fleshing out tests for node metadata and metrics
  don't render container pseudo-nodes as processes
  Update test for id format change.
2016-01-19 16:39:37 +01:00
Tom Wilkie
123c40028f Less hacky fix for /%2F bug 2016-01-14 07:10:31 -08:00
Tom Wilkie
e9e152b9a3 Use argv[0] for process name to be more like ps. 2016-01-06 11:55:34 +00:00
Tom Wilkie
1fcd079563 Use Readdirnames to reduce number of stats we're doing. 2015-12-10 14:43:40 +00:00
Tom Wilkie
cc5935a89d Review feedback 2015-12-10 14:10:36 +00:00
Tom Wilkie
ed6c4088fa Fix up tests. 2015-12-10 14:00:43 +00:00
Tom Wilkie
5cadafcda4 Extend testing of procspy. 2015-12-09 14:47:00 +00:00
Paul Bellamy
8f63d7be7f Metrics plumbing for reports.
- base load graph x-axis on data, not a hardcoded window
- format memory dynamically to scale
- add some tests for the immutability of metrics
- use ps.List for Sample storage, so it is immutable. Have to implement custom marshalling
- adding tests for report.Metrics
- check the ordering of the json samples
- Make the nil value for Metrics valid.
- Sort samples from oldest to newest on the wire.
2015-11-11 17:16:13 +00:00
Tom Wilkie
5e2c165fd8 Review feedback 2015-11-09 11:38:15 +00:00
Tom Wilkie
43d0ce986f Add 'latest' CRDT; use it to store container state.
Also use same technique to merge the controls, returning the latest
set of controls instead of the union.
2015-11-06 18:26:38 +00:00
Tom Wilkie
ec4425fb80 Use Node.Sets for Host Local Networks. 2015-10-27 14:35:07 +00:00
Peter Bourgon
c8fbea0f15 Move fixture to its own package
We want to be able to import test from packages like probe/endpoint, in
order to use utility functions like poll. But that causes an import
cycle with the current layout. We got around this using dot-imports so
far, but it's ugly and unnecessary: fixture can be its own package.
2015-10-27 10:36:53 +00:00
Tom Wilkie
0cd3de5c7f Retry conntrack, after a short delay, in a loop. 2015-10-21 15:17:41 +00:00
Paul Bellamy
be1d1d52d0 Basic Kubernetes integration
* Added helper for installing scope on gcloud
* Added topologies Pods and Pods-by-Service
* Uses k8s.io/kubernetes/pkg/client/cache for the client
* Filter kube-system nodes by default
* Only show the k8s topologies if we've received a non-empty k8s report
2015-10-06 12:55:51 +01:00
Tom Wilkie
f9815afad3 Remove some duplicate functionality, add some basic tests. 2015-09-23 09:46:11 +00:00
Tom Wilkie
8b424df2be Review feedback. 2015-09-16 09:29:42 +00:00
Alfonso Acosta
ebefa5e8f0 Use label "com.amazonaws.ecs.container-name" to render container names 2015-09-07 20:52:13 +00:00
Tom Wilkie
57f7b4f2e6 Rename NodeMetadata -> Node 2015-09-03 16:18:54 +00:00
Tom Wilkie
144a798602 Review Feedback 2015-09-02 14:32:47 +00:00
Tom Wilkie
afc2788777 Move EdgeMetadata into the NodeMetadata struct. 2015-09-02 14:32:44 +00:00
Tom Wilkie
899e2d7a5c Review feedback 2015-09-01 11:01:25 +00:00
Tom Wilkie
1f6b3d4a45 Move Adjacency info inside the NodeMetadata struct; move pseudo node generation to the probes. 2015-08-28 15:20:27 +00:00
Tom Wilkie
903a51397b Review feedback 2015-08-28 09:19:56 +00:00
Tom Wilkie
1a286eac04 Use an exec'd conntrack in 'events' mode instead of repeatedly execing it for NAT mappings. Also use conntrack to populate the endpoint table. 2015-08-27 16:29:33 +00:00
Tom Wilkie
e7dc258119 Only group processes not in containers AND doing network IO into uncontained nodes. 2015-08-27 15:26:49 +00:00
Alfonso Acosta
4db80108bf Merge pull request #400 from weaveworks/docker-labels
Report docker container labels and render them in the details pane
2015-08-27 14:11:35 +01:00
Alfonso Acosta
9ba37402cf Report/render both image and container labels
Daemon labels will have to wait since the go client (Docker API v1.14) doesn't support
them yet (daemon labels were exposed in Docker API v1.16)

See https://godoc.org/github.com/fsouza/go-dockerclient#Client.Info for details.
2015-08-27 09:45:30 +00:00
Tom Wilkie
7c1ca152fa Fail if want != have! 2015-08-26 16:24:42 +00:00
Alfonso Acosta
529aa3d84f Use a metadata key per docker label 2015-08-26 15:49:13 +00:00
Alfonso Acosta
e1c05012ca Report docker container labels and render them in the details pane 2015-08-26 13:38:53 +00:00
Tom Wilkie
60d1b503c1 Deal with directed edges in the rest of the codebase. 2015-08-19 10:17:31 +00:00
Peter Bourgon
0dafad763f Calculate rates in detailed nodes 2015-08-03 16:04:06 +02:00
Peter Bourgon
e1f7752a34 Split PacketCount to Egress and Ingress
Also, 1 packet may be counted in N topologies, so you can't rely on the
sum of all packet counts across topologies having any relation to the
sampling data.
2015-08-03 14:58:41 +02:00
Peter Bourgon
0aadf6447b Revert to correct edge construction
Another implicit invariant in the data model is that edges are always of the
form (local -> remote). That is, the source of an edge must always be a node
that originates from within Scope's domain of visibility. This was evident by
the presence of ingress and egress fields in edge/aggregate metadata.

When building the sniffer, I accidentally and incorrectly violated this
invariant, by constructing distinct edges for (local -> remote) and (remote ->
local), and collapsing ingress and egress byte counts to a single scalar. I
experienced a variety of subtle undefined behavior as a result. See #339.

This change reverts to the old, correct methodology. Consequently the sniffer
needs to be able to find out which side of the sniffed packet is local v.
remote, and to do that it needs access to local networks. I moved the
discovery from the probe/host package into probe/main.go.

As part of that work I discovered that package report also maintains its own,
independent "cache" of local networks. Except it contains only the (optional)
Docker bridge network, if it's been populated by the probe, and it's only used
by the report.Make{Endpoint,Address}NodeID constructors to scope local
addresses. Normally, scoping happens during rendering, and only for pseudo
nodes -- see current LeafMap Render localNetworks. This is pretty convoluted
and should be either be made consistent or heavily commented.
2015-08-03 10:55:59 +02:00
Peter Bourgon
b9afa67ad6 gopacket-based traffic sniffing 2015-08-03 10:55:59 +02:00
Peter Bourgon
3dd59c8b9b Fixes to NodeMetadata
NewNodeMetadata -> MakeNodeMetadata. It doesn't return a pointer, so
Make is more idiomatic.

Invoke MakeNodeMetadata when necessary. The zero value for a
NodeMetadata is no longer valid.

Split MakeNodeMetadata to two constructors. MakeNodeMetadata when you
don't have anything to prepopulate; MakeNodeMetadataWith when you do.

Also, a fix to the tests in app. We unmarshal a RenderableNode struct,
which has a JSON-ignored NodeMetadata field. The zero value is invalid,
so we need to fix that before performing comparisons.
2015-07-30 17:20:44 +02:00
Peter Bourgon
fc308d93b8 Normalize var names; use Addr/Port key constants 2015-07-30 16:36:27 +02:00
Peter Bourgon
a565acc871 Unbreak the build 2015-07-22 14:26:09 +01:00
Tom Wilkie
f85195308c report.Metadata -> map[string]string 2015-07-16 12:06:05 +00:00
Tom Wilkie
c2065836e2 Make NodeMetadata a struct, move existing map[string]string to NodeMetadata.Metadata 2015-07-15 10:06:36 +00:00
Tom Wilkie
9fc02d941e Fix flaky tests
- Make poll take interfaces, do diff on error
- Use poll in TestRegistryEvents
- Improve the locking to prevent deadlocks and data races in registry_test.go
2015-07-08 13:54:09 +00:00
Tom Wilkie
d2d73c3cd4 Add -cpu 4 to tests. 2015-07-06 15:07:33 +00:00
Paul Bellamy
cd71f82d4d aggregate connection details table
List Local and Remote endpoints for each TCP connection on the node.
2015-07-02 14:21:16 +01:00