Commit Graph

37 Commits

Author SHA1 Message Date
Matthias Radestock
d368854b90 defend against nils
Fixes #2508. Hopefully.
2017-07-20 15:59:59 +01:00
Alfonso Acosta
aec715653a Avoid null dereferences in ECS client (encore) 2017-05-10 16:25:32 +00:00
Alfonso Acosta
26eaadbbaa Avoid null dereferences in ECS client 2017-05-10 15:28:53 +00:00
Mike Lang
18ba2c4e38 ecs: Also make service a parent of task 2017-04-11 10:58:33 -07:00
Mike Lang
a49f1c9559 ECS service controls: Don't allow scale down below 1
as currently this would make it disappear (#2085).
See also https://github.com/weaveworks/scope/pull/2197#discussion_r100424800
2017-02-17 13:31:54 -08:00
Mike Lang
5a477171d3 awsecs: Implement scale up/down control 2017-02-07 14:57:32 -08:00
Mike Lang
7d58e6a9c3 awsecs: Add dummy scale up and scale down controls for services
These controls do nothing for now, this was just to get the control buttons working
2017-02-07 14:57:31 -08:00
Mike Lang
fad3e88269 Rename ECS Service node ids to be cluster;serviceName
This is important for two reasons:
* It prevents nasty false-equality bugs when two different services from different ECS clusters
  are present in the same report
* It allows us to retrieve the cluster and service name - all the info we need to look up the service -
  using only the node ID. This matters, for example, when trying to handle a control request.
2017-02-03 13:45:18 -08:00
Mike Lang
c4eb0960f9 awsecs client: simplify list/describe services
by removing ability to stream results between them, since this is such a minor optimization
and greatly complicates the code.
2017-01-23 12:48:50 -08:00
Mike Lang
baffe94538 awsecs caching: Minor review changes 2017-01-20 14:31:41 -08:00
Mike Lang
79a83e3656 awsecs: Appease linter 2017-01-17 12:17:34 -08:00
Mike Lang
2b7662a3c6 Make reporter tests a seperate package to appease linter
This requires making All The Things public. Yuck.
2017-01-17 03:02:47 -08:00
Mike Lang
5c19dc792e ecs probe: add tests for reporter 2017-01-13 17:31:29 -08:00
Mike Lang
685af493bf ecs probe: Allow cache settings to be tweaked 2017-01-12 11:37:23 -08:00
Mike Lang
513977081d aws ecs probe: Use a size and time bound LRU gcache for caching
instead of our own hand-rolled size-unbound cache
2017-01-12 10:34:41 -08:00
Mike Lang
e220ae822f wip: 2017-01-12 07:11:12 -08:00
Mike Lang
49d3e7bbd3 wip: 2016-12-16 17:00:57 -08:00
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
Mike Lang
fb12df6036 ecs reporter: Fix some log lines that were passing *string instead of string 2016-12-05 15:43:36 -08:00
Mike Lang
d0caee4748 Add some basic metadata to the ECS task/service details panels 2016-11-29 07:18:08 -08:00
Mike Lang
003ef6b4ea Add some basic metadata to ECS nodes 2016-11-29 07:18:08 -08:00
Mike Lang
9a10e9650d Fix the one instance of "make" that is actually apparently required 2016-11-29 07:18:08 -08:00
Mike Lang
b06fee8c0f Review feedback 2016-11-29 07:18:08 -08:00
Mike Lang
b53de4317d Appease linter
spellcheck and required comments and required comment formatting
2016-11-29 07:18:08 -08:00
Mike Lang
f5b7b5bec2 ecs reporter: Fix a bug where parents weren't actually set 2016-11-29 07:18:08 -08:00
Alfonso Acosta
78775bbdb8 Initial rendering for ECS
(not working yet)
2016-11-29 07:18:05 -08:00
Mike Lang
a2d329dee7 ecs reporter: Associate containers with ECS tasks and services as parents 2016-11-29 07:17:16 -08:00
Mike Lang
511f6dad6a Add report tagger for populating ECS topologies 2016-11-29 07:17:16 -08:00