556 Commits

Author SHA1 Message Date
Matthias Radestock
88e8b52d66 Decorators, begone!
Decorators were just a complicated way of constructing filters.
2017-11-21 20:16:30 +00:00
Matthias Radestock
ae153e57f5 refactor: remove Decorator from render.Renderer.Render() signature 2017-11-18 18:04:52 +00:00
Matthias Radestock
a82d245e93 simplify render decoration
Decoration is in fact quite a simple process that is applied on entry
to rendering: we take a base renderer, transform it with a decorator,
and then render a report with it. The new render.Decorate() function
does exactly that.

There is one exception. When rendering an individual node, e.g. for
showing its details panel in the UI, we must not lose the node during
decoration. That requires some special logic, which previously resided
in the PreciousNodeRenderer, and now lives in handleNode.
2017-11-18 18:04:52 +00:00
Matthias Radestock
4e4c3b25c4 Expand the app's k8s namespace calculation
to include recently added k8s types.

This is all rather inefficient. See #2945.
2017-11-18 17:35:57 +00:00
Matthias Radestock
8f7e00f46a Stats are easily produced as part of Rendering
...so there is no need for a separate Stats method.

step 1: return stats from Render
2017-11-08 07:15:28 +00:00
Bryan Boreham
8a11697957 Add BenchmarkTopologyHosts() and BenchmarkTopologyContainers()
To time a single topology, for more focused optimisation
2017-11-06 20:48:25 +00:00
Matthias Radestock
0b9bab255c memoise top-level rendering
This deals with browsers requesting the same rendering for the same
timespan when no new reports have been received for that timespan.
2017-11-04 22:24:46 +00:00
Damien Lespiau
466927ce68 lint: Fix 2 sites failing a recently introduced golint check
golint has gained a new check and we don't freeze the golint version so CI was
failing on unrelated PRs:

app/multitenant/consul_client.go:69:2: redundant if ...; err != nil check, just return error instead.
report/marshal.go:188:2: redundant if ...; err != nil check, just return error instead.

Fix those!
2017-09-26 12:15:09 +01:00
Jonathan Lange
f9e37a21f5 Continue processing reports if billing fails 2017-09-22 12:20:10 +01:00
Roland Schilter
0d381a34d6 Link scope-ui graphs clickable to prometheus queries (#2664)
scope-app:
* Adds `-app.metrics-graph` cli flag for configuring the base url to
use for graph links; supports :orgID and :query placeholders
* Assigns query URLs to existing metrics and appends empty metrics if missing

scope-ui:
* Extends <CloudFeature /> with option alwaysShow
* Adds <CloudLink /> to simplify routing when in cloud vs not in cloud
* Links metric graphs in the ui's node details view for all k8s
toplogies and containers so far
* Tracks metric graph click in mixpanel `scope.node.metric.click`
* Uses percentages and MB for CPU/Memory urls
* Passes timetravel timestamp to cortex in deeplink
2017-08-15 18:56:23 +01:00
Matthias Radestock
c312579bfe log sqs messages at 'debug' rather than 'info' level
Fixes #2790.
2017-08-07 10:17:05 +01:00
Matthias Radestock
1f95e3efd4 obtain historic_reports capability from Reporter 2017-07-31 09:58:31 +01:00
Alfonso Acosta
7b4b410f4a Review Feedback 2017-07-20 11:01:44 +00:00
Alfonso Acosta
c6d5a6a646 Make linter happy 2017-07-20 10:05:48 +00:00
Alfonso Acosta
f66d79d427 Backoff when writing to Dynamo and S3 2017-07-18 15:28:08 +00:00
Alfonso Acosta
34bfc22b4f Fix tests 2017-07-03 20:20:28 +00:00
Mike Lang
c521b50bc6 Remove type filter in controllers view
This was always temporary until we could search for type via the search box instead,
since it resulted in too much clutter / didn't seem a useful use-case.

As it turns out, searching like this was already possible.
2017-06-29 16:03:53 -07:00
Mike Lang
ef2b6f6c55 Remove replica sets
Use a special kind of selector renderer to elide replica sets from pod nodes
and directly reference deployment parents instead.
Do the inverse (replace replica sets with pods) during the mapping from pod to deployment.

Note we can no longer use renderParents since we're using a non-standard Selector
2017-06-29 10:13:15 -07:00
Matthias Radestock
5317b224ec Merge pull request #2652 from weaveworks/do-not-filter-endpoint
do not filter endpoints by procspied/ebpf in renderers

Fixes #2551.
Fixes #2558.
2017-06-28 08:54:38 +01:00
Roland Schilter
e6bc1d6ec2 Merge pull request #2649 from weaveworks/1975-honor-docker-host-in-probe
Honor DOCKER_* env variables in probe and app
2017-06-28 09:07:52 +02:00
Matthias Radestock
3209d65d52 filter out unconnected pseudo nodes on the outside
The change is necessitated by the removal of procspied/ebpf endpoint
filtering in the renderers, as a result of which the odd
conntracked-only, unconnected pseudo node can sneak through.

This new way of doing things also makes renderers more composable and
robust, and more directly reflects the objective:
- in the process topologies, filter out all unconnected nodes
- in all other topologies, filter out unconnected pseudo nodes
2017-06-27 20:28:30 +01:00
Mike Lang
8eb72cf276 Remove deployment and daemonset views, change combined to controllers and remove bare pods and replica sets
Since we still need to map through replica sets to find matching deployments, we simply filter them out as a post-step.
2017-06-27 10:19:04 -07:00
Mike Lang
d0cbf47c1c Add an option group to Combined view to select group type (daemonset or deployment)
This is a union set, so it will be suitable even as we continue to add more node types to this view.
2017-06-27 10:19:04 -07:00
Mike Lang
6dae014352 Add new view for 'combined' daemonset/deployment view
The idea is that this view shows all 'pods or groups of pods' at 'the highest level of abstraction'.
For now, we just show daemonsets and deployments.
2017-06-27 10:19:04 -07:00
Roland Schilter
651e52b5a5 Honor DOCKER_* env variables in probe and app
Changed default for flag `-app.docker` to use the DOCKER_* env variables
instead of hardcoded /var/run/docker.sock; uses docker's default if
no DOCKER_HOST defined, for both probe and app.

Fixes #1975
2017-06-27 17:14:49 +02:00
Mike Lang
0e54b27e81 Don't omitempty for option group default value
The value "" is meaningful, and the UI does not behave correctly if it's not present.
2017-06-21 15:17:07 -07:00
Mike Lang
383ace4d7e Replace 'none' id for the none option in union types with ''
In union option groups, the list of selected ids is encoded as a comma-delimited string.
For example, if 'foo' and 'bar' are selected, the value 'foo,bar' is sent, ie ["foo", "bar"] -> "foo,bar"
Under this scheme, with nothing selected, the empty string should be sent, ie. [] -> ""

Before this change, the frontend code called the "none option" by id 'none'.
There were several issues with this:
* The frontend would send 'none' when nothing was selected, not ''. The backend ignored this as it ignores
  junk values in the options, treating them as though they hadn't been given.
* The backend would attempt to set the default value of an option to "nothing selected", ie. [], by sending ''.
  The frontend would interpret this as nothing selected, *not even the 'none' option*, which caused a visual bug.
* Everything would break if one of the legitimate options had the id 'none', which could easily happen eg.
  if a user had a 'none' k8s namespace. This is perhaps an unusual name, but our code shouldn't break when
  a particular arbitary string is used as an input.

With this change, the none option is called '', which fixes all the above problems:
* The frontend encodes [''] as ''
* The frontend decodes '' as [''], and therefore shows the '' option as selected
* The string '' is not a valid k8s namespace name and is a reasonable "prohibited value" for all other use cases.
  The backend already couldn't handle a value with this id correctly prior to this change anyway.
2017-06-21 15:03:18 -07:00
Filip Barl
eb64d3f09b Make API calls with time travel timestamp (#2600)
* Node details fetching reports at proper timestamp.

* Corrected all the relevant timestamps in the UI.

* Renamed some state variables.

* Time travel works for topologies list.

* Added a whole screen overlay for time travel.

* Polished the backend.

* Make time travel work also with the Resource View.

* Fixed the jest tests.

* Fixed the empty view message for resource view.

* Some naming polishing.

* Addressed the comments.
2017-06-20 12:31:22 +02:00
Filip Barl
b6dfe25499 Time travel control (#2524)
* Hacky working prototype.

* Operate with time.Duration offset instead of fixed timestamp.

* Polished the backend code.

* Made a nicer UI component.

* Small refactorings of the websockets code.

* Fixed the backend tests.

* Better websocketing and smoother transitions

* Small styling refactoring.

* Detecting empty topologies.

* Improved error messaging.

* Addressed some of David's comments.

* Moved nodesDeltaBuffer to a global state to fix the paused status rendering bug.

* Small styling changes

* Changed the websocket global state variables a bit.

* Polishing & refactoring.

* More polishing.

* Final refactoring.

* Addressed a couple of bugs.

* Hidden the timeline control behind Cloud context and a feature flag.

* Addressed most of @davkal's comments.

* Added mixpanel tracking.
2017-06-12 11:22:17 +02:00
Alfonso Acosta
6be7aa8be2 Add app capabilities to /api endpoint 2017-06-08 11:02:25 +00:00
Matthias Radestock
eb8695965a refactor: move report file reading 2017-05-26 15:30:17 +01:00
Mike Lang
3aa4a676dd Add new view for daemonsets 2017-05-19 15:06:53 -07:00
Matthias Radestock
f7bba52979 show all namespaces by default
There is nothing special about the "default" namespace, and selecting
it by default means we only show a partial view of the system, which
is hard to spot, especially for novice users.
2017-05-16 09:54:28 +01:00
Marcus Cobden
860dfb7b7a Merge pull request #2504 from weaveworks/weavenet_metrics
Add weavenet metrics to billing emitter
2017-05-10 09:56:53 +01:00
Marcus Cobden
9fded9d34e Add weavenet metrics to billing 2017-05-09 15:33:12 +00:00
Mike Lang
e9788459e4 api_topologies: Don't put namespace filters on containers-by-dns/image
This should never have been added. The IsNamespace filter will always return false for these nodes.
It isn't even clear what this filter would mean, even if implemented, since those nodes don't map to a single
container and therefore not to a single namespace.
2017-05-08 13:14:19 -07:00
Alfonso Acosta
876bb97539 Merge pull request #2452 from weaveworks/mike/docker-swarm/service-ns-selector
Add docker swarm Stack selector ala k8s namespace selector
2017-04-25 15:57:15 +02:00
Bryan Boreham
6842b08eb8 Fix out-of-date error message in test 2017-04-25 12:28:14 +00:00
Mike Lang
51999529a7 Add docker swarm Stack selector ala k8s namespace selector
We have to introduce the kinda hacky concept of a 'No Stack' stack
to reconcile it with the idea of a 'default' k8s namespace. This is important
because swarm services without a stack don't have the same docker labels as ones that do.
Curiously, they still have what appears to be a stack name 'prefix' on their names,
but I can't isolate that name anywhere easily so they'll just have to make do.

I basically copy-pasted updateFilters to make this work, todo go back and refactor
to not duplicate 90% of the code.
2017-04-18 09:08:22 -07:00
Bryan Boreham
c944225475 Merge pull request #2437 from kinvolk/alban/gzip-compression-level-default
gzip: change compression level to the default
2017-04-18 10:45:38 +01:00
Mike Lang
2b208580ab Add new topology view for Docker Swarm services 2017-04-14 17:18:06 -07:00
Matthias Radestock
46f288bb6d close s3 response body to prevent leaks
Fixes #2018
2017-04-14 00:27:41 +01:00
Alban Crequy
a8af81fe20 gzip: change compression level to the default
We want the middle ground between a small compression size, a fast
compression time and a fast decompression time.

Tests suggest that the default compression level is better than the
maximum compression level: although the reports are 4% bigger and
decompress slower, they compress 33% faster.

See discussion on https://github.com/weaveworks/scope/issues/1457#issuecomment-293288682
2017-04-12 17:41:43 +02:00
Alfonso Acosta
a404d82a91 Merge pull request #2419 from weaveworks/name-unnamed
Make various anonymous fields named
2017-04-06 14:16:29 +02:00
Paul Bellamy
fbf74b8d40 Add NodeSeconds to billing emitter 2017-04-04 10:33:19 +01:00
Bryan Boreham
515f4b1a47 Make various anonymous fields named
Anonymous fields make any methods on the inner object visible on the
outer, so they should only be used when the outer is-a inner.
2017-04-01 11:35:10 +00:00
Mike Lang
96494d92c5 api_topologies: Fix tests
Tests relied on url param defaults, which no longer work
2017-03-27 12:55:34 -07:00
Mike Lang
9e1666cb49 api_topologies: Change semantics of blank or omitted option values
Instead of value being "" or omitted meaning "use group.Default", we now allow the empty value
to go through. This was done to allow multi-value options to be able to encode 'no options selected'.
This is important as the alternative is very confusing, as 'nothing selected' would generally mean
'match everything', not 'select default' (which in the k8s namespace example, means the "default" namespace).

Since the UI is the only user of this API, and it already sends the default value always, this does not affect
any existing usage.

Since the UI still wants to show a 'match all' button to prevent confusion, but it's not a normal option
(if it were a normal option, it could be combined with others, which isn't meaningful), we add a new key
NoneLabel that indicates the name that should be displayed on this extra button.

Finally, we implement these changes for the k8s namespace button, ie.
- Get rid of All Namespaces option
- Add "All Namespaces" as the NoneLabel
- Default to "" when "default" namespace not present, which is equivalent to the old "all" option.
2017-03-27 10:06:56 -07:00
Mike Lang
bfb68a54a9 api_topologies: Allow selecting multiple k8s namespace filters
This is the first usage of the new 'union' selectType.
Note that we're still sending 'all' for now. There's currently no easy
way to specify this meaning, and arguably it should be done entirely clientside.
But for now it just means some UI weirdness where 'all' is one of the options and having it on
means anything else you select doesn't matter.
2017-03-27 10:06:56 -07:00
Mike Lang
efb68fb2da api_topologies: Add a selectType field to option groups
This field changes the option group behaviour depending on its value.
Currently only supports two values:
"one" (default): Old behaviour, one option can be selected
"union": Any number of options can be selected, and the filters are OR-ed togther

It is written in such a way as to easily enable a future "intersection" option,
as per union but AND-ing the filters. But this is not done here. YAGNI.
2017-03-27 10:06:56 -07:00