Commit Graph

3191 Commits

Author SHA1 Message Date
Mike Lang
0fb74d6781 ecs client: more refactoring for nice code
pulls the inner function of describeServices into its own top-level function,
makes the lock part of the client object as a result
2016-12-15 14:11:58 -08:00
Mike Lang
adb6f9d4a1 Appease linter 2016-12-15 14:11:58 -08:00
Mike Lang
6f2efca968 more review feedback 2016-12-15 14:11:58 -08:00
Mike Lang
7d845f9130 ecs reporter: Review feedback, some trivial renames 2016-12-15 14:11:58 -08:00
Mike Lang
7ebb76d0a3 ecs reporter: Move some code around to break up large function 2016-12-15 14:11:58 -08:00
Mike Lang
1d63830792 awsecs reporter: Add lots of debug logging and fix bugs
- describeServices wasn't describing the partial page left over at the end,
  which would cause incorrect results
- the shim between listServices and describeServices was closing the channel every iteration,
  which would cause panic for write to closed channel
- client was not being saved when created, so it gets recreated each time
- we were describeTasks'ing even if we had no tasks to describe
2016-12-15 14:11:57 -08:00
Mike Lang
4234888bf4 ecs: Linter fixes 2016-12-15 14:11:57 -08:00
Mike Lang
357136721d Fix compile errors and go fmt 2016-12-15 14:11:57 -08:00
Mike Lang
9d1e46f81b ECS reporter: Use persistent client objects across reports
Not only does this allow us to re-use connections, but vitally it allows us
to make use of the new task and service caching within the client object.
2016-12-15 14:11:57 -08:00
Mike Lang
6b19bc2da9 Changes to how ECS AWS API is used to minimize API calls
Due to AWS API rate limits, we need to minimize API calls as much as possible.

Our stated objectives:
* for all displayed tasks and services to have up-to-date metadata
* for all tasks to map to services if able

My approach here:
* Tasks only contain immutable fields (that we care about). We cache tasks forever.
  We only DescribeTasks the first time we see a new task.
* We attempt to match tasks to services with what info we have. Any "referenced" services,
  ie. a service with at least one matching task, needs to be updated to refresh changing data.
* In the event that a task doesn't match any of the (updated) services, ie. a new service entirely
  needs to be found, we do a full list and detail of all services (we don't re-detail ones we just refreshed).
* To avoid unbounded memory usage, we evict tasks and services from the cache after 1 minute without use.
  This should be long enough for things like temporary failures to be glossed over.

This gives us exactly one call per task, and one call per referenced service per report,
which is unavoidable to maintain fresh data. Expensive "describe all" service queries are kept
to only when newly-referenced services appear, which should be rare.

We could make a few very minor improvements here, such as trying to refresh unreferenced but known
services before doing a list query, or getting details one by one when "describing all" and stopping
when all matches have been found, but I believe these would produce very minor, if any, gains in
number of calls while having an unjustifiable effect on latency since we wouldn't be able to do requests
as concurrently.

Speaking of which, this change has a minor performance impact.
Even though we're now doing less calls, we can't do them as concurrently.

Old code:
	concurrently:
		describe tasks (1 call)
		sequentially:
			list services (1 call)
			describe services (N calls concurrently)
Assuming full concurrency, total latency: 2 end-to-end calls

New code (worst case):
	sequentially:
		describe tasks (1 call)
		describe services (N calls concurrently)
		list services (1 call)
		describe services (N calls concurrently)
Assuming full concurrency, total latency: 4 end-to-end calls

In practical terms, I don't expect this to matter.
2016-12-15 14:11:57 -08:00
Alfonso Acosta
8e78c0c814 Merge pull request #2094 from weaveworks/maybe-old-master
Fix force-push to master
2016-12-15 18:26:29 +01:00
Simon
ffeeabd839 Merge pull request #2093 from weaveworks/2092-start-probe-d4m
Fixes ./scope launch starting probe under d4m
2016-12-15 15:58:09 +01:00
Filip Barl
29d91aa2a9 Merge pull request #2089 from weaveworks/reapply-eslint-update
Reapplied all the eslint upgrade changes
2016-12-15 15:29:01 +01:00
Simon Howe
71e04a27ba Fixes ./scope launch starting probe under d4m 2016-12-15 15:26:20 +01:00
Filip Barl
e345f42b18 Moved font-awesome-webpack to devDependencies. 2016-12-15 15:04:53 +01:00
Filip Barl
26b3e9efc9 Reapplied all the eslint upgrade changes 2016-12-15 15:04:53 +01:00
Mike Lang
5ed63de306 Merge pull request #2060 from weaveworks/mike/awsecs/fix-log-formatting
ecs reporter: Fix some log lines that were passing *string instead of string
2016-12-14 11:20:59 -08:00
Jonathan Lange
3560bbc73a Merge pull request #2086 from weaveworks/log-request-headers
Add flag for logging headers
2016-12-14 17:29:38 +00:00
Alfonso Acosta
a1d9db867f Merge pull request #2082 from kinvolk/schu/tools-dialer
Add extras/dialer
2016-12-14 11:49:09 +01:00
Michael Schubert
4d20a91a97 Add extras/dialer
Based on the dialer.sh script by @alban:
https://gist.github.com/alban/7abe7f6307184c58be7429e63a2d9053

Signed-off-by: Michael Schubert <michael@kinvolk.io>
2016-12-13 09:31:57 +01:00
Mike Lang
bbcf184031 Merge pull request #2077 from weaveworks/mike/scope-script/shellcheck
scope launch script improvements
2016-12-12 14:30:46 -08:00
Mike Lang
2562567de4 scope launch script: Don't try to detect if listing scope binary args worked
We can't easily do this since scope exits failure when -h is passed, so we
can't distinugish between success and failure.
2016-12-12 11:26:01 -08:00
Mike Lang
3000adfb9a scope launch script: Don't print container id
It's not useful and it's confusing.
Replaced with a generic "it worked" message.
2016-12-12 11:26:01 -08:00
Mike Lang
7333b99b89 scope launch script: Make the default port clear 2016-12-12 11:26:01 -08:00
Mike Lang
0e4e95e4fa scope launch script: Edit help text to make positional args clearer 2016-12-12 11:26:01 -08:00
Mike Lang
3a69c19d6e scope launch script: Also recongize -h, -help and --help 2016-12-12 11:26:01 -08:00
Mike Lang
90709b61aa scope launch script: Fix and consolidate usage info
Instead of different usage info for "scope help", show the same always.
Also correct it for what the script actually does,
and always display the scope binary args.
2016-12-12 11:26:01 -08:00
Mike Lang
b1a1c7d427 scope launch script: Attempt to quote args in "scope command"
As indicated by the TODO, any args passed into the command do not get escaped
when output, so for example:
	scope command "foo bar"
would output results like:
	foo bar
instead of
	"foo bar"
or
	foo\ bar

The "right" way to do this seems to be printf %q, which prints a quoted version of the string.
However this format specifier is not available in POSIX sh (though it does work in many
implementations of it, such as the ones provided by bash which make up the likely majority of
real-world usage).
This code is a compromise that uses the added functionality where available,
while still falling back to the old behaviour when it isn't.
2016-12-12 11:26:00 -08:00
Mike Lang
21431bb4b0 scope launch script: Fix shellcheck linter warnings
By far the majority of these were variables which were not quoted.
While, yes, right now we can guarentee most of these variables will never contain spaces,
this could someday change and applying quoting as a universal rule prevents future mistakes.

The ARGS="$@" -> "$*" change is purely stylistic and mainly is used to indicate the intent that
we actually wanted to concatenate all the args by spaces, not keep them seperated as "$@" would
in many situations, but not this one.

Several warnings remain, in places where we intentionally want to split a variable on whitespace,
or otherwise do what shellcheck is warning us against.

Of note is shellcheck warning SC2166, which says to prefer [ foo ] || [ bar ] over [ foo -o bar ]
as the -a and -o flags have differing behaviour on some systems.
I've opted to keep these for now, since the version check test command would need to be replaced by
a LOT of subshells to achieve the same effect, which feels dirtier.
2016-12-12 11:26:00 -08:00
Jordan Pellizzari
670d52f191 Merge pull request #2078 from weaveworks/2072-sparkline-errors
Fix sparkline crashing on stopped nodes
2016-12-12 10:19:58 -08:00
Jonathan Lange
a8ba7b2c86 Log whether it's a websocket request 2016-12-12 17:57:48 +00:00
Jonathan Lange
256e480acc Vendor new weaveworks/common 2016-12-12 17:40:46 +00:00
Jonathan Lange
626e8a3e9f Neater way of doing it 2016-12-12 17:40:15 +00:00
Jonathan Lange
4fcf9a1e36 Add flag for logging headers 2016-12-12 17:12:28 +00:00
Paul Bellamy
6b54cd28b2 Merge pull request #2081 from weaveworks/remove-wcloud
Remove wcloud
2016-12-12 15:24:09 +00:00
David
d8f16c9a32 Merge pull request #2084 from weaveworks/revert-2058-update-eslint
Revert "Upgraded eslint & eslint-config-airbnb"
2016-12-12 16:06:58 +01:00
David
99bfab89b7 Revert "Upgraded eslint & eslint-config-airbnb" 2016-12-12 16:06:13 +01:00
Filip Barl
0921af04d5 Merge pull request #2058 from weaveworks/update-eslint
Upgraded eslint & eslint-config-airbnb
2016-12-12 14:01:53 +01:00
Filip Barl
be9b640130 Addressed @davkal's and @jpellizzari's comments 2016-12-12 11:36:43 +01:00
Filip Barl
a1d1b49aeb Addressed @jpellizzari's comment 2016-12-12 11:23:09 +01:00
Paul Bellamy
2caa2b6770 Remove wcloud 2016-12-12 10:07:09 +00:00
Filip Barl
1b5f3ae4bf Using individual D3 modules 2016-12-12 11:04:49 +01:00
Filip Barl
71f44e8b70 Got rid of findDOMNode helper 2016-12-12 11:04:49 +01:00
Filip Barl
90685c89f1 Applied 'jsx-no-target-blank' lint rule 2016-12-12 11:04:15 +01:00
Filip Barl
86d61cf0d6 Extracted 'static' methods outside of classes for the 'class-methods-use-this' lint rule 2016-12-12 11:04:15 +01:00
Filip Barl
8dce4e8f36 Fixed the failing test 2016-12-12 11:03:16 +01:00
Filip Barl
776b4d72eb Applied no-mixed-operators linting rule 2016-12-12 11:03:16 +01:00
Filip Barl
e60418a986 Applied label-has-for linting rule 2016-12-12 11:03:16 +01:00
Filip Barl
b9241b377a Applied no-underscore-dangle linting rule 2016-12-12 11:03:16 +01:00
Filip Barl
3fdcd9b5e7 Applied arrow-parens linting rule 2016-12-12 11:02:18 +01:00