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

export Job.Type as label 'job_type' #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
| nomad_serf_lan_members | How many members are in the cluster | |
| nomad_jobs | How many jobs are in the cluster | |
| nomad_allocations | How many allocations are in the cluster | |
| nomad_allocation_cpu | How much CPU allocation is consuming | job, group, alloc, region, datacenter, node |
| nomad_allocation_cpu_throttle | How much allocation CPU is throttled | job, group, alloc, region, datacenter, node|
| nomad_allocation_memory | How much memory allocation is consuming | job, group, alloc, region, datacenter, node |
| nomad_allocation_memory_limit | Allocation memory limit | job, group, alloc, region, datacenter, node |
| nomad_task_cpu_total_ticks | Task CPU total ticks | job, group, alloc, task, region, datacenter, node |
| nomad_task_cpu_percent | Task CPU usage, percent | job, group, alloc, task, region, datacenter, node |
| nomad_task_memory_rss_bytes | Task memory RSS usage, bytes | job, group, alloc, task, region, datacenter, node |
| nomad_allocation_cpu | How much CPU allocation is consuming | job, job_type, group, alloc, region, datacenter, node |
| nomad_allocation_cpu_throttle | How much allocation CPU is throttled | job, job_type, group, alloc, region, datacenter, node|
| nomad_allocation_memory | How much memory allocation is consuming | job, job_type, group, alloc, region, datacenter, node |
| nomad_allocation_memory_limit | Allocation memory limit | job, job_type, group, alloc, region, datacenter, node |
| nomad_task_cpu_total_ticks | Task CPU total ticks | job, job_type, group, alloc, task, region, datacenter, node |
| nomad_task_cpu_percent | Task CPU usage, percent | job, job_type, group, alloc, task, region, datacenter, node |
| nomad_task_memory_rss_bytes | Task memory RSS usage, bytes | job, job_type, group, alloc, task, region, datacenter, node |
| nomad_node_resource_memory_megabytes | Amount of allocatable memory the node has in MB | node, datacenter |
| nomad_node_allocated_memory_megabytes | Amount of memory allocated to tasks on the node in MB | node, datacenter |
| nomad_node_used_memory_megabytes | Amount of memory used on the node in MB | node, datacenter |
Expand Down
28 changes: 14 additions & 14 deletions nomad-exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,37 +55,37 @@ var (
allocationMemory = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "allocation_memory"),
"Allocation memory usage",
[]string{"job", "group", "alloc", "region", "datacenter", "node"}, nil,
[]string{"job", "job_type", "group", "alloc", "region", "datacenter", "node"}, nil,
)
allocationMemoryLimit = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "allocation_memory_limit"),
"Allocation memory limit",
[]string{"job", "group", "alloc", "region", "datacenter", "node"}, nil,
[]string{"job", "job_type", "group", "alloc", "region", "datacenter", "node"}, nil,
)
allocationCPU = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "allocation_cpu"),
"Allocation CPU usage",
[]string{"job", "group", "alloc", "region", "datacenter", "node"}, nil,
[]string{"job", "job_type", "group", "alloc", "region", "datacenter", "node"}, nil,
)
allocationCPUThrottled = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "allocation_cpu_throttle"),
"Allocation throttled CPU",
[]string{"job", "group", "alloc", "region", "datacenter", "node"}, nil,
[]string{"job", "job_type", "group", "alloc", "region", "datacenter", "node"}, nil,
)
taskCPUTotalTicks = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "task_cpu_total_ticks"),
"Task CPU total ticks",
[]string{"job", "group", "alloc", "task", "region", "datacenter", "node"}, nil,
[]string{"job", "job_type", "group", "alloc", "task", "region", "datacenter", "node"}, nil,
)
taskCPUPercent = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "task_cpu_percent"),
"Task CPU usage, percent",
[]string{"job", "group", "alloc", "task", "region", "datacenter", "node"}, nil,
[]string{"job", "job_type", "group", "alloc", "task", "region", "datacenter", "node"}, nil,
)
taskMemoryRssBytes = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "task_memory_rss_bytes"),
"Task memory RSS usage, bytes",
[]string{"job", "group", "alloc", "task", "region", "datacenter", "node"}, nil,
[]string{"job", "job_type", "group", "alloc", "task", "region", "datacenter", "node"}, nil,
)
nodeResourceMemory = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "node_resource_memory_megabytes"),
Expand Down Expand Up @@ -243,26 +243,26 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
}
for taskName, taskStats := range stats.Tasks {
ch <- prometheus.MustNewConstMetric(
taskCPUPercent, prometheus.GaugeValue, taskStats.ResourceUsage.CpuStats.Percent, alloc.Job.Name, alloc.TaskGroup, alloc.Name, taskName, alloc.Job.Region, node.Datacenter, node.Name,
taskCPUPercent, prometheus.GaugeValue, taskStats.ResourceUsage.CpuStats.Percent, alloc.Job.Name, alloc.Job.Type, alloc.TaskGroup, alloc.Name, taskName, alloc.Job.Region, node.Datacenter, node.Name,
)
ch <- prometheus.MustNewConstMetric(
taskCPUTotalTicks, prometheus.GaugeValue, taskStats.ResourceUsage.CpuStats.TotalTicks, alloc.Job.Name, alloc.TaskGroup, alloc.Name, taskName, alloc.Job.Region, node.Datacenter, node.Name,
taskCPUTotalTicks, prometheus.GaugeValue, taskStats.ResourceUsage.CpuStats.TotalTicks, alloc.Job.Name, alloc.Job.Type, alloc.TaskGroup, alloc.Name, taskName, alloc.Job.Region, node.Datacenter, node.Name,
)
ch <- prometheus.MustNewConstMetric(
taskMemoryRssBytes, prometheus.GaugeValue, float64(taskStats.ResourceUsage.MemoryStats.RSS), alloc.Job.Name, alloc.TaskGroup, alloc.Name, taskName, alloc.Job.Region, node.Datacenter, node.Name,
taskMemoryRssBytes, prometheus.GaugeValue, float64(taskStats.ResourceUsage.MemoryStats.RSS), alloc.Job.Name, alloc.Job.Type, alloc.TaskGroup, alloc.Name, taskName, alloc.Job.Region, node.Datacenter, node.Name,
)
}
ch <- prometheus.MustNewConstMetric(
allocationCPU, prometheus.GaugeValue, stats.ResourceUsage.CpuStats.Percent, alloc.Job.Name, alloc.TaskGroup, alloc.Name, alloc.Job.Region, node.Datacenter, node.Name,
allocationCPU, prometheus.GaugeValue, stats.ResourceUsage.CpuStats.Percent, alloc.Job.Name, alloc.Job.Type, alloc.TaskGroup, alloc.Name, alloc.Job.Region, node.Datacenter, node.Name,
)
ch <- prometheus.MustNewConstMetric(
allocationCPUThrottled, prometheus.GaugeValue, float64(stats.ResourceUsage.CpuStats.ThrottledTime), alloc.Job.Name, alloc.TaskGroup, alloc.Name, alloc.Job.Region, node.Datacenter, node.Name,
allocationCPUThrottled, prometheus.GaugeValue, float64(stats.ResourceUsage.CpuStats.ThrottledTime), alloc.Job.Name, alloc.Job.Type, alloc.TaskGroup, alloc.Name, alloc.Job.Region, node.Datacenter, node.Name,
)
ch <- prometheus.MustNewConstMetric(
allocationMemory, prometheus.GaugeValue, float64(stats.ResourceUsage.MemoryStats.RSS), alloc.Job.Name, alloc.TaskGroup, alloc.Name, alloc.Job.Region, node.Datacenter, node.Name,
allocationMemory, prometheus.GaugeValue, float64(stats.ResourceUsage.MemoryStats.RSS), alloc.Job.Name, alloc.Job.Type, alloc.TaskGroup, alloc.Name, alloc.Job.Region, node.Datacenter, node.Name,
)
ch <- prometheus.MustNewConstMetric(
allocationMemoryLimit, prometheus.GaugeValue, float64(alloc.Resources.MemoryMB), alloc.Job.Name, alloc.TaskGroup, alloc.Name, alloc.Job.Region, node.Datacenter, node.Name,
allocationMemoryLimit, prometheus.GaugeValue, float64(alloc.Resources.MemoryMB), alloc.Job.Name, alloc.Job.Type, alloc.TaskGroup, alloc.Name, alloc.Job.Region, node.Datacenter, node.Name,
)
}(a)
}
Expand Down