hashicorp / hashicorp/nomad

Memory metrics for raw_exec tasks are missing

Open
#14,490 2 comments 0 reactions 0 assignees View on GitHub
stage/accepted theme/driver/raw_exec theme/metrics
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

### Nomad version

```
Nomad v1.3.1 (2b054e38e91af964d1235faa98c286ca3f527e56)
```

### Operating system and Environment details

```
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
```

### Issue

For tasks running with `raw_exec` task driver, memory related metrics aren't being exported. Is this an expected behaviour?

### Reproduction steps

Run a task as `raw_exec`:

```hcl
job "sleep" {
datacenters = ["dc1"]
type = "service"

group "app" {
count = 1
network {
mode = "bridge"
port "python-http" {
to = "8888"
}
}

task "app" {
driver = "raw_exec"

config {
command = "bash"
args = ["-c", "sleep infinity"]
}
}
}
}
```

When querying for metrics, notice that `nomad_client_allocs_memory_usage` is not exported for this task. If the task driver is changed to `exec` then memory related metrics start showing up.

However, this isn't the case for CPU related metrics. For eg `nomad_client_allocs_cpu_total_ticks` works for raw_exec

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the provided Nomad job with the raw_exec driver and compare its exported metrics with the same job using exec. Trace the task-driver metric handling for memory usage, then verify that nomad_client_allocs_memory_usage is exported for raw_exec while the existing CPU metric behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.