Skip to content

Container metrics query broken after LIKE→= change in #3438 #3463

@dmitriyzhirma

Description

@dmitriyzhirma

To Reproduce

  1. Create a Docker Compose application in Dokploy
  2. Deploy it (containers will have names like appname-service-1)
  3. Wait 1-2 minutes for metrics collection
  4. Go to the application → Monitoring tab
  5. Select any container from dropdown
  6. Observe: metrics show error or empty state

Debug verification:

# Check metrics are being saved (on the server)
sqlite3 /var/lib/dokploy/metrics.db "SELECT DISTINCT container_name FROM container_metrics;"
# Returns: appname-postgres-1, appname-redis-1, etc.

# Check what the API queries for
curl localhost:4500/metrics/containers?appName=appname-postgres
# Returns: null (because it searches for "appname" after stripping)

Current vs. Expected behavior

Current Behavior

Container metrics UI shows error or empty data. API endpoint /metrics/containers returns null for all containers.

Expected Behavior

Container metrics should display CPU, memory, network usage graphs for all monitored containers.

Provide environment information

- **Dokploy version:** latest
- **Deployment type:** Docker Compose
- **OS:** Ubuntu 22.04 (VPS)
- **Docker version:** 27.x

Which area(s) are affected? (Select all that apply)

Docker Compose

Are you deploying the applications where Dokploy is installed or on a remote server?

Same server where Dokploy is installed

Additional context

PR #3438 changed container name matching from LIKE ? || '%' to exact match (= ?) to fix collision issues between similarly named containers.

However, the stripping logic that removes the last -segment from container names was not removed. This logic was originally needed for LIKE prefix matching but now breaks exact matching.

Will you send a PR to fix it?

No

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions