From c38ca2ca95137ec830eee34bb3be54160e9f98ca Mon Sep 17 00:00:00 2001 From: Deepjyoti Mondal Date: Sun, 29 Mar 2020 02:11:37 +0530 Subject: [PATCH] Fix #6999 : Add architecture meta label for EC2 (#7000) This PR adds architecture meta labels for EC2 instances Signed-off-by: Deepjyoti Mondal --- discovery/ec2/ec2.go | 5 +++++ docs/configuration/configuration.md | 1 + 2 files changed, 6 insertions(+) diff --git a/discovery/ec2/ec2.go b/discovery/ec2/ec2.go index d4b27b15dd..1fdb9cc4e4 100644 --- a/discovery/ec2/ec2.go +++ b/discovery/ec2/ec2.go @@ -39,6 +39,7 @@ import ( const ( ec2Label = model.MetaLabelPrefix + "ec2_" ec2LabelAZ = ec2Label + "availability_zone" + ec2LabelArch = ec2Label + "architecture" ec2LabelInstanceID = ec2Label + "instance_id" ec2LabelInstanceState = ec2Label + "instance_state" ec2LabelInstanceType = ec2Label + "instance_type" @@ -219,6 +220,10 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) { labels[ec2LabelInstanceLifecycle] = model.LabelValue(*inst.InstanceLifecycle) } + if inst.Architecture != nil { + labels[ec2LabelArch] = model.LabelValue(*inst.Architecture) + } + if inst.VpcId != nil { labels[ec2LabelVPCID] = model.LabelValue(*inst.VpcId) labels[ec2LabelPrimarySubnetID] = model.LabelValue(*inst.SubnetId) diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 592faf24e2..a30e0b7264 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -426,6 +426,7 @@ the public IP address with relabeling. The following meta labels are available on targets during [relabeling](#relabel_config): +* `__meta_ec2_architecture`: the architecture of the instance * `__meta_ec2_availability_zone`: the availability zone in which the instance is running * `__meta_ec2_instance_id`: the EC2 instance ID * `__meta_ec2_instance_lifecycle`: the lifecycle of the EC2 instance, set only for 'spot' or 'scheduled' instances, absent otherwise