mirror of
https://github.com/prometheus/prometheus
synced 2024-12-25 07:52:28 +00:00
Expose EC2 instance lifecycle as label (#6914)
Signed-off-by: Alex Gaganov <alex.gaganov@fiverr.com>
This commit is contained in:
parent
52025bd7a9
commit
df92a00838
@ -37,22 +37,23 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
ec2Label = model.MetaLabelPrefix + "ec2_"
|
||||
ec2LabelAZ = ec2Label + "availability_zone"
|
||||
ec2LabelInstanceID = ec2Label + "instance_id"
|
||||
ec2LabelInstanceState = ec2Label + "instance_state"
|
||||
ec2LabelInstanceType = ec2Label + "instance_type"
|
||||
ec2LabelOwnerID = ec2Label + "owner_id"
|
||||
ec2LabelPlatform = ec2Label + "platform"
|
||||
ec2LabelPublicDNS = ec2Label + "public_dns_name"
|
||||
ec2LabelPublicIP = ec2Label + "public_ip"
|
||||
ec2LabelPrivateDNS = ec2Label + "private_dns_name"
|
||||
ec2LabelPrivateIP = ec2Label + "private_ip"
|
||||
ec2LabelPrimarySubnetID = ec2Label + "primary_subnet_id"
|
||||
ec2LabelSubnetID = ec2Label + "subnet_id"
|
||||
ec2LabelTag = ec2Label + "tag_"
|
||||
ec2LabelVPCID = ec2Label + "vpc_id"
|
||||
subnetSeparator = ","
|
||||
ec2Label = model.MetaLabelPrefix + "ec2_"
|
||||
ec2LabelAZ = ec2Label + "availability_zone"
|
||||
ec2LabelInstanceID = ec2Label + "instance_id"
|
||||
ec2LabelInstanceState = ec2Label + "instance_state"
|
||||
ec2LabelInstanceType = ec2Label + "instance_type"
|
||||
ec2LabelInstanceLifecycle = ec2Label + "instance_lifecycle"
|
||||
ec2LabelOwnerID = ec2Label + "owner_id"
|
||||
ec2LabelPlatform = ec2Label + "platform"
|
||||
ec2LabelPublicDNS = ec2Label + "public_dns_name"
|
||||
ec2LabelPublicIP = ec2Label + "public_ip"
|
||||
ec2LabelPrivateDNS = ec2Label + "private_dns_name"
|
||||
ec2LabelPrivateIP = ec2Label + "private_ip"
|
||||
ec2LabelPrimarySubnetID = ec2Label + "primary_subnet_id"
|
||||
ec2LabelSubnetID = ec2Label + "subnet_id"
|
||||
ec2LabelTag = ec2Label + "tag_"
|
||||
ec2LabelVPCID = ec2Label + "vpc_id"
|
||||
subnetSeparator = ","
|
||||
)
|
||||
|
||||
// DefaultSDConfig is the default EC2 SD configuration.
|
||||
@ -214,6 +215,10 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
|
||||
labels[ec2LabelInstanceState] = model.LabelValue(*inst.State.Name)
|
||||
labels[ec2LabelInstanceType] = model.LabelValue(*inst.InstanceType)
|
||||
|
||||
if inst.InstanceLifecycle != nil {
|
||||
labels[ec2LabelInstanceLifecycle] = model.LabelValue(*inst.InstanceLifecycle)
|
||||
}
|
||||
|
||||
if inst.VpcId != nil {
|
||||
labels[ec2LabelVPCID] = model.LabelValue(*inst.VpcId)
|
||||
labels[ec2LabelPrimarySubnetID] = model.LabelValue(*inst.SubnetId)
|
||||
|
@ -428,6 +428,7 @@ The following meta labels are available on targets during [relabeling](#relabel_
|
||||
|
||||
* `__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
|
||||
* `__meta_ec2_instance_state`: the state of the EC2 instance
|
||||
* `__meta_ec2_instance_type`: the type of the EC2 instance
|
||||
* `__meta_ec2_owner_id`: the ID of the AWS account that owns the EC2 instance
|
||||
|
Loading…
Reference in New Issue
Block a user