Closed jjo closed 4 weeks ago
BTW also manually tested it locally with:
$ ./cloudcost-exporter --aws.profile $DEV_PROFILE --aws.region us-east-1 --aws.services ec2 --compute.instance-label node
[...]
$ curl -s http://localhost:8080/metrics | egrep ^cloudcost_aws
[...]
cloudcost_aws_ec2_instance_total_usd_per_hour{cluster_name="<EDITED>",family="General purpose",machine_type="m6g.xlarge",node="ip-10-60-5-156.us-east-2.compute.internal",price_tier="ondemand",region="us-east-2"} 0.154
cloudcost_aws_ec2_instance_total_usd_per_hour{cluster_name="<EDITED>",family="General purpose",machine_type="m7g.2xlarge",node="ip-10-60-11-138.us-east-2.compute.internal",price_tier="spot",region="us-east-2a"} 0.1292
cloudcost_aws_ec2_instance_total_usd_per_hour{cluster_name="<EDITED>",family="General purpose",machine_type="m7g.2xlarge",node="ip-10-60-3-71.us-east-2.compute.internal",price_tier="spot",region="us-east-2a"} 0.1292
[...]
Closing as this was intended as a PoC / exploration to sense the feasibility and complexity on adding such flag, then we also agreed on not moving fwd with this approach.
Fixes #262.
What
Allow
instance
label name to be set via new-compute.instance-label
flag.Why
See #262 for the rationale and discussion.
How
for each compute
Collector
, create newcollectorMetrics
type containing compute metrics (moved from global var), to let eachCollector
own an allocated instance obtained vianewCollectorMetrics(instanceLabel)
changing metrics from global var to dynamically allocated object is needed for:
instanceLabel
spot={true,false}
labelthere's a new
config.CommonConfig
type, currently only having a single fieldComputeInstanceLabel
, which is passed down fromcmd/
to each instantiated Provider, then to each compute CollectorTesting
Adapted testing with a couple
ComputeInstanceLabel="node"
changes, although it should be improved to test changes to the label name.-- Signed-off-by: JuanJo Ciarlante juanjosec@gmail.com