You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add fixture/snapshot tests
Add tests that transform vendored API responses (fixtures) into vendored
/metrics output (snapshots), so that we can see how changes to the
exporter implementation affect the actual output of the exporter, in the
form of changes to the snapshots.
I've sourced the fixtures from debug JSON logging of real API responses
from tasks running in AWS. Each task consisted of an ecs_exporter
container and a prometheus container.
My expectation is that fixtures should not be updated unless we become
informed that API responses have materially changed, e.g. because new
features we are using were added, or breaking changes have been made.
I've got two sets of fixtures and snapshots, one for EC2 and one for
Fargate. The API responses differ between EC2 and Fargate
enough (because, among other things, they use two completely different
implementations of the task metadata API, and two different container
runtimes entirely!) that I think it's worth covering them both
independently.
Closes#99.
Signed-off-by: Ian Kerins <[email protected]>
* Fix typo'd metric name
Compare to the sibling metric whose name is spelled correctly:
ecs_network_receive_packets_dropped_total.
This commit shows the snapshot tests in action.
Signed-off-by: Ian Kerins <[email protected]>
* Fix nil pointer dereference with stopped container in EC2
As the updated task stats fixture for EC2 shows, stopped containers in
EC2 have the empty JSON object for their stats, instead of the `null`
that Fargate has, which triggered a nil pointer dereference that is now
fixed.
Signed-off-by: Ian Kerins <[email protected]>
* Load test fixtures at test execution time
Signed-off-by: Ian Kerins <[email protected]>
* Generate snapshot diff using testutil.CollectAndCompare
Signed-off-by: Ian Kerins <[email protected]>
---------
Signed-off-by: Ian Kerins <[email protected]>
# HELP ecs_container_memory_limit_bytes Configured container memory limit in bytes, set from the container-level limit in the task definition if any, otherwise the task-level limit.
# HELP ecs_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, goversion from which ecs_exporter was built, and the goos and goarch for the build.
# HELP ecs_task_cpu_limit_vcpus Configured task CPU limit in vCPUs (1 vCPU = 1024 CPU units). This is optional when running on EC2; if no limit is set, this metric has no value.
94
-
# TYPE ecs_task_cpu_limit_vcpus gauge
95
-
ecs_task_cpu_limit_vcpus 0.25
96
-
# HELP ecs_task_ephemeral_storage_allocated_bytes Configured Fargate task ephemeral storage allocated size in bytes.
97
-
# TYPE ecs_task_ephemeral_storage_allocated_bytes gauge
# HELP ecs_task_memory_limit_bytes Configured task memory limit in bytes. This is optional when running on EC2; if no limit is set, this metric has no value.
109
-
# TYPE ecs_task_memory_limit_bytes gauge
110
-
ecs_task_memory_limit_bytes 5.36870912e+08
111
-
# HELP ecs_task_metadata_info ECS task metadata, sourced from the task metadata endpoint version 4.
0 commit comments