Skip to content

[BUG] Remove invalid "Grafana without Prometheus" template branch #290

Description

@josecelano

Overview

Remove dead code from the Docker Compose template that handles an impossible configuration state: Grafana enabled without Prometheus. This template branch can never be executed because environment validation should reject this configuration. The code misleads readers into thinking this is a valid configuration.

Problem

The template has an {%- else %} branch for when Grafana is enabled but Prometheus is NOT:

grafana:
  depends_on:
{%- if prometheus %}
    prometheus:
      condition: service_healthy
{%- else %}
    - tracker  # <-- This branch handles an INVALID case
{%- endif %}

Why it's a bug

  • Grafana requires Prometheus as its data source - it has no purpose without it
  • The environment creation should fail validation if grafana.enabled = true and prometheus.enabled = false
  • This template branch can NEVER be reached in valid configurations
  • The code is dead code that misleads readers into thinking this is a valid configuration

Goals

  • Verify environment validation rejects grafana.enabled && !prometheus.enabled
  • Remove the dead {%- else %} branch from the Docker Compose template
  • Simplify template to always use Prometheus dependency when Grafana is enabled

Expected Template State After Fix

grafana:
  depends_on:
    prometheus:
      condition: service_healthy

Since Grafana can only exist when Prometheus exists (enforced by validation), no conditional is needed.

Implementation Plan

  1. Verify Validation - Search codebase for existing validation of Grafana/Prometheus relationship
  2. Remove Dead Code - Edit templates/docker-compose/docker-compose.yml.tera to remove the {%- else %} branch
  3. Verification - Run linters and E2E tests

Acceptance Criteria

  • Pre-commit checks pass: ./scripts/pre-commit.sh
  • Dead {%- else %} branch removed from Grafana depends_on section
  • Validation exists that rejects grafana.enabled && !prometheus.enabled
  • No regression in generated docker-compose.yml for valid configurations
  • E2E tests pass

Related

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions