Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add full task and EBS volume context to EBS debug log messages #4276

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions agent/api/task/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -3482,11 +3482,17 @@ func (task *Task) IsEBSTaskAttachEnabled() bool {
}

func (task *Task) isEBSTaskAttachEnabledUnsafe() bool {
logger.Debug("Checking if there are any ebs volume configs")
taskFields := task.fieldsUnsafe()
logger.Debug("Checking if there are any ebs volume configs", taskFields)
for _, tv := range task.Volumes {
switch tv.Volume.(type) {
case *taskresourcevolume.EBSTaskVolumeConfig:
logger.Debug("found ebs volume config")
logger.Debug("Found ebs volume config", taskFields, logger.Fields{
"volumeName": tv.Volume.GetVolumeName(),
"volumeId": tv.Volume.GetVolumeId(),
"volumeType": tv.Volume.GetType(),
"volumeSource": tv.Volume.Source(),
})
return true
default:
continue
Expand Down
22 changes: 22 additions & 0 deletions agent/stats/engine_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func (engine *DockerStatsEngine) getEBSVolumeMetrics(taskArn string) []*ecstcs.V
})
return nil
}
logger.Debug("Task is EBS-backed, gathering EBS volume metrics.", logger.Fields{
"taskArn": taskArn,
})

// TODO: Remove the CSI client from the stats engine and just always have the CSI client created
// since a new connection is created regardless and it'll make the stats engine less stateful
Expand All @@ -67,9 +70,28 @@ func (engine *DockerStatsEngine) fetchEBSVolumeMetrics(task *apitask.Task, taskA
"VolumeId": volumeId,
"SourceVolumeHostPath": hostPath,
"Error": err,
"taskArn": taskArn,
})
continue
}
if metric.Capacity <= 0 {
logger.Error("Failed to gather metrics for EBS volume. Received invalid EBS volume size.", logger.Fields{
"VolumeId": volumeId,
"SourceVolumeHostPath": hostPath,
"Error": err,
"taskArn": taskArn,
"Utilized": metric.Used,
"Size": metric.Capacity,
})
continue
}
logger.Debug("Gathered metrics for EBS volume", logger.Fields{
"VolumeId": volumeId,
"SourceVolumeHostPath": hostPath,
"taskArn": taskArn,
"Utilized": metric.Used,
"Size": metric.Capacity,
})
usedBytes := aws.Float64((float64)(metric.Used))
totalBytes := aws.Float64((float64)(metric.Capacity))
metrics = append(metrics, &ecstcs.VolumeMetric{
Expand Down
Loading