containers / prometheus-podman-exporter

Prometheus exporter for podman environments exposing containers, pods, images, volumes and networks information.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: enhance metrics ( include more labels )

lukasmrtvy opened this issue · comments

Is your feature request related to a problem? Please describe.
For example, New Relic does not support joining two metrics with the same label ATOW. This makes it very hard to understand graphs only with containerid legend.

Describe the solution you'd like
Would be superb to enhance all metrics with the same fields as for podman_container_info metric This should also include a feature request: #34.

--enhance-metrics=true

Additional context
Add any other context or screenshots about the feature request here.

A friendly reminder that this issue had no activity for 30 days.

A friendly reminder that this issue had no activity for 30 days.

I'm using vector to enrich metrics with all the labels from podman_container_info. Here's my vector.toml config:

[sources.prometheus_podman_exporter]
type = "prometheus_scrape"
endpoints = ["http://127.0.0.1:9882/metrics"]

scrape_interval_secs = 5

[sources.journald]
type = "journald"

[transforms.podman_metrics_enriched]
type = "lua"
inputs = ["prometheus_podman_exporter"]
version = "2"
hooks.init = """
function (emit)
  containerInfo = {}
end
"""
hooks.process = """
function (event, emit)
  if event.metric.name == "podman_container_info" then
    containerInfo[event.metric.tags.id] = event.metric.tags
    emit(event)
  elseif event.metric.name and event.metric.name:find("podman_container", 1, true) == 1 then
    local info = containerInfo[event.metric.tags.id]
    if info ~= nil then
      event.metric.tags.image = info.image
      event.metric.tags.name = info.name
      emit(event)
    end
  end
end
"""

[sinks.openobserve_prometheus_remote_write]
type = "prometheus_remote_write"
inputs = [ "podman_metrics_enriched" ]
endpoint = "http://localhost:5080/api/default/prometheus/api/v1/write"
auth.strategy = "basic"
auth.user = "me@example.com"
auth.password = "VERYSECUREPASSWORD"
healthcheck.enabled = false